How to fix the problem of enabling library / header formatting with autoconf / automake?

I'm new to autom4te, and I'm trying to use autoconf / automake to create and reference a C ++ program on multiple architectures. A complication of linking is the fact that the project requires enhancement (file system, system, program_options).

I am using boost.m4 (from http://github.com/tsuna/boost.m4/tree/ ) and it seems to successfully find all libraries and headers.

Unfortunately, the connection still failed, leaving me confused.

These are the corresponding configure.ac lines:

 AC_CONFIG_MACRO_DIR([m4]) # ... AC_PROG_CXX AC_PROG_LIBTOOL # ... BOOST_REQUIRE([1.41.0]) BOOST_FILESYSTEM BOOST_SYSTEM BOOST_PROGRAM_OPTIONS # ... 

And in src/Makefile.am :

 bin_PROGRAMS = phenomatrix phenomatrix_CXXFLAGS = $(BOOST_CPPFLAGS) phenomatrix_LDFLAGS = $(BOOST_LDFLAGS) $(BOOST_SYSTEM_LDFLAGS) $(BOOST_FILESYSTEM_LDFLAGS) $(BOOST_PROGRAM_OPTIONS_LDFLAGS) # $(BOOST_SYSTEM_LIB) $(BOOST_PROGRAM_OPTIONS_LIB) $(BOOST_FILESYSTEM_LIB) phenomatrix_LIBS = $(BOOST_SYSTEM_LIBS) $(BOOST_FILESYSTEM_LIBS) $(BOOST_PROGRAM_OPTIONS_LIBS) phenomatrix_SOURCES = adjacency_list.cpp distance.cpp genephene.cpp knearest.cpp marshall.cpp oracle.cpp type_shield.cpp avgmindist.cpp euclidean.cpp hypergeometric.cpp main.cpp mindist.cpp partialbayes.cpp utilities.cpp 

They give no errors, and even manage to find libraries and headers:

 checking for Boost headers version >= 104100... yes checking for Boost header version... 1_41 checking for the toolset name used by Boost for g++... gcc44 -gcc checking boost/system/error_code.hpp usability... yes checking boost/system/error_code.hpp presence... yes checking for boost/system/error_code.hpp... yes checking for the Boost system library... yes checking boost/filesystem/path.hpp usability... yes checking boost/filesystem/path.hpp presence... yes checking for boost/filesystem/path.hpp... yes checking for the Boost filesystem library... yes checking for boost/system/error_code.hpp... (cached) yes checking for the Boost system library... (cached) yes checking boost/program_options.hpp usability... yes checking boost/program_options.hpp presence... yes checking for boost/program_options.hpp... yes checking for the Boost program_options library... yes 

But then when I run make , I get errors:

 libtool: link: g++ -g -O2 -o phenomatrix phenomatrix-adjacency_list.o phenomatrix-distance.o phenomatrix-genephene.o phenomatrix-knearest.o phenomatrix-marshall.o phenomatrix-oracle.o phenomatrix-type_shield.o phenomatrix-avgmindist.o phenomatrix-euclidean.o phenomatrix-hypergeometric.o phenomatrix-main.o phenomatrix-mindist.o phenomatrix-partialbayes.o phenomatrix-utilities.o -L/usr/local/lib -Wl,-rpath -Wl,/usr/local/lib phenomatrix-adjacency_list.o: In function `__static_initialization_and_destruction_0': /usr/local/include/boost/system/error_code.hpp:208: undefined reference to `boost::system::get_system_category()' /usr/local/include/boost/system/error_code.hpp:209: undefined reference to `boost::system::get_generic_category()' /usr/local/include/boost/system/error_code.hpp:214: undefined reference to `boost::system::get_generic_category()' /usr/local/include/boost/system/error_code.hpp:215: undefined reference to `boost::system::get_generic_category()' /usr/local/include/boost/system/error_code.hpp:216: undefined reference to `boost::system::get_system_category()' 

that repeat the ad.

I don’t even know how to get tested to see if it includes the correct directories. Yes, I understand that in g ++ there is the -t flag, but I don’t know exactly how to pass this (from inside autom4te).

I understand that this has to do with several versions of accelerating libraries and headers on the same machine, and I can't help it.

+2
c ++ boost linker autoconf automake
Feb 16 '10 at 1:22
source share
2 answers

It does not compile because the library is not configured correctly ... the script did not correctly configure the -lboost_libraryname parameter.

 $(BOOST_PROGRAM_OPTIONS_LIB) -> $(BOOST_PROGRAM_OPTIONS_LIBS) in tyour makefil.am your_program_LDFLAGS 

Ax_boost _ ***. The m4 script in the following repository worked fine with me:

+3
Feb 16 '10 at 9:08
source share

Not the answer to your question, but did you decide to switch from the GNU toolchain to cmake ? I did this a while ago, and now I know very well that I will never use this auto-mask again.

+2
Feb 16 '10 at 8:45
source share



All Articles