使用Scons构建时如何处理此错误? [英] How to deal with this error when build with Scons?
问题描述
/usr/bin/ld:build/bsp_src/main.o:未定义的第一个引用符号«_ZN5boost6system15system_categoryEv»
/usr/bin/ld: build/bsp_src/main.o: Undefined first referenced symbol «_ZN5boost6system15system_categoryEv»
///usr/lib/i386-linux-gnu/libboost_system.so.1.54.0:添加符号时出错:命令行缺少DSO
//usr/lib/i386-linux-gnu/libboost_system.so.1.54.0: error adding symbols: DSO missing from command line
我正在尝试构建该项目 https://github.com/TTimo/es_core ,并没有足够的经验与骗局
I'm trying to build this project https://github.com/TTimo/es_core, and don't have enought expirience with scons
推荐答案
基于问题中引用的SConstruct
文件,您没有在boost_system库中正确链接.您正在执行以下操作:
Based on the SConstruct
file referenced in your question, you're not correctly linking in the boost_system library. You're doing it as follows:
env.Append( CCFLAGS = [ '-g', '-lboost_system', ] )
CCFLAGS
变量应用于将编译标志传递给编译器. -l
标志应传递给链接器,而不是编译器.在SCons中执行此操作的正确方法如下:
The CCFLAGS
variable should be used to pass compilation flags to the Compiler. The -l
flag should be passed to the Linker, not the Compiler. The correct way to do that in SCons is as follows:
env.Append( LIBS = ['boost_system'] )
注意,我没有添加-l
标志,因为SCons
以与平台无关的方式为您完成了此操作.
Notice, I dont add the -l
flag, as SCons
does that for you in a platform-independent manner.
您可能还必须定义库的路径,如下所示:
You may also have to define the path to the library, which is done as follows:
env.Append( LIBPATH = '/put/the/path/here' )
与LIBS
一样,您无需将-L
标志添加到LIBPATH
,因为SCons
会添加它.
As with the LIBS
, you dont need to add the -L
flag to LIBPATH
, as SCons
will add it.
以下是 SCons构造变量的完整列表.
这篇关于使用Scons构建时如何处理此错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!