Author Topic: Still having issues linking due to command line limitations  (Read 5922 times)

Offline renebarto

  • Single posting newcomer
  • *
  • Posts: 7
Still having issues linking due to command line limitations
« 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

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: Still having issues linking due to command line limitations
« Reply #1 on: January 23, 2014, 02:39:23 am »
If you (temporarily) replace the variable $ORIGIN with its actual value, what happens?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Still having issues linking due to command line limitations
« Reply #2 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.
(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 Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Still having issues linking due to command line limitations
« Reply #3 on: January 23, 2014, 06:12:41 am »

Offline renebarto

  • Single posting newcomer
  • *
  • Posts: 7
Re: Still having issues linking due to command line limitations
« Reply #4 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.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Still having issues linking due to command line limitations
« Reply #5 on: January 24, 2014, 08:30:20 pm »
It is not at least on linux. It works with way longer command lines.
(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 renebarto

  • Single posting newcomer
  • *
  • Posts: 7
Re: Still having issues linking due to command line limitations
« Reply #6 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

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Still having issues linking due to command line limitations
« Reply #7 on: February 01, 2014, 03:18:09 pm »
Interesting hack :)
(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!]