huawei-noah / bolt

Bolt is a deep learning library with high performance and heterogeneous flexibility.
https://huawei-noah.github.io/bolt/
MIT License
915 stars 158 forks source link

bolt build failed on windows, here's the error report #89

Open tcwangbuaa opened 2 years ago

tcwangbuaa commented 2 years ago

CMake Error at C:/Program Files/CMake/share/cmake-3.22/Modules/CMakeTestCCompiler.cmake:69 (message): The C compiler

"D:/mingw64/bin/gcc.exe"

is not able to compile a simple test program.

It fails with the following output:

Change Dir: C:/Users/Q/Desktop/bolt-master/third_party/windows-x86_64/protobuf/protobuf-3.14.0/build/CMakeFiles/CMakeTmp

Run Build Command(s):D:/mingw64/bin/mingw32-make.exe -f Makefile cmTC_4fc87/fast && mingw32-make  -f CMakeFiles\cmTC_4fc87.dir\build.make CMakeFiles/cmTC_4fc87.dir/build
mingw32-make[1]: Entering directory 'C:/Users/Q/Desktop/bolt-master/third_party/windows-x86_64/protobuf/protobuf-3.14.0/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_4fc87.dir/testCCompiler.c.obj
D:\mingw64\bin\gcc.exe    -o CMakeFiles\cmTC_4fc87.dir\testCCompiler.c.obj -c C:\Users\Q\Desktop\bolt-master\third_party\windows-x86_64\protobuf\protobuf-3.14.0\build\CMakeFiles\CMakeTmp\testCCompiler.c
Linking C executable cmTC_4fc87.exe
"C:\Program Files\CMake\bin\cmake.exe" -E cmake_link_script CMakeFiles\cmTC_4fc87.dir\link.txt --verbose=1
"C:\Program Files\CMake\bin\cmake.exe" -E rm -f CMakeFiles\cmTC_4fc87.dir/objects.a
D:\mingw64\bin\ar.exe qc CMakeFiles\cmTC_4fc87.dir/objects.a @CMakeFiles\cmTC_4fc87.dir\objects1.rsp
D:\mingw64\bin\gcc.exe -Wl,--whole-archive CMakeFiles\cmTC_4fc87.dir/objects.a -Wl,--no-whole-archive -o cmTC_4fc87.exe -Wl,--out-implib,libcmTC_4fc87.dll.a -Wl,--major-image-version,0,--minor-image-version,0 @CMakeFiles\cmTC_4fc87.dir\linklibs.rsp
gcc.exe: error: CreateProcess: No such file or directory
mingw32-make[1]: *** [CMakeFiles\cmTC_4fc87.dir\build.make:100: cmTC_4fc87.exe] Error 1
mingw32-make[1]: Leaving directory 'C:/Users/Q/Desktop/bolt-master/third_party/windows-x86_64/protobuf/protobuf-3.14.0/build/CMakeFiles/CMakeTmp'
mingw32-make.exe: *** [Makefile:126: cmTC_4fc87/fast] Error 2
tcwangbuaa commented 2 years ago

While build on macOS with target=android-aarch64,

[INFO] build protobuf in /Users/blank/Desktop/bolt-master/third_party/android-aarch64/protobuf... CMake Error at /Applications/CMake.app/Contents/share/cmake-3.22/Modules/CMakeTestCCompiler.cmake:69 (message): The C compiler

"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang"

is not able to compile a simple test program.

It fails with the following output:

Change Dir: /Users/blank/Desktop/bolt-master/third_party/android-aarch64/protobuf/protobuf-3.14.0/build/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/make -f Makefile cmTC_9c965/fast && make  -f CMakeFiles/cmTC_9c965.dir/build.make CMakeFiles/cmTC_9c965.dir/build
Building C object CMakeFiles/cmTC_9c965.dir/testCCompiler.c.o
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang  --target=aarch64-linux-android21   --target=aarch64-linux-android21  --target=aarch64-linux-android21  -MD -MT CMakeFiles/cmTC_9c965.dir/testCCompiler.c.o -MF CMakeFiles/cmTC_9c965.dir/testCCompiler.c.o.d -o CMakeFiles/cmTC_9c965.dir/testCCompiler.c.o -c /Users/blank/Desktop/bolt-master/third_party/android-aarch64/protobuf/protobuf-3.14.0/build/CMakeFiles/CMakeTmp/testCCompiler.c
Linking C executable cmTC_9c965
/Applications/CMake.app/Contents/bin/cmake -E cmake_link_script CMakeFiles/cmTC_9c965.dir/link.txt --verbose=1
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang  --target=aarch64-linux-android21 --target=aarch64-linux-android21  --target=aarch64-linux-android21  -rdynamic CMakeFiles/cmTC_9c965.dir/testCCompiler.c.o -o cmTC_9c965
ld: unknown option: -z
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [cmTC_9c965] Error 1
make: *** [cmTC_9c965/fast] Error 2

CMake will not be able to correctly generate this project. Call Stack (most recent call first): CMakeLists.txt:20 (project)

yuxianzhi commented 2 years ago

when build for android using android-aarch64 target, you need to set ANDROID_NDK_ROOT shell environment to find ndk toolchains in ${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/darwin-x86_64/bin

yuxianzhi commented 2 years ago

Can you give more information for windows build? you can refer bolt windows workflow in https://github.com/huawei-noah/bolt/blob/master/.github/workflows/windows-x86-avx2.yml

you can use --converter=off to close converter build.