Discussion:
[Scons-users] SCons puts the quoted LINKFLAGS value into the command line
Yuri
2017-12-29 17:20:41 UTC
Permalink
Failure:
g++6 -o lib/libtmv.so.0 " -L/usr/local/lib -fstack-protector -Wl,-rpath=/usr/local/lib/gcc6 -L/usr/local/lib/gcc6" -fopenmp -shared ...
g++6: error: -L/usr/local/lib -fstack-protector -Wl,-rpath=/usr/local/lib/gcc6 -L/usr/local/lib/gcc6: No such file or directory

How to complete the build of this project?

------------------------------------------------------------------------

Project:https://github.com/rmjarvis/tmv
OS: FreeBSD 11.1


Yuri
Mats Wichmann
2017-12-29 18:01:20 UTC
Permalink
Post by Yuri
g++6 -o lib/libtmv.so.0 " -L/usr/local/lib -fstack-protector
-Wl,-rpath=/usr/local/lib/gcc6 -L/usr/local/lib/gcc6" -fopenmp -shared ...
g++6: error:  -L/usr/local/lib -fstack-protector
-Wl,-rpath=/usr/local/lib/gcc6 -L/usr/local/lib/gcc6: No such file or
directory
How to complete the build of this project?
split the link information into distinct arguments when adding to
LINKFLAGS. You can do that manually (write it as a list/tuple), or use
the Python split(), or the SCons Split().

Perhaps something like:

env.AppendUnique(LINKFLAGS=Split("-L/usr/local/lib -fstack-protector
Post by Yuri
-Wl,-rpath=/usr/local/lib/gcc6 -L/usr/local/lib/gcc6"))
or if you're fishing it out of the environment, which we have a case of
in our codebase so I have an example:

env.AppendUnique(LINKFLAGS=Split(os.environ['LDFLAGS']))
Yuri
2017-12-29 19:21:39 UTC
Permalink
Post by Mats Wichmann
split the link information into distinct arguments when adding to
LINKFLAGS. You can do that manually (write it as a list/tuple), or use
the Python split(), or the SCons Split().
In my case, the FreeBSD framework supplies LINKFLAGS as an argument:

MAKE_ARGS+=... LINKFLAGS="${LINKFLAGS}"...


Code only has env.AppendUnique for some additional individual values,
like this: env.AppendUnique(LINKFLAGS=ldflag)

It doesn't explicitly accept the LINKFLAGS supplied as an argument.

Does it mean that arguments are automatically appended to env?

How do I split that value in this case?


Yuri
Yuri
2017-12-29 21:22:13 UTC
Permalink
Post by Yuri
MAKE_ARGS+=... LINKFLAGS="${LINKFLAGS}"...
Code only has env.AppendUnique for some additional individual values,
like this: env.AppendUnique(LINKFLAGS=ldflag)
It doesn't explicitly accept the LINKFLAGS supplied as an argument.
Does it mean that arguments are automatically appended to env?
How do I split that value in this case?
I think, this is a bug in SCons.

LINKFLAGS with spaces, passed as an argument, need to be automatically
converted to array, not used as-is.


So you agree?


Yuri
Bill Deegan
2017-12-30 05:32:44 UTC
Permalink
No not a bug.

Spaces in LINKFLAGS isn't a bug.

For example.. https://stackoverflow.com/questions/32468283/how-to-contain-
space-in-value-string-of-link-flag-when-using-go-build

This issue is best resolved in the SConstruct for this project.

Also note that the string specified violates the guidelines for LINKFLAGS
in the manpage.
LINKFLAGS

General user options passed to the linker. Note that this variable should
*not* contain -l (or similar) options for linking with the libraries listed
in $LIBS <http://scons.org/doc/production/HTML/scons-man.html#cv-LIBS>, nor
-L (or similar) library search path options that scons generates
automatically from $LIBPATH
<http://scons.org/doc/production/HTML/scons-man.html#cv-LIBPATH>. See
$_LIBFLAGS
<http://scons.org/doc/production/HTML/scons-man.html#cv-_LIBFLAGS> above,
for the variable that expands to library-link options, and$_LIBDIRFLAGS
<http://scons.org/doc/production/HTML/scons-man.html#cv-_LIBDIRFLAGS> above,
for the variable that expands to library search path options.
Post by Yuri
Post by Yuri
MAKE_ARGS+=... LINKFLAGS="${LINKFLAGS}"...
Code only has env.AppendUnique for some additional individual values,
like this: env.AppendUnique(LINKFLAGS=ldflag)
It doesn't explicitly accept the LINKFLAGS supplied as an argument.
Does it mean that arguments are automatically appended to env?
How do I split that value in this case?
I think, this is a bug in SCons.
LINKFLAGS with spaces, passed as an argument, need to be automatically
converted to array, not used as-is.
So you agree?
Yuri
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
Loading...