[Scons-users] How do I specify special link options?
Evan Driscoll
driscoll at cs.wisc.edu
Tue Aug 14 14:34:18 EDT 2012
If you want GCC to pass an object to the linker, you use -Wl. So try
adding '-Wl,--unresolved-symbols=ignore-in-object-files' to LINKFLAGS.
(',' in a -Wl flag is translated to a space, so you could also probably
say '-Wl,--unresolved-symbols,ignore-in-object-files'. The usual place
I've seen this used is when specifying --rpath, but SCons provides a way
to do that directly.)
Evan
On 08/14/2012 01:27 PM, Peter Steele wrote:
> 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
>
>
>
> _______________________________________________
> Scons-users mailing list
> Scons-users at scons.org
> http://four.pairlist.net/mailman/listinfo/scons-users
More information about the Scons-users
mailing list