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

Je suis nouveau sur autom4te et j’essaie d’utiliser autoconf / automake pour créer et lier un programme C ++ sur plusieurs architectures. La liaison est compliquée par le fait que le projet nécessite un boost (système de fichiers, système, options_programme).

J’utilise boost.m4 (à partir de http://github.com/tsuna/boost.m4/tree/ ), et il semble que toutes les bibliothèques et tous les en-têtes soient localisés avec succès.

Malheureusement, la liaison échoue toujours, me laissant confus.

Voici 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 = phenomasortingx phenomasortingx_CXXFLAGS = $(BOOST_CPPFLAGS) phenomasortingx_LDFLAGS = $(BOOST_LDFLAGS) $(BOOST_SYSTEM_LDFLAGS) $(BOOST_FILESYSTEM_LDFLAGS) $(BOOST_PROGRAM_OPTIONS_LDFLAGS) # $(BOOST_SYSTEM_LIB) $(BOOST_PROGRAM_OPTIONS_LIB) $(BOOST_FILESYSTEM_LIB) phenomasortingx_LIBS = $(BOOST_SYSTEM_LIBS) $(BOOST_FILESYSTEM_LIBS) $(BOOST_PROGRAM_OPTIONS_LIBS) phenomasortingx_SOURCES = adjacency_list.cpp distance.cpp genephene.cpp knearest.cpp marshall.cpp oracle.cpp type_shield.cpp avgmindist.cpp euclidean.cpp hypergeomesortingc.cpp main.cpp mindist.cpp partialbayes.cpp utilities.cpp 

Celles-ci ne génèrent aucune erreur et parviennent 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 ensuite, quand je lance make , j’obtiens des erreurs:

 libtool: link: g++ -g -O2 -o phenomasortingx phenomasortingx-adjacency_list.o phenomasortingx-distance.o phenomasortingx-genephene.o phenomasortingx-knearest.o phenomasortingx-marshall.o phenomasortingx-oracle.o phenomasortingx-type_shield.o phenomasortingx-avgmindist.o phenomasortingx-euclidean.o phenomasortingx-hypergeomesortingc.o phenomasortingx-main.o phenomasortingx-mindist.o phenomasortingx-partialbayes.o phenomasortingx-utilities.o -L/usr/local/lib -Wl,-rpath -Wl,/usr/local/lib phenomasortingx-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ètent ad nauseum.

Je ne sais même pas comment procéder pour tester si cela inclut les bons répertoires. Oui, je comprends qu’il existe un indicateur -t sur g ++, mais je ne sais pas exactement comment le passer (depuis autom4te).

Je suppose que cela a quelque chose à voir avec plusieurs versions des librairies boost et des en-têtes sur la même machine, et je ne peux rien faire à ce sujet.

Il ne comstack pas car la bibliothèque n’est pas correctement définie … Le script ne configure pas correctement l’option -lboost_libraryname .

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

Le script ax_boost _ ***. M4 du référentiel suivant a bien fonctionné avec moi:

Ce n’est pas une réponse à votre question, mais avez-vous envisagé de passer de la chaîne d’outils GNU à cmake ? Je l’avais déjà fait et je sais maintenant très bien que je n’utiliserai plus jamais cet autohell.