“ Make”因Clang错误而失败-如何从Clang中获取错误?

问题描述 投票:0回答:1

主要问题是:我如何摆脱clang错误?

我一直试图按照these instructions安装GLEW。从第二个角度看,我已经发现GLEW在Mac OS X上并不是真正必要的,但是我仍然想找出如何从遇到的问题中获取错误。 (我对make的经验不足,无法使任何类似的在线解决方案正常工作。]

理论上,我应该下载GLEW,解压缩,然后在文件中运行'make'。这是make的输出:

$ make
cc -dynamiclib -install_name /usr/local/lib/libGLEW.2.1.0.dylib -current_version 2.1.0 -compatibility_version 2.1 -o lib/libGLEW2.1.0.dylib tmp/darwin/default/shared/glew.o -framework OpenGL
ld: malformed file
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks//OpenGLframework/OpenGL.tbd:4:18: error: unknown enumerated scalar
platform:    zippered
             ^~~~~~~~
 file '/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Framework//OpenGL.framework/OpenGL.tbd'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [lib/libGLEW.2.1.0.dylib] Error 1

Make -n显示这只是第一个命令,几乎立即失败。我已经尝试过make V=1make VERBOSE=1make SHELL='sh -x',但它们没有给我有关clang错误的更多详细信息。我也尝试过使用-v:

运行cc命令。
$ cc -v -dynamiclib -install_name /usr/local/lib/libGLEW.2.1.0.dylib -current_version 2.1.0 -compatibility_version 2.1 -o lib/libGLEW2.1.0.dylib tmp/darwin/default/shared/glew.o -framework OpenGL
Apple LLVM version 9.1.0 (clang-902.0.39.1)
Target: x86_64-apple-darwin18.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
"Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -demangle -lto_library /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/libLTO.dylib -dynamic -dylib -dylib_compatibility_version 2.1 -dylib_current_version 2.1.0 -arch x86_64 -dyib_install_name /usr/local/lib/libGLEW.2.1.0.dylib -macosx_version_min 10.14.0 -syslibroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk -o lib/libGLEW.2.1.0.dylib tmp/darwin/default/shared/glew.o -framework OpenGL -L/usr/local/lib -lSystem / Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchains/usr/lib/clang/9.1.0/lib/darwin/libclang_rt.osx.a
ld: malformed file
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks//OpenGLframework/OpenGL.tbd:4:18: error: unknown enumerated scalar
platform:    zippered
             ^~~~~~~~
 file '/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Framework//OpenGL.framework/OpenGL.tbd'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [lib/libGLEW.2.1.0.dylib] Error 1

我认为我实际上并没有设法摆脱c语。那我该怎么做?

c++ makefile clang linker-errors glew
1个回答
0
投票

Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld -demangle -lto_library /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/libLTO.dylib -dynamic -dylib -dylib_compatibility_version 2.1 -dylib_current_version 2.1.0 -arch x86_64 -dyib_install_name /usr/local/lib/libGLEW.2.1.0.dylib -macosx_version_min 10.14.0 -syslibroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk -o lib/libGLEW.2.1.0.dylib tmp/darwin/default/shared/glew.o -framework OpenGL -L/usr/local/lib -lSystem / Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchains/usr/lib/clang/9.1.0/lib/darwin/libclang_rt.osx.a

失败的命令,它是ld,而不是clang。您可以单独运行此命令以获取相同的错误消息。

ld: malformed file
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks//OpenGLframework/OpenGL.tbd:4:18: error: unknown enumerated scalar
platform:    zippered
             ^~~~~~~~
file '/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Framework//OpenGL.framework/OpenGL.tbd'

是链接器的错误消息。不幸的是,我对Mac上的编译过程不熟悉,因此无法建议如何修复它。

© www.soinside.com 2019 - 2024. All rights reserved.