[Scons-users] OSX Library link names include undesired prefix

Rob Boehne robb at datalogics.com
Mon Aug 7 13:01:28 EDT 2017


$ORIGIN is not a Mac OS X construct.  It¹s recognized by linkers on many
*NIX platforms, but not OS X.
To my knowledge, this isn¹t an SCons thing either, so what I use is
something like this:

    env.Append(SHLINKFLAGS='-Xlinker -rpath -Xlinker @loader_path/.¹)

which is roughly equivalent to this under Linux:

    env.Append(SHLINKFLAGS=['-Wl,-rpath,\\$$ORIGIN'])

Hope this helps.



Rob Boehne 
Senior Software Architect | Datalogics, Inc.
+1.312.853.8351 <tel:3128538399> | robb at datalogics.com
datalogics.com <https://www.datalogics.com/> |
<https://blogs.datalogics.com/>blogs.datalogics.com
<https://blogs.datalogics.com/>Connect with us: Facebook
<https://www.facebook.com/DatalogicsInc> | Twitter
<https://twitter.com/DatalogicsInc> | YouTube
<https://www.youtube.com/user/Datalogics>

PROUDLY CELEBRATING 50 YEARS!
<https://www.datalogics.com/datalogics-celebrates-50-years-of-embracing-cha
nge-and-providing-high-quality-software>






On 8/6/17, 2:55 PM, "Scons-users on behalf of edA-qa mort-ora-y"
<scons-users-bounces at scons.org on behalf of eda-qa at disemia.com> wrote:

>After having getting my shared libraries working on Linux I'm trying now
>on OSX. The approach provided before does not do the correct thing on
>OSX. For example, instead of linking to `libleaf_util.dylib`, it links
>to `build/libleaf_util.dylib`.
>
>Library created as:
>
>    lib_util_name = 'leaf_util'
>    lib_util = env.SharedLibrary( lib_util_name, [
>        'util/dump_base.cpp',
>        'util/file.cpp',
>        'util/number.cpp',
>        'util/object_holder.cpp',
>        'util/unicode.cpp',
>        ] )
>
>Then used as:
>
>leaf = env.Program( 'leaf', [
>    'bin/leaf.cpp',
>    'bin/test_expecter.cpp',
>    ],
>    LIBS = env['LIBS'] + [ lib_lang_name, lib_parser_name,
>lib_util_name, lib_ir_name, lib_ir_llvm_name, lib_runner_name ],
>    )
>
>
>Running `otool -L build/leaf` gives me:
>
>    build/libleaf_util.dylib (compatibility version 0.0.0, current
>version 0.0.0)
>
>
>Using the `otool -l` option also doesn't list any RPATH, though I have
>this configured:
>
>    env['RPATH'] = Literal('\\$$ORIGIN')
>
>
>Full SConscript file:
>https://gist.github.com/mortoray/0eff2a9a066ad48a6aedab8766503865
>Full wrapping SConstruct:
>https://gist.github.com/mortoray/0c7485fa04afb8f4db099132e7b1e723
>
>-- 
>edA-qa mort-ora-y 
>http://mortoray.com/
>
>Leaf - the language we always wanted
>http://leaflang.org/
>
>
>_______________________________________________
>Scons-users mailing list
>Scons-users at scons.org
>https://pairlist4.pair.net/mailman/listinfo/scons-users



More information about the Scons-users mailing list