Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiling issues: regarding "-march=native" #5271

Closed
tohidhajimorad opened this issue Jan 8, 2024 · 1 comment
Closed

Compiling issues: regarding "-march=native" #5271

tohidhajimorad opened this issue Jan 8, 2024 · 1 comment

Comments

@tohidhajimorad
Copy link

Detail
cpu: Intel core i7 11375H
system: Ubuntu 20.04 LTS
gcc version: gcc-9
aarch64-linux-gnu-gcc version: gcc-9-aarch64-linux-gnu

Issue
When compiling using
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=../toolchains/jetson.toolchain.cmake -DNCNN_VULKAN=ON -DNCNN_BUILD_EXAMPLES=ON ..

it returns

-- NCNN_VERSION_STRING = 1.0.20230111
-- The C compiler identification is GNU 9.4.0
-- The CXX compiler identification is GNU 9.4.0
-- Check for working C compiler: /usr/bin/aarch64-linux-gnu-gcc
-- Check for working C compiler: /usr/bin/aarch64-linux-gnu-gcc -- broken
CMake Error at /usr/share/cmake-3.16/Modules/CMakeTestCCompiler.cmake:60 (message):
The C compiler

"/usr/bin/aarch64-linux-gnu-gcc"
is not able to compile a simple test program.

It fails with the following output:

Change Dir: /home/ealin/ncnn/build/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/make cmTC_753ed/fast && /usr/bin/make -f CMakeFiles/cmTC_753ed.dir/build.make CMakeFiles/cmTC_753ed.dir/build
make[1]: Entering directory '/home/ealin/ncnn/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_753ed.dir/testCCompiler.c.o
/usr/bin/aarch64-linux-gnu-gcc -march=native -o CMakeFiles/cmTC_753ed.dir/testCCompiler.c.o -c /home/ealin/ncnn/build/CMakeFiles/CMakeTmp/testCCompiler.c
cc1: error: unknown value ‘native’ for ‘-march’
cc1: note: valid arguments are: armv8-a armv8.1-a armv8.2-a armv8.3-a armv8.4-a armv8.5-a
make[1]: *** [CMakeFiles/cmTC_753ed.dir/build.make:66: CMakeFiles/cmTC_753ed.dir/testCCompiler.c.o] Error 1
make[1]: Leaving directory '/home/ealin/ncnn/build/CMakeFiles/CMakeTmp'
make: *** [Makefile:121: cmTC_753ed/fast] Error 2
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:48 (project)

When I check with /usr/bin/aarch64-linux-gnu-g++ -Q --help=target, the march part says -march= armv8-a.

The jetson.toolchain.cmake file has the line

-march=armv8-a could work on Jetson, but will compile without some extra cpu features

Questions
Why 'native' is not recognized for -march and how to fix it?
Which features are neglected if compiling with "-march=armv8-a"?

@nihui
Copy link
Member

nihui commented Jan 8, 2024

jetson.toolchain.cmake is used for compiling natively on jetson board
If you mean to cross-compiling for arm board, use aarch64-linux-gnu.toolchain.cmake

@nihui nihui closed this as completed Feb 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants