Author Topic: CodeBlocks being called from hudson (on linux)  (Read 20265 times)

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5193
Re: CodeBlocks being called from hudson (on linux)
« Reply #15 on: December 30, 2010, 10:16:45 am »
I am trying the personality idea.
This is what I did (experiment from a shell)

1) copied my default.conf to another directory and renamed it to hudson_cb.conf
2) in a shell : codeblocks --personality=/home/killerbot/hudson_cb.conf
3) --> was just like a very first run of CB,so also compiler detection
4) closed that CB --> wanted to save a default.conf , clicked OK
5)
Code: [Select]
Could not save config file...: Warning
Aborted
Even when I kept it named as default.conf, same thing.

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7265
    • Jens' unofficial debian-repository for the Code::Blocks - IDE
Re: CodeBlocks being called from hudson (on linux)
« Reply #16 on: December 30, 2010, 12:06:02 pm »
the conf-file has to be either in the users ~/.codeblocks directory or in the same directory as the C::B executable.
As workaround, you can use a relative path (starting from your exe-folder), in your case -p ../../../home/killerbot/.codeblocks/.default (or wherever the conf-file you want to use is located).
The file-ending is appended automatically by C::B.

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7265
    • Jens' unofficial debian-repository for the Code::Blocks - IDE
Re: CodeBlocks being called from hudson (on linux)
« Reply #17 on: December 30, 2010, 12:46:25 pm »
The clean solution would be to create a real C::B console-app.

I will try to revive my ugly patch (mentioned before) and instead of using tons of ifdefs, split he used parts of C::B (mainly compiler-plugin, some core-sdk parts like plugin-manager etc.) into a base-part, that works also on a console and a derived (gui-) part.

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5193
Re: CodeBlocks being called from hudson (on linux)
« Reply #18 on: December 30, 2010, 01:56:47 pm »
I made a copy of my default.conf, renamed it to hudson.conf and copied next to my system codeblocks executable.

and then had hudson launch CB with --personality=hudson.

The good news : it ran.

The less good news :
- no stdout output to discover, so one might even wonder if anything did build ...
- not tried yet : but probably on a build error, things will remain invisible, and we would have no clue if it succeeded or what did fail (gonna try this later on)

When I use the above mentioned manual launch of hudson, then we could see the build progress dialog, and next to that hudson saw coming in (through stdout ??) the content of that build progress dialog. That way it can be seen in the hudson build log what has happened, and in case something failed, what had failed.

So to be really useful, I think we need that stdout behavior, How can we get that back, combined with the xinit/xvnc/personality way.

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7265
    • Jens' unofficial debian-repository for the Code::Blocks - IDE
Re: CodeBlocks being called from hudson (on linux)
« Reply #19 on: December 30, 2010, 02:26:47 pm »
I always write the log to a html-file, that's not the same, but a possible solution.
You can also try to redirect stdout/stderr to a file (and show it with tail -f flename) or a tty to see the output.

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5193
Re: CodeBlocks being called from hudson (on linux)
« Reply #20 on: December 30, 2010, 02:40:24 pm »
I am afraid that hudson won't be able to understand the log file, or display it; since it is expecting raw text, but something to try ...
EDIT : did a cat of the build html file, it is better than nothing, but not the ultimate solution, one can not 'monitor' the build, since output only pops up at the end, and just a cat of a html file is not really readable.

EDIT 2 : in this setup, when a build error occurs, hudson has no clue of it, probably for 2 reasons :
- it can't scan anything on stdout (if it already does this)
- the return value of CB/compiler is probably not propagated due to the xinit ?
« Last Edit: December 30, 2010, 02:57:36 pm by killerbot »

Offline san

  • Multiple posting newcomer
  • *
  • Posts: 20
Re: CodeBlocks being called from hudson (on linux)
« Reply #21 on: December 31, 2010, 10:08:19 am »
Jens, it would be great if there would be an option to build codeblocks projects without the need for an X server. It would make it possible to run automated nightly builds on a dedicated server.

Don't mean to hijack this thread but when attempting to do nightly builds without the need for an X server leads to a search for other buildsystems and purely use codeblocks as an advanced text editor. Right now I'm looking at Waf and Scons which seems both flexible. And are there plans to support other other build systems (like Makefiles) from codeblocks?

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7265
    • Jens' unofficial debian-repository for the Code::Blocks - IDE
Re: CodeBlocks being called from hudson (on linux)
« Reply #22 on: December 31, 2010, 10:40:19 am »
C::B partly supports makefiles.
It can call them, but in this case it is really just a better editor (with code-completion etc.), but the power of C::B's build-system can not be used.

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5193
Re: CodeBlocks being called from hudson (on linux)
« Reply #23 on: December 31, 2010, 11:07:23 am »
one very powerfull use case of CB as a build system, is when you have code to be compiled for different platforms, or just with different compilers.

Example : a library
- target 1 : gcc debug
- target 2 : gcc release
- target 3 : cross compiler debug
- target 4 : cross compiler release
- and so on

Just tell CB to build the cbp project file, and you get all of them, much easier compared to make files. Note it will no always be the best tool for the job, but in many use cases it is.

Basically : can the build engine of CB get a non gui front-end, and in such a way that it can start up without an x server being present.

EDIT : the batch builds are a first step, but seems we need a bit more.
« Last Edit: December 31, 2010, 02:10:20 pm by killerbot »

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7265
    • Jens' unofficial debian-repository for the Code::Blocks - IDE
Re: CodeBlocks being called from hudson (on linux)
« Reply #24 on: December 31, 2010, 10:09:35 pm »
@killerbot:
do you use 64-bit or 32-bit linux ?
Which distro do you use ?

I just revived the ugly, hacky "ifdef"-console-C::B. I had to apply the 190kB patch manually, but now it works.
I just compile dthe whole C::B (core and contrib-plugins) on a real console (not virtual terminal).

I test it on other distros (centos will be the first) and see if it works there without recompiling.

That's a first step (and proof of concept). Now I will try to split the relevant sources in base and gui-parts.

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5193
Re: CodeBlocks being called from hudson (on linux)
« Reply #25 on: January 01, 2011, 02:52:34 am »
I am using OpenSuse 11.3 on 64 bit machines. Currently no 32 bit linux installed.

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7265
    • Jens' unofficial debian-repository for the Code::Blocks - IDE
Re: CodeBlocks being called from hudson (on linux)
« Reply #26 on: January 01, 2011, 01:05:33 pm »
I am using OpenSuse 11.3 on 64 bit machines. Currently no 32 bit linux installed.
You can try this package: http://apt.jenslody.de/downloads/codeblocks_con_suse11.2_64.tar.bz2 .
It's compiled (as the name says) on openSuse 11.2 64bit.
Just unpack it and call run_con.sh (instead of codeblocks_con directly).
It should work from a real (non virtual) console.

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5193
Re: CodeBlocks being called from hudson (on linux)
« Reply #27 on: January 02, 2011, 10:08:12 am »
Thanks Jens, I gave this one a try, but there's a linker issue :

Code: [Select]
+ /home/killerbot/BurnTemp/output/run_con.sh --personality=hudson --rebuild --target=Debug Arrays/Arrays.cbp
/home/killerbot/BurnTemp/output/codeblocks_con: relocation error: /home/killerbot/BurnTemp/output/libcodeblocks_con.so: symbol _Z18wxSafeConvertWX2MBPKw, version WXU_2.8 not defined in file libwx_baseu-2.8.so.0 with link time reference

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7265
    • Jens' unofficial debian-repository for the Code::Blocks - IDE
Re: CodeBlocks being called from hudson (on linux)
« Reply #28 on: January 02, 2011, 10:21:02 am »
It looks like the wxGTK from 11.2 and 11.3 are not compatible.
I caqn update my 64 bit openSuse vm to 11.3 tomorrow ( I still only have ISDN at home ) and recompile it.

Or I can send you the patch (or attach it here).

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5193
Re: CodeBlocks being called from hudson (on linux)
« Reply #29 on: January 02, 2011, 10:42:14 am »
I can wait for your build till tomorrow, no problem.
Have some other stuff to carry out today.