SCONS:LD找不到标准库
我正在与Raylib一起使用SCONS进行建筑。我正在使用clang将编译从Ubuntu(In WSL)交叉到Windows。我的项目目录包含带有raylib二进制文件的lib
目录,include
与Raylib标头的目录。当我运行SCONS时,我将获得此输出:
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
clang++ -o main.o -c -mwindows --target=x86_64-w64-windows-gnu -static -static-libgcc -static-libstdc++ -Iinclude main.cpp
clang: warning: argument unused during compilation: '-mwindows' [-Wunused-command-line-argument]
clang: warning: argument unused during compilation: '-static-libgcc' [-Wunused-command-line-argument]
clang: warning: argument unused during compilation: '-static-libstdc++' [-Wunused-command-line-argument]
clang++ -o tiled_test.exe main.o -Llib -lraylib -lopengl32 -lgdi32 -lwinmm
/bin/ld: cannot find -lopengl32
/bin/ld: cannot find -lgdi32
/bin/ld: cannot find -lwinmm
clang: error: linker command failed with exit code 1 (use -v to see invocation)
scons: *** [tiled_test.exe] Error 1
scons: building terminated because of errors.
ld
找不到OpenGL32
,gli32
和winmm
。
我的sconstruct文件:
import os
LIBS=['raylib', 'opengl32', 'gdi32', 'winmm']
LIBPATH='./lib'
CCFLAGS='-mwindows --target=x86_64-w64-windows-gnu -static -static-libgcc -static-libstdc++'
env = Environment(CXX='clang++', CPPPATH='./include')
env['ENV']['TERM'] = os.environ['TERM'] # Colored output
env.Program('tiled_test.exe', 'main.cpp', LIBS=LIBS, LIBPATH=LIBPATH, CCFLAGS=CCFLAGS)
直接运行clang ++时,它可以很好地工作。
clang++ main.cpp -o tiled_test.exe -Iinclude -Llib -mwindows --target=x86_64-w64-windows-gnu -static -static-libgcc -static-libstdc++ -lraylib -lopengl32 -lgdi32 -lwinmm
I'm developing a game with raylib using SCons for building. I'm using Clang to cross compile from Ubuntu (in WSL) to Windows. My project directory contains a lib
directory with the raylib binaries and an include
directory with the raylib headers. When I run SCons I get this output:
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
clang++ -o main.o -c -mwindows --target=x86_64-w64-windows-gnu -static -static-libgcc -static-libstdc++ -Iinclude main.cpp
clang: warning: argument unused during compilation: '-mwindows' [-Wunused-command-line-argument]
clang: warning: argument unused during compilation: '-static-libgcc' [-Wunused-command-line-argument]
clang: warning: argument unused during compilation: '-static-libstdc++' [-Wunused-command-line-argument]
clang++ -o tiled_test.exe main.o -Llib -lraylib -lopengl32 -lgdi32 -lwinmm
/bin/ld: cannot find -lopengl32
/bin/ld: cannot find -lgdi32
/bin/ld: cannot find -lwinmm
clang: error: linker command failed with exit code 1 (use -v to see invocation)
scons: *** [tiled_test.exe] Error 1
scons: building terminated because of errors.
ld
can't find opengl32
, gli32
, and winmm
.
My SConstruct file:
import os
LIBS=['raylib', 'opengl32', 'gdi32', 'winmm']
LIBPATH='./lib'
CCFLAGS='-mwindows --target=x86_64-w64-windows-gnu -static -static-libgcc -static-libstdc++'
env = Environment(CXX='clang++', CPPPATH='./include')
env['ENV']['TERM'] = os.environ['TERM'] # Colored output
env.Program('tiled_test.exe', 'main.cpp', LIBS=LIBS, LIBPATH=LIBPATH, CCFLAGS=CCFLAGS)
When I run Clang++ directly it works perfectly.
clang++ main.cpp -o tiled_test.exe -Iinclude -Llib -mwindows --target=x86_64-w64-windows-gnu -static -static-libgcc -static-libstdc++ -lraylib -lopengl32 -lgdi32 -lwinmm
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我找到了我问题的答案。根据 this 默认情况下,SCONS不使用Shell的
PATH
。用户需要将其添加到环境中。我固定的sconstruct文件:
I found the answer to my problem. According the this by default SCons doesn't use the shell's
PATH
. The user needs to add it to the environment.My fixed SConstruct file: