[Scons-users] SCons always uses relative path even when absolute path is set with LIBPATH
Bill Deegan
bill at baddogconsulting.com
Sun May 27 13:57:30 EDT 2018
What's the proper flag to specify RPATH?
On Fri, May 25, 2018 at 12:52 PM, Mats Wichmann <mats at wichmann.us> wrote:
> On 05/25/2018 12:08 PM, Matthew Bernard wrote:
> > That's right. in the sconscript I assign a build directory variable to
> be:
> > common_build_dir = '/Users/..../sConstructDir/build/common'
> >
> > and then in the sharedlibrary call my code is
> >
> > tpr_lib = env.SharedLibrary(target = 'dynamic_lib',
> > source = srcs,
> > LIBS = 'common',
> > LIBPATH= common_build_dir,
> > RPATH = common_build_dir
> > )
> >
> > so that during the linker stage I would expect to see
> >
> > gfortran -o build/dynamic_lib/libdynamic_lib.dylib -dynamiclib [object
> > files] -L/Users/..../sConstruct/build/common -lcommon
> >
> > but during the linker stage in the build-cmds output it is reported as
> >
> > gfortran -o build/dynamic_lib/libdynamic_lib.dylib -dynamiclib [object
> > files] -Lbuild/common -lcommon
>
> Having trouble understanding what the problem is... why do you want to
> put an rpath into the library in the first place? that means you're
> hardcoding a place the dynamic linker will look for the library's own
> library dependencies - at runtime. If you made that the same as your
> build location, that means the final binary will always need that build
> area to be present, or the libraries won't be found. Unlikely to be
> right for production. This is nothing to do with scons, and nothing to
> do with whether the rpath is relative or absolute, although arguably the
> problem is more complex if it's relative. If you use an rpath, it
> should point to the place where the libraries are going to be
> /installed/, not where they're built. This has nothing to do with
> finding the dependent libraries at link time - when you do your second
> link in the project using Make. That link has to have -L instructions
> to point to where to find those libraries for linking purposes.
>
> I know the Mac has funky extra stuff, look up @executable_path. Not a
> Mac user so don't know what's going on with that. Otherwise, instead of
> rpath you can use LD_LIBRARY_PATH (with caution) on linux,
> DYLD_LIBRARY_PATH and DYLD_FALLBACK_LIBRARY_PATH on Mac.
>
>
>
> _______________________________________________
> Scons-users mailing list
> Scons-users at scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20180527/67bbcec3/attachment.html>
More information about the Scons-users
mailing list