How to deal with this error when build with Scons?

筅森魡賤 提交于 2019-12-13 05:16:30

问题


/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: error adding symbols: DSO missing from command line

SConstruct file

I'm trying to build this project https://github.com/TTimo/es_core, and don't have enought expirience with scons


回答1:


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', ] )

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

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

As with the LIBS, you dont need to add the -L flag to LIBPATH, as SCons will add it.

Here is a complete list of the SCons Construction Variables.



来源:https://stackoverflow.com/questions/26700320/how-to-deal-with-this-error-when-build-with-scons

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!