gemma.cpp icon indicating copy to clipboard operation
gemma.cpp copied to clipboard

make error on orangepi 5 (arm)

Open mdaniel29 opened this issue 1 year ago • 5 comments

I'm facing an issue when compiling on orangepi, Debian BookWorm. I installed first some dependencies : sudo apt install libhighwayhash-dev libhighwayhash0

But I have such errors ( after command "make gemma", or "make -j4 gemma") :

/home/orangepi/gemma/gemma.cpp/./ops.h:210:13: error: ‘Mul’ was not declared in this scope 210 | return Mul(v, cdf); | ~~~^~~~~~~~

OR :

/home/orangepi/gemma/gemma.cpp/./ops.h:580:40: error: capture by copy of SVE type ‘V’ {aka ‘__SVFloat32_t’} 580 | hn::Transform(d, x, mask_pos, [&sum, max](D d, V v) {

make --version -> GNU Make 4.3 for aarch64-unknown-linux-gnu

I also tried with cmake, with no luck. Thanks.

mdaniel29 avatar Feb 24 '24 21:02 mdaniel29

I think this is related to the namespace issue, which should be resolved in this commit on the dev branch:

https://github.com/google/gemma.cpp/commit/4a0d23f47ee36370e8db429648f58af6fdb9f953

Might try with the dev branch or alternatively I'll be sync'ing dev to main later today after some checking.

austinvhuang avatar Feb 24 '24 21:02 austinvhuang

All right. I'll have a look later, thank you.

mdaniel29 avatar Feb 24 '24 21:02 mdaniel29

Similar question in Oracle arm server (CPU: 4x ARM Neoverse-N1). I have errors like ops.h:581:40: error: capture by copy of SVE type ‘V’ {aka ‘__SVFloat32_t’} or ops.h:582:41: error: ‘max’ is not captured, and it still happend in dev branch.

CescMessi avatar Feb 25 '24 09:02 CescMessi

solved.

install clang 17 or above

bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)"

Put it as an alternative to c++

sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/clang++-18 60

re-run cmake -B build

jmrobles avatar Feb 25 '24 10:02 jmrobles

sudo apt install libhighwayhash-dev libhighwayhash0

FYI highwayhash is not a dependency, but highway is.

For the lambda issue, unfortunately compilers differ in what they permit. Clang indeed seems more permissive. I am changing the code so we do not require such a recent compiler.

jan-wassenberg avatar Feb 25 '24 10:02 jan-wassenberg

the update-alternatives trick did the job. Many thanks. My command list (for my orangepi 5, Debian Bookworm) is :

cmake -B build
sudo apt install clang-16 libclang-rt-16-dev
sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/clang++-16 60
cd build
make
sudo update-alternatives --remove c++ /usr/bin/clang++-16

mdaniel29 avatar Feb 26 '24 21:02 mdaniel29