2013-10-31 71 views
1

我想在我的主目錄下編譯GNU Source highlight爲什麼ld找不到lboost_regex?

我配置了一個前綴和--with-boost=/path/to/boost/root/dir/並且沒有錯誤報告。

但是當我嘗試建立我得到了以下錯誤:

$ make 
... # lots of output 
libtool: link: g++ -shared -nostdlib /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../lib64/crti.o /usr/lib/gcc/x86_64-redhat-linux/4.1.2/crtbeginS.o .libs/copyright.o .libs/reportbugs.o .libs/fileutil.o .libs/substfun.o .libs/stopwatch.o .libs/utils.o .libs/ioexception.o .libs/settings.o .libs/versions.o .libs/verbosity.o .libs/sourcehighlight.o .libs/styleparser.o .libs/stylescanner.o .libs/outlangdefparser.o .libs/stylecssparser.o .libs/stylecssscanner.o .libs/outlangdefscanner.o .libs/debuglistener.o .libs/langmap.o .libs/stylefileparser.o .libs/langelem.o .libs/statelangelem.o .libs/langelems.o .libs/statestartlangelem.o .libs/stringlistlangelem.o .libs/delimitedlangelem.o .libs/langelemsprinter.o .libs/namedsubexpslangelem.o .libs/stringdef.o .libs/highlightrule.o .libs/highlighttoken.o .libs/highlightstate.o .libs/highlightrulefactory.o .libs/highlightstateprinter.o .libs/sourcehighlighter.o .libs/sourcefilehighlighter.o .libs/linenumgenerator.o .libs/lineranges.o .libs/regexranges.o .libs/formatter.o .libs/formattermanager.o .libs/textstyle.o .libs/textstyleformatter.o .libs/bufferedoutput.o .libs/preformatter.o .libs/wordtokenizer.o .libs/ctagscollector.o .libs/readtags.o .libs/ctagsformatter.o .libs/srcuntabifier.o .libs/textstyleformatterfactory.o .libs/docgenerator.o .libs/doctemplate.o .libs/chartranslator.o .libs/textstylebuilder.o .libs/fileinfo.o .libs/ctagsmanager.o .libs/regexhighlightrule.o .libs/regexrulefactory.o .libs/regexpreprocessor.o .libs/highlightstatebuilder.o .libs/highlightbuilderexception.o .libs/langdefmanager.o .libs/langdefparser.o .libs/langdefscanner.o .libs/languageinfer.o .libs/parserexception.o .libs/stringtable.o .libs/vardefinitions.o .libs/sourcehighlightutils.o .libs/yywrap.o -Wl,--whole-archive ../../gl/.libs/libgnu.a -Wl,--no-whole-archive -lboost_regex -L/usr/lib/gcc/x86_64-redhat-linux/4.1.2 -L/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -lstdc++ -lm -lc -lgcc_s /usr/lib/gcc/x86_64-redhat-linux/4.1.2/crtendS.o /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../lib64/crtn.o -Wl,-soname -Wl,libsource-highlight.so.1 -o .libs/libsource-highlight.so.1.1.0 
/usr/bin/ld: cannot find -lboost_regex 
collect2: ld returned 1 exit status 

需要注意的是,我有升壓在我的環境中加載,其實:

$ echo $LD_LIBRARY_PATH 
/path/to/boost/root/dir/lib:/other/path/lib 

ls表明/path/to/boost/root/dir/lib/libboost_regex.so存在並且是到libboost_regex.so.1.47.0的符號鏈接

這怎麼可能?我該如何解決它?

+0

這是幫助嗎? - > http://www.gnu.org/software/src-highlite/source-highlight.html#Tips-on-installing-Boost-Regex-library –

回答

4

在鏈接時,用於定義找到庫的路徑的正確環境變量是LIBRARY_PATH,而不是LD_LIBRARY_PATH。前者相當於在gcc參數中指定-L,而後者則在運行時使用,如PATH,以查找二進制可執行文件。有關更多信息,請參閱this