dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #20135
Re: libboost_program_options is not included during linking process
On Thu, Nov 11, 2010 at 8:32 PM, Johannes Ring <johannr@xxxxxxxxx> wrote:
> On Thu, Nov 11, 2010 at 6:47 PM, Andre Massing <massing@xxxxxxxxx> wrote:
>> Den 11.11.10 18.34, skrev Andre Massing:
>>>
>>> Den 11.11.10 17.23, skrev Johannes Ring:
>>>>
>>>> On Thu, Nov 11, 2010 at 3:35 PM, Andre Massing<massing@xxxxxxxxx> wrote:
>>>>>
>>>>> Den 11.11.10 15.23, skrev Johannes Ring:
>>>>>>
>>>>>> On Thu, Nov 11, 2010 at 3:14 PM, Andre Massing<massing@xxxxxxxxx>
>>>>>> wrote:
>>>>>>>
>>>>>>> Den 11.11.10 15.04, skrev Johannes Ring:
>>>>>>>>
>>>>>>>> On Thu, Nov 11, 2010 at 2:58 PM, Andre Massing<massing@xxxxxxxxx>
>>>>>>>> wrote:
>>>>>>>>>
>>>>>>>>> Hi!
>>>>>>>>>
>>>>>>>>> I just encountered another strange error during compilation of the
>>>>>>>>> latest
>>>>>>>>> dolfin development
>>>>>>>>> version on a Mac OS X platform. I got the error
>>>>>>>>>
>>>>>>>>> Linking CXX shared library libdolfin.dylib
>>>>>>>>> [..]
>>>>>>>>> Undefined symbols:
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> "boost::program_options::validation_error::validation_error(boost::program_options::validation_error::kind_t,
>>>>>>>>> std::basic_string<char, std::char_traits<char>, std::allocator<char>
>>>>>>>>> >
>>>>>>>>> const&, std::basic_string<char, std::char_traits<char>,
>>>>>>>>> std::allocator<char>
>>>>>>>>>>
>>>>>>>>>> const&)", referenced from:
>>>>>>>>>
>>>>>>>>> Switching VERBOSE=1 reveals that libboost_program_options was not
>>>>>>>>> included
>>>>>>>>> in the list of libs to link with.
>>>>>>>>> Any clue how to fix that?
>>>>>>>>
>>>>>>>> I had a similar problem a few days ago. I think it was after I did a
>>>>>>>> clean build of DOLFIN that the problem went away. Have you tried
>>>>>>>> that?
>>>>>>>>
>>>>>>>> Johannes
>>>>>>>
>>>>>>> Actually I started with a clean build in the first place :)
>>>>>>
>>>>>> Okay, could you attach your CMakeCache.txt file?
>>>>>>
>>>>> Attached.
>>>>
>>>> Thanks. It looks okay so I don't really know. You could try to specify
>>>> the Boost libraries manually, like this:
>>>>
>>>>
>>>> -DBoost_PROGRAM_OPTIONS_LIBRARY:FILEPATH=/opt/local/lib/libboost_program_options-mt.dylib
>>>>
>>>> Are you sure you have the latests DOLFIN? And does it work if you
>>>> revert back to revision 5236?
>>>
>>> I have tried both, and neither one helped. I am really stuck now, since I
>>> can not compile any of my dolfin libs :(
>>> I don't get it. At least find_package(BOOST) command in CMakeList find all
>>> the libs, the Boost_LIBRARIES contains also
>>> libboost_program_options, but somehow it goes lost on the way, e.g. in all
>>> the link.txt and build.make the entry is missing
>>> (it exists in a older installation). No clue what is going on... Has
>>> anybody else from the CMake experts an idea about what is going
>>> on??
>>>
>> I found something which is somehow related to the error. I had a recent
>> update which changed cmake from version cmake @2.8.2_2
>> to cmake @2.8.3_0. If I use the newer version, the cmake generated link.txt
>> and build.make files *does not* contain libboost_program_options,
>> if I switch back to 2.8.2_2 they do. Strange, no idea whether this is a bug
>> in cmake, macports.. and how to resolve it..
>
> Ah! Now I remember I tried CMake 2.8.3 on OS X earlier this week but
> went later back to 2.8.2. That's why the error I had (similar to
> yours) "magically" disappeared. I tried 2.8.3 on Ubuntu now and
> libboost_program_options was missing from the link.txt and build.txt
> files as in your case. The diff between FindBoost.cmake in CMake 2.8.2
> and in 2.8.3 is rather large so it is quite possible that the bug is
> in CMake. I will look closer at this tomorrow.
I found the problem. The culprit is in line 185 in
dolfin/CMakeLists.txt where duplicates are removed from
DOLFIN_TARGET_LINK_LIBRARIES. The new thing in CMake 2.8.3 is that
FindBoost.cmake seems to be more eager to set the Boost debug
libraries and DOLFIN_TARGET_LINK_LIBRARIES will then contain something
like this:
...;optimized;/tmp/local/lib/libboost_filesystem.so;debug;/tmp/local/lib/libboost_filesystem.so;optimized;/tmp/local/lib/libboost_program_options.so;debug;/tmp/local/lib/libboost_program_options.so;...
and after all duplicates are removed it will be reduced to this:
...;optimized;/tmp/local/lib/libboost_filesystem.so;debug;/tmp/local/lib/libboost_program_options.so;...
When doing a release build of DOLFIN the debug libraries will not be
used, in this case /tmp/local/lib/libboost_program_options.so and the
link stage will most likely fail.
I don't remember why we wanted to remove the duplicates in the first
place but I think we should stop doing it now. In fact, I just removed
it.
Johannes
References