[Scons-users] How do I specify special link options?

Peter Steele pwsteele at gmail.com
Tue Aug 14 14:27:04 EDT 2012


I am working with a shared library for which I know there will be unresolved
externals when I link it with an application. I tried to create a SConstruct
file for my app and include the option



--unresolved-symbols=ignore-in-object-files



for the linker. I could not get it to work right though. My first attempt
was to do this:



env = Environment(CCFLAGS = ['--unresolved-symbols=ignore-in-object-files'])



but this link option gets interpreted by gcc as an invalid option when
specified in this manner. I instead tried



env = Environment(LINKFLAGS =
['--unresolved-symbols=ignore-in-object-files'])



but this did not solve the problem either. After some research I tried this
approach:



env = Environment(LINK = ['/usr/bin/ld'], LINKFLAGS =
['--unresolved-symbols=ignore-in-object-files'])



which forces Scons to use ld intead of gcc for the link command. This solved
the problem-the link option was finally accepted as valid-but the link ended
up failing with



/usr/bin/ld: warning: cannot find entry symbol _start; defaulting to
00000000004002d0



I did some research on this message and discovered it was related to a
missing symbol that's normally defined in /usr/lib/crt1.o that doesn't get
included when ld is used for linking instead of gcc.



My impression is that this is getting way too complicated for what I need to
do. Am I missing something obvious? How can I get this link option to work
without hacking up my SConstruct file.



Peter






-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://four.pairlist.net/pipermail/scons-users/attachments/20120814/dc9b7655/attachment.htm>


More information about the Scons-users mailing list