Author Topic: CodeBlocks doesn't recognize new toolchain  (Read 5022 times)

Offline zarvuvit

  • Single posting newcomer
  • *
  • Posts: 4
CodeBlocks doesn't recognize new toolchain
« on: July 22, 2012, 09:35:21 pm »
Hi,
Recently I've installed the Code::Blocks 10.05 on Debian.
It recognized my installed gcc/g++ compiler, which is version 4.4.5.
Then I've build and installed into the /usr/local new gcc/g++ (ver. 4.7.1)
Created the new toolchain under Code::Blocks, by means of copying "GNU GCC Compiler" toolchain and changing the path of compiler's installation directory under the newly created toolchain.
Unfortunately it didn't help. No matter what I was doing any project is created by old toolchain, or at least it linked against the libraries belonging to the old toolchain.

What I'm missing ?   ???

Thank you

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: CodeBlocks doesn't recognize new toolchain
« Reply #1 on: July 22, 2012, 11:27:15 pm »
Have you read this: http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28errors%29#Q:_How_do_I_troubleshoot_a_compiler_problem.3F
And have you tried the steps depicted there?

p.s. try using gcc-4.7.0 instead of gcc, c::b might search for the compiler's executables in the path...
p.p.s. gcc-4.7 is not supported by 10.05, you need a relatively new nightly build, see the nightly build sub-forum for details how to get a new build.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline zarvuvit

  • Single posting newcomer
  • *
  • Posts: 4
Re: CodeBlocks doesn't recognize new toolchain
« Reply #2 on: July 23, 2012, 06:26:08 pm »
Hi,
Thanks for the fast reply, but...
I didn't read the link you've sent, and there's no chance I would find it , since I have no errors during build.
Anything compiled correctly, but by the wrong compiler.
I've tried to call newly compiled compiler by the different name, in order the CB will not be confused, but without luck.
The CB insist to build anything with the old version it found under /usr/bin and doesn't bother itself to use the one
installed under /usr/local (either by correct name, e.g. gcc/g++ or the one I've contrived)
Second, I don't understand what does it mean the CB-10.05 doesn't support gcc-4.7.
How the CB knows what kind of version I'm going to use ?
Besides, meanwhile I'm not using something specific for 4.7 that doesn't exist in 4.6.
Nevertheless, I have no a clue while it insist to use something it found in default path and ignore my request.
And by the way, I've created the new toolchain  but CB didn't saved it, so after I've restarted the CB the only toolchains that was present, was those predefined from the beginning.

Thanks again and have a good day

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: CodeBlocks doesn't recognize new toolchain
« Reply #3 on: July 23, 2012, 06:34:14 pm »
What I'm missing ?   ???

Project -> Build Options -> Select your compiler from the "Selected compiler" drop down.

@devs: why do we have project and target drop-downs? (I don't see a per target option to use the project setting as the default)
« Last Edit: July 23, 2012, 07:03:56 pm by dmoore »

Offline zarvuvit

  • Single posting newcomer
  • *
  • Posts: 4
Re: CodeBlocks doesn't recognize new toolchain
« Reply #4 on: July 23, 2012, 09:54:12 pm »
Thanks for the answer.
Now the situation is better, e.g. I can see clearly that the project is built with the new compiler.
But when I'm running the "ldd" on the final executable , I see that it was built against the wrong libraries, e.g. those that was built (supplied) with the gcc-4.4.5 and reside under /usr, i.e. /usr/lib/libstdc++.so and /usr/lib/libgcc_s.so.1.
Even though I've specifically put the right libraries in the toolchain properties the result is wrong.
What is even more strange is the following:
The output from the "Build log":


g++-4.7.1 -std=c++0x -Wall -g  -std=c++0x -Wall   -I/usr/local/bin  -c /home/uri/CodeBlocksProjects/Proj/main.cpp -o obj/Debug/main.o

g++-4.7.1 -L/usr/local/lib64  -o bin/Debug/Proj/obj/Debug/main.o    /usr/local/lib64/libstdc++.so /usr/local/lib64/libgcc_s.so
Output size is 24.92 KB
Process terminated with status 0 (0 minutes, 0 seconds)
0 errors, 0 warnings
 
Now if you'll take a look closely on the second raw, you can see that something wrong going here; the actual line should be:
g++-4.7.1 -L/usr/local/lib64  -o bin/Debug/Proj/obj/Debug/main.o   -llibstdc++ -llibgcc_s


The final result of "ldd" :
ldd ~/CodeBlocksProjects/Proj/bin/Debug/Proj
        linux-vdso.so.1 =>  (0x00007fff4b8f5000)
        libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007f864ce37000)
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00007f864cc21000)
        libm.so.6 => /lib/libm.so.6 (0x00007f864c99e000)
        libc.so.6 => /lib/libc.so.6 (0x00007f864c63c000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f864d16c000)

Offline zarvuvit

  • Single posting newcomer
  • *
  • Posts: 4
Re: CodeBlocks doesn't recognize new toolchain
« Reply #5 on: July 23, 2012, 10:08:18 pm »
Dear fellows,
It's quite embarrassing to admit, but ..........
Unfortunately I'm probably quite an idiot that drunk too much beer ........................  :-[ :-[ :-[
The CB did anything all right , but I had to change the LD_LIBRARY_PATH or /etc/ld.so.conf in order the loader will choose the right libraries .

Sorry for wasting your time .  :'(