Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: renebarto on January 23, 2014, 01:23:09 am

Title: Still having issues linking due to command line limitations
Post by: renebarto on January 23, 2014, 01:23:09 am
Hi, I posted about a week ago on a problem I had when linking quite a few object files together to an so on Linux (Ubuntu 12.04, running CodeBlocks 13.12, upgraded from 10.05 finally).

My link statement is this:
g++  -L../../../bin/Debug -o ../../../bin/Debug/Core.Test obj/Debug/src/CoreMutexTest.o obj/Debug/src/Main.o obj/Debug/src/CoreWorkerThreadTest.o obj/Debug/src/CoreTimerTest.o obj/Debug/src/CoreTimeStampTest.o obj/Debug/src/CoreThreadTest.o obj/Debug/src/CoreTextWriterTest.o obj/Debug/src/CoreTextReaderTest.o obj/Debug/src/CoreStreamTest.o obj/Debug/external/gtest/gtest-all.o obj/Debug/src/CoreManualEventTest.o obj/Debug/src/CoreCyclicBufferTest.o obj/Debug/src/CoreByteArrayTest.o obj/Debug/src/CoreAutoEventTest.o obj/Debug/src/CoreArrayTest.o obj/Debug/src/CoreActiveObjectTest.o  -Wl,-rpath,'$ORIGIN' -lCore -lrt -lpthread

When building from a makefiles, this works perfectly. However, when I set the linker to echo instead of actually link in CodeBlocks, the output is:
g++  -L../../../bin/Debug -o ../../../bin/Debug/Core.Test obj/Debug/src/CoreMutexTest.o obj/Debug/src/Main.o obj/Debug/src/CoreWorkerThreadTest.o obj/Debug/src/CoreTimerTest.o obj/Debug/src/CoreTimeStampTest.o obj/Debug/src/CoreThreadTest.o obj/Debug/src/CoreTextWriterTest.o obj/Debug/src/CoreTextReaderTest.o obj/Debug/src/CoreStreamTest.o obj/Debug/external/gtest/gtest-all.o obj/Debug/src/CoreManualEventTest.o obj/Debug/src/CoreCyclicBufferTest.o obj/Debug/src/CoreByteArrayTest.o obj/Debug/src/CoreAutoEventTest.o obj/Debug/src/CoreArrayTest.o obj/Debug/src/CoreActiveObjectTest.o  -Wl,-rpath,

This points to a chopping of of the command line. Does this sound familiar? I had the same problem with CB 10.05, but the upgrade to 13.12 does not seem to help.

This is really a pity, as I strongly prefer CB over Eclipse!

Regards,

Rene Barto
Title: Re: Still having issues linking due to command line limitations
Post by: Alpha on January 23, 2014, 02:39:23 am
If you (temporarily) replace the variable $ORIGIN with its actual value, what happens?
Title: Re: Still having issues linking due to command line limitations
Post by: oBFusCATed on January 23, 2014, 02:48:31 am
You have to use \$\$ORIGIN or \$\$\$ORIGIN, I don't remember which worked exactly. This is required because both C::B and the shell escape $ORIGIN as variable and replace it with empty string.
Title: Re: Still having issues linking due to command line limitations
Post by: Jenna on January 23, 2014, 06:12:41 am
MIght also (unfortunately) be \\$$$ORIGIN.
See http://forums.codeblocks.org/index.php/topic,17956.msg122834.html#msg122834 (http://forums.codeblocks.org/index.php/topic,17956.msg122834.html#msg122834)
Title: Re: Still having issues linking due to command line limitations
Post by: renebarto on January 24, 2014, 12:20:40 pm
Hello guys, thanks for your replies, however that does not solved it. Looking deeper into the code, it seems that wxExecute, used to dispatch the commands, has an issues that the command line is limited to something like 255 characters. I haven't looked into the wx library code yet, but will do soon.
Title: Re: Still having issues linking due to command line limitations
Post by: oBFusCATed on January 24, 2014, 08:30:20 pm
It is not at least on linux. It works with way longer command lines.
Title: Re: Still having issues linking due to command line limitations
Post by: renebarto on February 01, 2014, 03:15:21 pm
Hi everyone, I tried a bit more, and you're right, it is not the command line length. I found a post that is giving the answer:

http://forums.codeblocks.org/index.php?topic=925.0;prev_next=prev

Escaping $ by $`` actually works. I'm also using cbp2make to create makefiles from the cbp projects, and now that has an issue, but I'm trying to fix that.

Anyway, I thought you'd like to know there is a solution.

Regards,

Rene
Title: Re: Still having issues linking due to command line limitations
Post by: oBFusCATed on February 01, 2014, 03:18:09 pm
Interesting hack :)