我正在遵循此处构建音频分类器的教程,当到达运行 sh build.sh 的步骤时,我收到错误cannot find -lc++。
恳请您提供有关如何修复此错误的任何建议,我们将不胜感激。
Building standalone classifier
mkdir -p build
rm -rf *.gcda
rm -rf *.gcno
clang -c -DTF_LITE_DISABLE_X86_NEON -Wall -I. -Isource -Iedge-impulse-sdk/ -Iedge-impulse-sdk/tensorflow -Iedge-impulse-sdk/third_party -Iedge-impulse-sdk/third_party/flatbuffers -Iedge-impulse-sdk/third_party/flatbuffers/include -Iedge-impulse-sdk/third_party/flatbuffers/include/flatbuffers -Iedge-impulse-sdk/third_party/gemmlowp/ -Iedge-impulse-sdk/third_party/gemmlowp/fixedpoint -Iedge-impulse-sdk/third_party/gemmlowp/internal -Iedge-impulse-sdk/third_party/ruy -Imodel-parameters -Itflite-model -Iedge-impulse-sdk/anomaly -Iedge-impulse-sdk/classifier -Iedge-impulse-sdk/dsp -Iedge-impulse-sdk/dsp/kissfft -Iedge-impulse-sdk/porting -lc++ -lm edge-impulse-sdk/tensorflow/lite/c/common.c -o build/common.o
clang: warning: -lc++: 'linker' input unused [-Wunused-command-line-argument]
clang: warning: -lm: 'linker' input unused [-Wunused-command-line-argument]
clang++ -DTF_LITE_DISABLE_X86_NEON -std=c++11 -Wall -I. -Isource -Iedge-impulse-sdk/ -Iedge-impulse-sdk/tensorflow -Iedge-impulse-sdk/third_party -Iedge-impulse-sdk/third_party/flatbuffers -Iedge-impulse-sdk/third_party/flatbuffers/include -Iedge-impulse-sdk/third_party/flatbuffers/include/flatbuffers -Iedge-impulse-sdk/third_party/gemmlowp/ -Iedge-impulse-sdk/third_party/gemmlowp/fixedpoint -Iedge-impulse-sdk/third_party/gemmlowp/internal -Iedge-impulse-sdk/third_party/ruy -Imodel-parameters -Itflite-model -Iedge-impulse-sdk/anomaly -Iedge-impulse-sdk/classifier -Iedge-impulse-sdk/dsp -Iedge-impulse-sdk/dsp/kissfft -Iedge-impulse-sdk/porting -lc++ -lm source/*.cpp edge-impulse-sdk/dsp/kissfft/*.cpp edge-impulse-sdk/dsp/dct/*.cpp edge-impulse-sdk/tensorflow/lite/kernels/*.cc edge-impulse-sdk/tensorflow/lite/kernels/internal/*.cc edge-impulse-sdk/tensorflow/lite/micro/kernels/*.cc edge-impulse-sdk/tensorflow/lite/micro/*.cc edge-impulse-sdk/tensorflow/lite/micro/memory_planner/*.cc edge-impulse-sdk/tensorflow/lite/core/api/*.cc ./edge-impulse-sdk/dsp/memory.cpp edge-impulse-sdk/porting/posix/*.c* build/common.o -o build/edge-impulse-standalone
/usr/bin/ld: cannot find -lc++
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Makefile.tflite:36: recipe for target 'build' failed
make: *** [build] Error 1
Run Code Online (Sandbox Code Playgroud)
emm*_*lau 12
我认为您的构建配置告诉编译器使用 clang (LLVM) 中的标准 c++ 库。
这是一种可能的选择,而且当然不是一个糟糕的选择。然而它并不是标准 C++ 库的唯一选择。最后有两个常用的标准 C++ 库:使用非常广泛的 GNU 标准 C++ 库libstdc++和稍微更现代的libc++。两个库都不错。但由于 GNU 版本更常用(截至撰写本文时),因此使用此版本可能会遇到更少的问题。
要控制标准 C++ 库的选择,-stdlib=xxx可以使用编译器标志。在您的情况下,此标志似乎设置为libc++,或者您的编译器默认为libc++。
请注意,一个常见问题可能是libc++默认情况下开发文件未与 clang 编译器一起安装。因此,很可能您所需要做的就是安装缺少的库,一切都会正常。
你至少有两个选择:
15为您的实际版本):sudo apt install libc++-15-dev libc++abi-15-dev
Run Code Online (Sandbox Code Playgroud)
libstdc++,通常从构建配置中删除该-stdlib=libc++标志就足够了,例如从CMakeLists.txt. 您的编译器也可能默认使用libc++,在这种情况下,您需要添加该标志-stdlib=libstdc++来主动选择 GNU 版本。| 归档时间: |
|
| 查看次数: |
44188 次 |
| 最近记录: |