[ 
https://issues.apache.org/jira/browse/THRIFT-2906?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14253600#comment-14253600
 ] 

ASF GitHub Bot commented on THRIFT-2906:
----------------------------------------

GitHub user jparise opened a pull request:

    https://github.com/apache/thrift/pull/333

    Directly link libboost_unit_test_framework.a.

    Not all linkers support the `-l:libfoo.a` syntax (notably ld(1) on Mac
    OS X).  For full compatibility, we want to link directly against the
    static library using its full path.
    
    (We can't link the dynamic version of this library because of the way
    that the `_main()` symbol is defined and used by the Thrift unit tests.)
    
    Unfortunately, AX_BOOST_BASE doesn't expose the selected library path
    as a variable, so we derive BOOST_LIB_DIR from BOOST_LDPATH instead.
    That variable is defined conditionally on C++ and Boost support.
    
    Lastly, I looked at the GNU AX_BOOST_UNIT_TEST_FRAMEWORK macro.  It
    unfortunately prefers the dynamic library over the static one (see
    above), so it's not suitable for our use case.  That macro could be
    extended to take an argument (e.g. 'static') which would force the use
    of the static library, but that felt unnecessary here.
    
    Fixes [THRIFT-2906](https://issues.apache.org/jira/browse/THRIFT-2906)

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/jparise/thrift thrift-2906

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/thrift/pull/333.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #333
    
----
commit 76577ed0189a628275246552e60ebbceb3c2cf4a
Author: Jon Parise <[email protected]>
Date:   2014-12-19T01:51:46Z

    Directly link libboost_unit_test_framework.a.
    
    Not all linkers support the `-l:libfoo.a` syntax (notably ld(1) on Mac
    OS X).  For full compatibility, we want to link directly against the
    static library using its full path.
    
    (We can't link the dynamic version of this library because of the way
    that the _main() symbol is defined and used by the Thrift unit tests.)
    
    Unfortunately, AX_BOOST_BASE doesn't expose the selected library path
    as a variable, so we derive BOOST_LIB_DIR from BOOST_LDPATH instead.
    That variable is defined conditionally on C++ and Boost support.
    
    Lastly, I looked at the GNU AX_BOOST_UNIT_TEST_FRAMEWORK macro.  It
    unfortunately prefers the dynamic library over the static one (see
    above), so it's not suitable for our use case.  That macro could be
    extended to take an argument (e.g. 'static') which would force the use
    of the static library, but that felt unnecessary here.
    
    Fixes THRIFT-2906

----


> library not found for -l:libboost_unit_test_framework.a
> -------------------------------------------------------
>
>                 Key: THRIFT-2906
>                 URL: https://issues.apache.org/jira/browse/THRIFT-2906
>             Project: Thrift
>          Issue Type: Bug
>          Components: Build Process, C++ - Compiler
>    Affects Versions: 0.9.2
>         Environment: Mac OS X 10.10.1 (Darwin 14.0.0)
> Apple LLVM version 6.0 (clang-600.0.54) (based on LLVM 3.5svn)
> Target: x86_64-apple-darwin14.0.0
> Thread model: posix
>            Reporter: Jon Parise
>            Priority: Minor
>              Labels: build, patch
>
> The {{ld(1)}} (clang) that ships with Mac OS X 10.10.1 doesn't understand the 
> {{-l:libfoo.a}} syntax that it used to link 
> {{libboost_unit_test_framework.a}}:
> {code}
> /bin/sh ../../../libtool  --tag=CXX   --mode=link g++ -Wall -Wextra -pedantic 
> -g -O2 -std=c++11 -L/usr/local/lib  -o processor_test 
> processor/ProcessorTest.o processor/EventLog.o processor/ServerThread.o 
> libprocessortest.la ../../../lib/cpp/libthrift.la 
> ../../../lib/cpp/libthriftnb.la -L/usr/local/lib -levent 
> -l:libboost_unit_test_framework.a -lssl -lcrypto -lpthread
> libtool: link: g++ -Wall -Wextra -pedantic -g -O2 -std=c++11 -o 
> .libs/processor_test processor/ProcessorTest.o processor/EventLog.o 
> processor/ServerThread.o -Wl,-bind_at_load  -L/usr/local/lib 
> ./.libs/libprocessortest.a ../../../lib/cpp/.libs/libthrift.dylib 
> -L/usr/local/Cellar/openssl/1.0.1j_1/lib 
> ../../../lib/cpp/.libs/libthriftnb.dylib -levent 
> -l:libboost_unit_test_framework.a -lssl -lcrypto -lpthread
> ld: library not found for -l:libboost_unit_test_framework.a
> clang: error: linker command failed with exit code 1 (use -v to see 
> invocation)
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to