我正在尝试构建一个我下载的应用程序,它使用SCONS“make置换”和Fast。
用于检测fltk存在的SConstruct代码是:
guienv = Environment(CPPFLAGS = '')
guiconf = Configure(guienv)
if not guiconf.CheckLibWithHeader('lo', 'lo/lo.h','c'):
print 'Did not find liblo for OSC, exiting!'
Exit(1)
if not guiconf.CheckLibWithHeader('fltk', 'FL/Fl.H','c++'):
print 'Did not find FLTK for the gui, exiting!'
Exit(1)不幸的是,在我的(Gentoo Linux)系统和许多其他(Linux发行版)上,如果包管理器允许同时安装FLTK-1和FLTK-2,这可能会非常麻烦。
我试图修改SConstruct文件以使用fltk-config --cflags和fltk-config --ldflags (或者fltk-config --libs可能比ldflags更好),方法是这样添加它们:
guienv.Append(CPPPATH = os.popen('fltk-config --cflags').read())
guienv.Append(LIBPATH = os.popen('fltk-config --ldflags').read())但这会导致对liblo的测试失败!查看config.log显示了它是如何失败的:
scons: Configure: Checking for C library lo...
gcc -o .sconf_temp/conftest_4.o -c "-I/usr/include/fltk-1.1 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_THREAD_SAFE -D_REENTRANT"
gcc: no input files
scons: Configure: no如何才能真正做到呢?
为了完成我的回答,我如何从os.popen( 'command').read()的结果中删除引号
编辑这里真正的问题是为什么附加fltk-config的输出会导致gcc没有收到它应该编译的文件名参数?
发布于 2010-06-04 18:16:30
有两种类似的方法: 1)
conf = Configure(env)
status, _ = conf.TryAction("fltk-config --cflags")
if status:
env.ParseConfig("fltk-config --cflags")
else:
print "Failed fltk"2)
try:
env.ParseConfig("fltk-config --cflags")
except (OSError):
print 'failed to run fltk-config you sure fltk is installed !?'
sys.exit(1)https://stackoverflow.com/questions/2945877
复制相似问题