building bio++ on Mavericks

66 views
Skip to first unread message

gsw...@g.uky.edu

unread,
Apr 1, 2014, 10:35:01 PM4/1/14
to biopp-de...@googlegroups.com
Hello,
I'm trying to build bio++ from source under OSX Mavericks using the instructions from the wiki. I've cloned the git repositories and successfully run cmake to obtain my Makefile, however when I actually try to run make I start running into problems:

$ make
-- Configuring done
-- Generating done
-- Build files have been written to: src/bpp/bpp-core
Scanning dependencies of target bppcore-shared
[ 0%] Building CXX object src/CMakeFiles/bppcore-shared.dir/Bpp/Exceptions.cpp.o
In file included from src/bpp/bpp-core/src/Bpp/Exceptions.cpp:42:
src/bpp/bpp-core/src/Bpp/Exceptions.h:60:17: error: implicit
instantiation of undefined template 'std::__1::basic_string<char,
std::__1::char_traits<char>, std::__1::allocator<char> >'
std::string message_;
            ^

I was able to get past this error by adding an #include <string> to Exceptions.cpp. After that fix I was able to finish compiling bpp-core and got it to install. However, when I moved onto bpp-seq I started running into even more issues during the compilation, this time with the linker complaining about undefined symbols.

I must admit that I haven't built many things using cmake before, so I'm not sure if this is my problem or not. Any ideas would be greatly appreciated. 

Thanks
Grady


Julien Yann Dutheil

unread,
Apr 2, 2014, 8:17:14 AM4/2/14
to Bio++ Development Forum
Dear Grady,

Can you please mention which tool you are using to compile Bio++ (gcc or sthg else?) and the version of the compiler.
As for CMake, it is important to specify where the libs have been installed, for instance:
cmake -DCMAKE_INSTALL_PREFIX=$HOME/.local
using the same location for all libraries.
We would also need the error msg from bpp-seq (at least the first ones).

Best,

Julien.


--
You received this message because you are subscribed to the Google Groups "Bio++ Development Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to biopp-devel-fo...@googlegroups.com.
To post to this group, send email to biopp-de...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/biopp-devel-forum/279e9825-0960-42e0-ac7b-d5d2be7393d0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Julien Y. Dutheil, Ph-D
0 (+49) 6421 178 986

§ Max Planck Institute for Terrestrial Microbiology
Department of Organismic Interactions
Marburg -- GERMANY

§ Intitute of Evolutionary Sciences - Montpellier
University of Montpellier 2 -- FRANCE

gsw...@g.uky.edu

unread,
Apr 2, 2014, 2:43:05 PM4/2/14
to biopp-de...@googlegroups.com
Hi Julien,
I am using the default setup with Mavericks, which uses clang as the compiler.


g++ --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 5.1 (clang-503.0.38) (based on LLVM 3.4svn)
Target: x86_64-apple-darwin13.1.0
Thread model: posix

I begin by building bpp-core. I followed the procedure described in the "Development Version" section of http://biopp.univ-montp2.fr/wiki/index.php/Installation I used the following call to cmake (after setting up $bpp_dir)

cmake -DCMAKE_INSTALL_PREFIX=$bpp_dir -DCMAKE_LIBRARY_PATH=$bpp_dir/lib -DCMAKE_INCLUDE_PATH=$bpp_dir/include -DBUILD_TESTING=FALSE .


This runs OK, but when I run make I get the error given previously, so something is already going wrong.

I was able to continue compiling and by including <string> in Exceptions.bpp. I'm not at all confident that this is the best fix, but it did get it to compile.

I then did a make install and moved on to bpp-seq. Same cmake invocation goes OK and finds the core files fine. When I run make the linker errors out with:

Linking CXX shared library libbpp-seq.dylib

Undefined symbols for architecture x86_64:

  "bpp::LetterAlphabet::LETTER_UNDEF_VALUE", referenced from:

      bpp::DefaultAlphabet::DefaultAlphabet() in DefaultAlphabet.cpp.o

      bpp::CaseMaskedAlphabet::CaseMaskedAlphabet(bpp::LetterAlphabet const*) in CaseMaskedAlphabet.cpp.o

      bpp::NucleicAlphabet::NucleicAlphabet() in DNA.cpp.o

      bpp::ProteicAlphabet::ProteicAlphabet() in ProteicAlphabet.cpp.o

      bpp::NucleicAlphabet::NucleicAlphabet() in RNA.cpp.o

ld: symbol(s) not found for architecture x86_64

clang: error: linker command failed with exit code 1 (use -v to see invocation)

gsw...@g.uky.edu

unread,
Apr 3, 2014, 1:28:07 AM4/3/14
to biopp-de...@googlegroups.com
I believe that I may have found the real problem: some sort of compatibility issue between libc++ and libstdc++. 

I added -stdlib=libstdc++ to CMAKE_CXX_FLAGS in both bpp-core/src and bpp-seq/src and things seem to be working now.

gsw...@g.uky.edu

unread,
Apr 3, 2014, 2:17:44 AM4/3/14
to biopp-de...@googlegroups.com
I seem to have been able to convince bppsuite+dependencies to build under clang.

I had to change all the relevant CMakeLists files to the following:
SET(CMAKE_CXX_FLAGS "-Wall -Weffc++ -Wshadow -Wconversion -stdlib=libstdc++")

This let me make install everything succesfully. I ended up with bin/ lib/ include/ in my $bpp_dir, which seem to be properly populated. 

However when I tried to run any of the executables in bin/ I now get the following (for example)
dyld: Library not loaded: libbpp-phyl.9.dylib
Referenced from: ./bppseqgen
Reason: image not found
Trace/BPT trap: 5

In order to get the executables to run, I had to create simlinks in bin/ to the files in lib/
This seems highly hacky, but it does work.

I haven't tried anything more exotic than getting the programs to print out their welcome messages, but at least I have some binaries now.

Julien Yann Dutheil

unread,
Apr 3, 2014, 3:24:39 AM4/3/14
to Bio++ Development Forum
Dear Grady,

Thanks a lot for the libstdc++ trick, this will certainly be useful to other users!
As for the execution issue, you can set the environment variable
DYLIB_LIBRARY_PATH=$bpp_dir/lib
this should work (instead of making links in the bin dir).

Best regards,

Julien.


--
You received this message because you are subscribed to the Google Groups "Bio++ Development Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to biopp-devel-fo...@googlegroups.com.
To post to this group, send email to biopp-de...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

gsw...@g.uky.edu

unread,
Apr 3, 2014, 12:19:30 PM4/3/14
to biopp-de...@googlegroups.com
Thanks Julien,

I'll give the path variable a try later.

Is there an easy way to get CMake to build the binaries with static linkage?

Julien Yann Dutheil

unread,
Apr 3, 2014, 4:25:54 PM4/3/14
to Bio++ Development Forum
Hi,

You can enable the BUILD_STATIC  (either using the cmake interface, or passing -DBUILD_STATIC=ON ).

Best,

Julien.



For more options, visit https://groups.google.com/d/optout.

gsw...@g.uky.edu

unread,
Apr 4, 2014, 4:57:01 AM4/4/14
to biopp-de...@googlegroups.com
I spent a bit more time this evening looking into the cause of the error in compiling bpp-seq that I ran into and this seems to be a minimal example of the problematic code.

#include <vector>
class Foo{
  static const int bar = -99;
public:
  std::vector<int> bazv;
  Foo():bazv(10,bar) {}
};
int main(){
  Foo f;
  return 0;
}

This code will compile with libstdc++, but fails with libc++, with an error similar to the one I described previously. Interestingly, if you change the constructor to 

Foo():bazv(bar) {}

Then it will compile under either library (although it gives a runtime error due to the -99).

gsw...@g.uky.edu

unread,
Apr 4, 2014, 1:59:39 PM4/4/14
to biopp-de...@googlegroups.com
I managed to confound several colleagues with this, but one of them was eventually able to put me on the right path. Apparently, the definition of static members should be moved out-of-class, rather than specified in the declaration.

So, LetterAlphabet.h gets modified to contain
      static const int LETTER_UNDEF_VALUE;
And I created a new file LetterAlphabet.cpp with
const int bpp::LetterAlphabet::LETTER_UNDEF_VALUE = -99;

Now It looks like I can build everything completely natively.
--
Grady

Julien Yann Dutheil

unread,
Apr 5, 2014, 4:53:51 PM4/5/14
to Bio++ Development Forum
Dear Grady,

That is absolutely correct, and I am very surprised we had that mistake in the libs... compiler should have complained about that!
I have included a fix (the one you found yourself). It will be part of the next release.

Many thanks!

Julien.



For more options, visit https://groups.google.com/d/optout.

gsw...@g.uky.edu

unread,
Apr 7, 2014, 2:27:08 PM4/7/14
to biopp-de...@googlegroups.com
Hi Julien,

Great! Don't forget that I also had to include <string> in one of the bpp-core files, as I mentioned previously.

If you would like me to test anything else on Mavericks before the next release feel free to send me an email.
--
Grady Weyenberg
Department of Statistics
University of Kentucky, USA

Mathieu Groussin

unread,
Apr 28, 2014, 3:20:21 PM4/28/14
to biopp-de...@googlegroups.com
Dear Julien, Grady and all,

I have similar problems when compiling bpp-core on a mac os Mavericks... After reading this discussion, I did find a solution to my problems...
I first got the first error that Grady obtained. Indeed, I solved the issue by including #include <string> in Exceptions.cpp. But contrary to Grady, it seems that this problem concerns a lot of classes. The next problematic class is with BppApplications.cpp and then, after including #include <string> in BppApplications.cpp, it goes on with BppODiscreteDistributionFormat.cpp etc...
Additionally, I got a very long list of warnings... I attached to this email an exemple of errors (with BppApplications.cpp) and warnings I've just obtained.

I downloaded the dev libraries today with git, the g++ version is 4.2.1, the cmake version is 2.8.12.2.

If you have any ideas, I'd really appreciate (warnings and errors...)!

Thanks,
Mathieu
compilationWarningsAndErrors.txt

Julien Yann Dutheil

unread,
Apr 29, 2014, 7:52:06 AM4/29/14
to Bio++ Development Forum
Hi Mathieu,

Thanks a lot, will give it a look.

J.



For more options, visit https://groups.google.com/d/optout.

Julien Yann Dutheil

unread,
Apr 29, 2014, 3:26:59 PM4/29/14
to Bio++ Development Forum
Matthieu,

I fixed the first warnings (I hope). Can you give it a try and send me the new list of warnings (privately) ?

Cheers,

J.


On Mon, Apr 28, 2014 at 9:20 PM, Mathieu Groussin <mgro...@gmail.com> wrote:

For more options, visit https://groups.google.com/d/optout.

Julien Yann Dutheil

unread,
May 16, 2014, 3:55:01 AM5/16/14
to Bio++ Development Forum
Ok, done pour bpp-core, et c'est parti pour un premier jet sur bpp-seq...

J.


On Mon, Apr 28, 2014 at 9:20 PM, Mathieu Groussin <mgro...@gmail.com> wrote:

For more options, visit https://groups.google.com/d/optout.

Julien Yann Dutheil

unread,
May 16, 2014, 5:27:27 AM5/16/14
to biopp-de...@googlegroups.com
Oups, my mistake, stroke the wrong reply button :D We're still removing those Maverick warnings...

J.
Reply all
Reply to author
Forward
0 new messages