Comment puis-je résoudre l'inclusion bibliothèque / d'en-tête de boost via autoconf / automake?

StackOverflow https://stackoverflow.com/questions/2270073

Question

Je suis nouveau à autom4te, et je suis en train d'utiliser autoconf / automake pour construire et lier un programme C ++ sur plusieurs architectures. Pour compliquer la mise en relation est le fait que le projet nécessite Boost (système de fichiers, système, program_options).

J'utilise boost.m4 (de http://github.com/tsuna /boost.m4/tree/ ), et il semble trouver toutes les bibliothèques et les en-têtes avec succès.

Malheureusement, lien ne fonctionne toujours pas, me laissant confus.

Ce sont les lignes pertinentes de configure.ac:

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

Et dans 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

Ceux-ci donnent aucune erreur, et il arrive même à trouver les bibliothèques et les en-têtes:

checking for Boost headers version >= 104100... yes
checking for Boost's 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

Mais alors, quand je lance make, je reçois des erreurs:

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()'

qui répète ad nauseam.

Je ne suis même pas sûr de savoir comment aller sur le test pour voir si elle est y compris les bons répertoires. Oui, je comprends qu'il ya un drapeau -t sur g ++, mais je ne sais pas exactement comment passer que (à l'intérieur autom4te).

Je réunirai cela a quelque chose à voir avec plusieurs versions des libs boost et en-têtes sur la même machine, et il n'y a pas grand-chose que je peux faire à ce sujet.

Était-ce utile?

La solution

Il ne compile pas parce que la bibliothèque ne sont pas correctement réglée ... Le script ne configure pas correctement le -lboost_libraryname .

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

Le ax_boost _ *** script m4 dans le référentiel suivant a bien fonctionné avec moi:

Autres conseils

Pas une réponse à votre question, mais avez-vous envisagé de passer de la GNU toolchain CMake ? Je l'ai fait un peu de temps avant et maintenant je sais parfaitement bien que je ne serai jamais en utilisant cette autohell à nouveau.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top