Author Topic: CodeBlocks' Linux build environment - Question to Linux-Guru's  (Read 7894 times)

Offline tiwag

  • Developer
  • Lives here!
  • *****
  • Posts: 1196
  • sailing away ...
    • tiwag.cb
Hi friends,

what i've done till now:

i've set up a Ubuntu 5.04 as guest OS in VWware hosted on WinXP,
then following the instructions from this wiki
http://wiki.codeblocks.org/index.php/Compiling_Code::Blocks_in_Linux_(applies_to_all_distros)
i downloaded wxGTK-2.4.2 and CodeBlocks 1.0-RC1-1 sources.

then i patched wxGTK-2.4.2 and built it using
Code
./configure --enable-gtk2

then i built CodeBlocks RC1-1 using
Code
make -f Makefile.unix

then the wiki says
Quote
This will build everything: the application and the plugins. The final step is to update the working environment for your system:
Code
make -f Makefile.unix update
it was not working with my Makefile.unix from the RC1-1 download,
but the following steps with
Code
dos2unix Makefile.unix
./update
worked and i got a run.sh to start my CodeBlocks

so far so good - my CodeBlocks on Linux is up and running


after a little investigating and learning about what i've done so far (i'm still a Linux n00b)
i found out that installing wxGTK-2.4.2 with this method installs (rather exclusively)?
a shared ansi version of wxwidgets in /usr/local

Code
headers in /usr/local/include
libs    in /usr/local/lib

and somehow automagically the compiler and linker finds them even if the makefile
only sets include and lib pathes to /usr/include and /usr/lib ???
why does gcc find the wxGTK- headers ?


from my windows build-environment i'm used to have several wxMSW builds from the
same wxWidgets-version, for example:

wxMSW-2.4.2
Code
all headers     : in /wx242/include
all sources     : in /wx242/src
and libs according to flavour
dll lib ansi    : in /wx242/lib/gcc_dll
dll lib unicode : in /wx242/lib/gcc_dllu
static lib ansi : in /wx242/lib/gcc_lib

and also another version of wxWidgets

wxMSW-2.6.1
Code
all headers     : in /wx261/include
all sources     : in /wx261/src
and libs according to flavour or used compiler
dll lib ansi    : in /wx261/lib/gcc_dll
static lib ansi : in /wx261/lib/gcc_lib
dll lib ansi    : in /wx261/lib/vc_dll      (VC++)
static lib ansi : in /wx261/lib/vc_lib      (VC++)

installed in parallel.

and when i want to build my application with several versions or flavours of wxwidgets i define several
targets and change the directory entries for the proper include (setup.h) and lib files.
so i'm able to build the same source with wx242-dll, -dll-unicode, -static-lib and wx261-dll and -static-lib

how can i manage to intall such a structure on Linux ?

(it obviously doesn't work with "configure" and "make install", because then
only one single version and flavour of wxGTK is ready to use)

i look forward to your suggestions for my setup
-thanks in advance

grv575

  • Guest
Re: CodeBlocks' Linux build environment - Question to Linux-Guru's
« Reply #1 on: August 16, 2005, 12:55:07 pm »
Sure this is quite common (e.g. qt or kde in /opt).  Do
mkdir /opt/wx26
cd /opt; ln -s wx26 wx
./configue --prefix=/opt/wx26 ..
make && make install
nano /etc/ld.so.conf
   /opt/wx
ldconfig

then it will automatically find libs in /opt/wx (which points to /opt/wx26).  you can also specify include/lib dirs to gcc the same way you're used to doing in windows...so different wxwidgets versions in various /opt subdirectories is no problem.

Offline tiwag

  • Developer
  • Lives here!
  • *****
  • Posts: 1196
  • sailing away ...
    • tiwag.cb
Re: CodeBlocks' Linux build environment - Question to Linux-Guru's
« Reply #2 on: August 16, 2005, 01:18:47 pm »
thanks grv575 !

can you please comment this line
cd /opt; ln -s wx26 wx
i dont understand what it's doing actually

the rest looks quite easy  8)
and logical - when i understand right -
the clue is to give configure the "--prefix=/mydir" in order to separate different builds. i.e.
dll ansi :  "--prefix=/opt/wx24dll"
dll unicode : "--prefix=/opt/wx24dllu"
lib ansi : "--prefix=/opt/wx24lib"
lib unicode : "--prefix=/opt/wx24libu"
right ?

-thanks
« Last Edit: August 16, 2005, 01:22:23 pm by tiwag »

Offline fiammy

  • Multiple posting newcomer
  • *
  • Posts: 46
    • Nebulagame
Re: CodeBlocks' Linux build environment - Question to Linux-Guru's
« Reply #3 on: August 16, 2005, 02:34:11 pm »
The 'ln' command makes a link. It's like a shortcut on windows, but it can be used as an 'alias' for that directory. What you do, is pass through the access to the '/opt/wx' folder towards the /opt/wx26 folder.

grv575

  • Guest
Re: CodeBlocks' Linux build environment - Question to Linux-Guru's
« Reply #4 on: August 16, 2005, 04:36:57 pm »
Yeah, ln -s makes a symbolic link (symlink) to a directory/file.  So cd /opt; ln -s wx26 wx would make /opt/wx a symbolic link for the /opt/wx26 directory.  This just makes it easier to select which wx installation is used as the default.  You can just place /opt/wx in /etc/ld.so.conf, run ldconfig to recognize the changes to that loader file, and then linux will use whatever /opt/wx points to as the link path to link against.  you could later do cd /opt; rm wx; ln -s wx24 wx.  Or whatever other wxWidgets builds are in /opt.  So yeah, just use the --prefix flag to build each wx build to a different /opt subdirectory.