我正在尝试构建wxFormBuilder_v3.5.0-beta-source。它带有一个用于创建构建文件的 shell 文件,但始终会因以下错误而卡住:

==== Building Premake4 ====
Linking Premake4
ld: library not found for -lstdc++-static
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [bin/release/premake4] Error 1
make: *** [Premake4] Error 2
./create_build_files4.sh: line 91: ./premake/macosx/bin/release/premake4: No such file or directory
./create_build_files4.sh: line 92: ./premake/macosx/bin/release/premake4: No such file or directory
./create_build_files4.sh: line 93: ./premake/macosx/bin/release/premake4: No such file or directory
./create_build_files4.sh: line 95: ./premake/macosx/bin/release/premake4: No such file or directory

我正在运行Mac OS X 10.9.4,是的,我已经安装了XCode,并且以前已经在此计算机上成功构建/安装了C++项目。

我知道我必须先安装wxWidgets才能正常工作,并且我已经成功构建/编译/安装了wxWidgets。

这是 shell 程序文件的第87-96行(我在行号前添加了前缀供您参考):
[87] # Build premake
[88] cd build
[89] make CONFIG=Release -C./premake/$platform
[90]
[91] ./premake/$platform/bin/release/premake4 --file=./premake/solution.lua $wxunicode $wxroot $wxversion $mediactrl $shared $arch codeblocks
[92] ./premake/$platform/bin/release/premake4 --file=./premake/solution.lua $wxunicode $wxroot $wxversion $mediactrl $shared $arch $rpath codelite
[93] ./premake/$platform/bin/release/premake4 --file=./premake/solution.lua $wxunicode $wxroot $wxversion $mediactrl $shared $arch $rpath gmake
[94] if [ "$platform" = "macosx" ]; then
[95]    ./premake/$platform/bin/release/premake4 --file=./premake/solution.lua $wxunicode $wxroot $wxversion $mediactrl $shared $arch xcode3
[96] fi

我不担心文件路径丢失。我试图直接从正确的目录运行make,仍然出现此错误:
==== Building Premake4 ====
Linking Premake4
ld: library not found for -lstdc++-static
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [bin/release/premake4] Error 1
make: *** [Premake4] Error 2

我主要关心的是找到-lstdc++-static库并安装它,但是我无法在线找到它。我唯一能找到的相关信息是在编译iOS应用程序时更改XCode的设置,在这里情况并非如此。需要进行的任何更改都需要在文本编辑器中进行。

最佳答案

这意味着premake文件路径:./premake/macosx/bin/release/premake4不存在。请注意,您使用的是相对路径(从./开始),而不是绝对路径。尝试使用绝对路径并检查premake4可执行文件的位置。

ld:找不到用于-lstdc++-static的库,这意味着您的链接器无法使用静态链接来创建对象。请检查您是否可以完全构建静态二进制文件。

像这样创建hello world测试:

#include <iostream>
int main()
{
  std::cout << "Hello world!" << std::endl;
  return 0;
}

尝试建立它
clang++ test.cpp -o test


clang++ -static test.cpp -o test

这样的测试结果可以确保您完全能够创建二进制文件。

10-06 04:09