Skip to content

Instantly share code, notes, and snippets.

@Nadav-Ruskin
Last active March 30, 2018 09:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Nadav-Ruskin/53b5726db802ca5538200d38e3a2bf3a to your computer and use it in GitHub Desktop.
Save Nadav-Ruskin/53b5726db802ca5538200d38e3a2bf3a to your computer and use it in GitHub Desktop.
Answer for tomoaki0705

Hello again @tomoaki0705 , thank you very much for your continued assistance.

compiler

[osboxes:/opencv/opencv] $ aarch64-linux-gnu-g++ cmake/checks/cpu_neon.cpp
In file included from cmake/checks/cpu_neon.cpp:8:0:
/usr/lib/gcc/aarch64-linux-gnu/4.9/include/arm_neon.h: In function 'uint8x8_t vqadd_u8(uint8x8_t, uint8x8_t)':
/usr/lib/gcc/aarch64-linux-gnu/4.9/include/arm_neon.h:2116:51: error: '__builtin_aarch64_uqaddv8qi_uuu' was not declared in this scope
   return __builtin_aarch64_uqaddv8qi_uuu (__a, __b);
... similar errors

environment

[osboxes:/opencv/opencv] 1 $ cat $CMAKE_TOOLCHAIN_FILE 
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_VERSION 1)
set(CMAKE_SYSTEM_PROCESSOR aarch64)

set(cross_triple "aarch64-linux-gnu")

set(CMAKE_C_COMPILER /usr/bin/${cross_triple}-cc)
set(CMAKE_CXX_COMPILER /usr/bin/${cross_triple}-c++)
set(CMAKE_Fortran_COMPILER /usr/bin/${cross_triple}-gfortran)

# Discard path returned by pkg-config and associated with HINTS in module
# like FindOpenSSL.
set(CMAKE_IGNORE_PATH /usr/lib/x86_64-linux-gnu/ /usr/lib/x86_64-linux-gnu/lib/)

set(CMAKE_CROSSCOMPILING_EMULATOR /usr/bin/qemu-aarch64)

sudo

Just a quirk of me using the command inside the docker inside a directory installed by the Dockerfile's command that ran as root. I don't have access to the folder otherwise. It's not really important.

compiler

Digging inside the Dockcross project, I beleive the package is crossbuild-essential-arm64

zip

I'm just following the instructions found here. The soft link is pretty worthless, I forgot it's even there. I removed it in the dockerfiles I've developed for other platforms already.

As for your last question, I'm building a large piece of software that relies on OpenCV. My project's build is fully automated using Jenkins and AWS, with all builds occurring on a single Linux slave, with a single unified script. I do own an ARM64 device, but using it as a compilation slave for my team is out of the question.

Answering your comment:

    [osboxes:/opencv/opencv] $ ls -l /usr/bin/aarch64-linux-gnu-c++
    lrwxrwxrwx 1 root root 39 Jan 29 19:11 /usr/bin/aarch64-linux-gnu-c++ -> /etc/alternatives/aarch64-linux-gnu-c++
@tomoaki0705
Copy link

Nice investigation.

So, where does /usr/bin/aarch64-linux-gnu-c++ goes finally ?
/etc/alternatives/aarch64-linux-gnu-c++ doesn't appear on my environment, and that makes me feel that compiler installation failed somehow.

Also, I'm curious about the $CMAKE_TOOLCHAIN_FILE too.
This environment should contain a file name. You showed me the content of the file, but I'm curious where this content came from.
There's a similar file in OpenCV, but the content is totally different.
Where did this CMAKE_TOOLCHAIN_FILE came from ?

Probably you need to run cmake -DCMAKE_TOOLCHAIN_FILE=../platforms/linux/aartch64-gnu.toolchain.cmake

@tomoaki0705
Copy link

After thinking of extra hours, I think you hit a bug of gcc.
It's too early to decide, and may not be the bug of gcc, but package builder, or somewhere.

The function __builtin_aarch64_uqaddv8qi_uuu does exist on my native arm_neon.h.
This should be supported by the compiler, but somehow, probably the package went in wrong situation with wrong config or something, and it missed some builtin-function which supposed to have.
That explains the situation, and no matter how long we investigate on this situation, there is only one way to go, "Upgrade your compiler"

The alternative I can think is to build the GCC from source, but so far by now, I haven't succeeded about this point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment