Sysprogs forums › Forums › VisualGDB › Recursive linking
- This topic has 4 replies, 2 voices, and was last updated 10 years, 4 months ago by ralphc.
-
AuthorPosts
-
April 17, 2014 at 14:29 #780ralphcParticipant
Hi,
I’ve noticed that the –start-group and –end-group options include shared object library files as well as archive files. According to the Linux man page for ld, http://linux.die.net/man/1/ld , only archive files should be placed within these options. The reason I mention this, is that having so files within the –start-group/–end-group options caused my project to fail to link but when I manually moved the files to outside the options the build succeeded.
I hope this is useful feedback.
Ralph
April 21, 2014 at 19:04 #3040supportKeymasterHi,
We are putting –start-group/–end-group around all files because the -lXXX form can refer to either libXXX.a or libXXX.so depending on what is available in the library directories. We also tested it with shared libraries and did not encounter any problems.
Could you please share a log showing the command line and the build error you encountered? If we could reproduce it on our side, we should be able to provide a solution that works for both cases.May 30, 2014 at 15:20 #3043ralphcParticipantHi,
Sorry for the late response. Work has been really busy!
I’ve put together a test application showing the issue. I’ve got an application called LibraryLinkApp. This application is dependent on a static library called StaticA. The static library is then dependent on an so called DynamicB. All three projects are stored within a single solution. I’ve set LibraryLinkApp’s dependencies so that it is dependent on the two libraries. I’ve set StaticA’s project settings so that it’s dependent on DynamicB. When I build the application I get undefined references to methods in the DynamicB library. The output from make is:
g++ -o Debug/LibraryLinkingTest -Wl,-gc-sections -Wl,--start-group Debug/LibraryLinkingTest.o ../DynamicB/Debug/DynamicB.so ../StaticA/Debug/StaticA.a -Wl,--rpath='$ORIGIN' -Wl,--rpath='$ORIGIN/../../DynamicB/Debug/' -Wl,--rpath='$ORIGIN/../../StaticA/Debug/' -Wl,--end-group ../StaticA/Debug/StaticA.a(A.o): In function `A::GetDependentClassName()': /opt/library_link_test/StaticA/A.cpp:15: undefined reference to `B::GetClassName()' ../StaticA/Debug/StaticA.a(A.o): In function `A::GetDependentLibraryName()': /opt/library_link_test/StaticA/A.cpp:20: undefined reference to `B::GetLibraryName()' collect2: ld returned 1 exit status make: *** [Debug/LibraryLinkingTest] Error 1
However, if I move DynamicB.so to outside the –start/–end-group sections it compiles correctly. I hope this helps. If you need any further information let me know.
Ralph
July 11, 2014 at 09:32 #3041ralphcParticipantHi bazis,
Have you or any of your colleagues had time to look at my previous post?
Ralph
July 24, 2014 at 01:33 #3042supportKeymasterHi,
Sorry for the delay. Can you send us an archive with your test application (or attach it here) so that we could experiment with it on our side to figure out the root cause of the problem?
-
AuthorPosts
- You must be logged in to reply to this topic.