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

Problem building for freebsd arm64 #2330

Closed
NoResponse13 opened this issue Apr 29, 2021 · 7 comments
Closed

Problem building for freebsd arm64 #2330

NoResponse13 opened this issue Apr 29, 2021 · 7 comments
Labels
Milestone

Comments

@NoResponse13
Copy link

root@generic:~/xmrig/build # uname -a
FreeBSD generic 13.0-RELEASE FreeBSD 13.0-RELEASE #0 releng/13.0-n244733-ea31abc261f: Fri Apr  9 06:10:43 UTC 2021     root@releng1.nyi.freebsd.org:/usr/obj/usr/src/arm64.aarch64/sys/GENERIC  arm64
root@generic:~/xmrig/build # cmake ..
-- The C compiler identification is Clang 11.0.1
-- The CXX compiler identification is Clang 11.0.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Use ARM_TARGET=8 (aarch64)
-- Performing Test XMRIG_ARM_CRYPTO
-- Performing Test XMRIG_ARM_CRYPTO - Success
-- Looking for syslog.h
-- Looking for syslog.h - found
-- Found HWLOC: /usr/local/lib/libhwloc.so
-- Found UV: /usr/local/lib/libuv.a
-- Looking for __builtin___clear_cache
-- Looking for __builtin___clear_cache - not found
-- WITH_MSR=OFF
-- Found OpenSSL: /usr/local/lib/libcrypto.so (found version "1.1.1k")
-- Configuring done
-- Generating done
-- Build files have been written to: /root/xmrig/build
root@generic:~/xmrig/build # make -j4
Scanning dependencies of target ethash
Scanning dependencies of target argon2
[  1%] Building C object src/3rdparty/libethash/CMakeFiles/ethash.dir/ethash_internal.c.o
[  1%] Building C object src/3rdparty/libethash/CMakeFiles/ethash.dir/keccakf800.c.o
[  1%] Building C object src/3rdparty/argon2/CMakeFiles/argon2.dir/lib/core.c.o
[  1%] Building C object src/3rdparty/argon2/CMakeFiles/argon2.dir/lib/argon2.c.o
[  2%] Building C object src/3rdparty/argon2/CMakeFiles/argon2.dir/lib/encoding.c.o
...
[ 40%] Building CXX object CMakeFiles/xmrig.dir/src/backend/cpu/platform/BasicCpuInfo_arm.cpp.o
[ 41%] Building CXX object CMakeFiles/xmrig.dir/src/backend/cpu/platform/lscpu_arm.cpp.o
[ 41%] Building CXX object CMakeFiles/xmrig.dir/src/backend/opencl/cl/OclSource.cpp.o
/root/xmrig/src/backend/cpu/platform/BasicCpuInfo_arm.cpp:31:13: fatal error: 'asm/hwcap.h' file not found
#   include <asm/hwcap.h>
            ^~~~~~~~~~~~~
[ 41%] Building CXX object CMakeFiles/xmrig.dir/src/backend/opencl/generators/ocl_generic_cn_generator.cpp.o
1 error generated.
--- CMakeFiles/xmrig.dir/src/backend/cpu/platform/BasicCpuInfo_arm.cpp.o ---
*** [CMakeFiles/xmrig.dir/src/backend/cpu/platform/BasicCpuInfo_arm.cpp.o] Error code 1
...

@RS102839
Copy link

RS102839 commented Apr 30, 2021

You are getting further than people trying to build for the arm64 on the Mac M1, as at least your scripts are recognizing:

-- Use ARM_TARGET=8 (aarch64)
-- Performing Test XMRIG_ARM_CRYPTO
-- Performing Test XMRIG_ARM_CRYPTO - Success

...watching this thread for hints on solving the M1 arm64 build problem.

@Spudz76
Copy link
Contributor

Spudz76 commented Apr 30, 2021

Disable OpenCL and CUDA (using cmake args -DWITH_OPENCL=OFF -DWITH_CUDA=OFF)

@NoResponse13
Copy link
Author

NoResponse13 commented May 1, 2021

Disable OpenCL and CUDA (using cmake args -DWITH_OPENCL=OFF -DWITH_CUDA=OFF)

root@generic:~/xmrig/build # rm -rf ./*
root@generic:~/xmrig/build # ls
root@generic:~/xmrig/build #`
root@generic:~/xmrig/build # cmake .. -DWITH_OPENCL=OFF -DWITH_CUDA=OFF
-- The C compiler identification is Clang 11.0.1
-- The CXX compiler identification is Clang 11.0.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Use ARM_TARGET=8 (aarch64)
-- Performing Test XMRIG_ARM_CRYPTO
-- Performing Test XMRIG_ARM_CRYPTO - Success
-- Looking for syslog.h
-- Looking for syslog.h - found
-- Found HWLOC: /usr/local/lib/libhwloc.so
-- Found UV: /usr/local/lib/libuv.a
-- Looking for __builtin___clear_cache
-- Looking for __builtin___clear_cache - not found
-- WITH_MSR=OFF
-- Found OpenSSL: /usr/local/lib/libcrypto.so (found version "1.1.1k")
-- Configuring done
-- Generating done
-- Build files have been written to: /root/xmrig/build
root@generic:~/xmrig/build #

root@generic:~/xmrig/build # make -j4
-- Use ARM_TARGET=8 (aarch64)
-- WITH_MSR=OFF
-- Configuring done
-- Generating done
-- Build files have been written to: /root/xmrig/build
Scanning dependencies of target ethash
Scanning dependencies of target argon2
[  1%] Building C object src/3rdparty/libethash/CMakeFiles/ethash.dir/keccakf800.c.o
[  1%] Building C object src/3rdparty/libethash/CMakeFiles/ethash.dir/ethash_internal.c.o
[  2%] Building C object src/3rdparty/argon2/CMakeFiles/argon2.dir/lib/argon2.c.o
[  2%] Building C object src/3rdparty/argon2/CMakeFiles/argon2.dir/lib/core.c.o
[  2%] Building C object src/3rdparty/argon2/CMakeFiles/argon2.dir/lib/encoding.c.o
[  3%] Building C object src/3rdparty/argon2/CMakeFiles/argon2.dir/lib/genkat.c.o
...
[ 52%] Building CXX object CMakeFiles/xmrig.dir/src/backend/cpu/CpuThread.cpp.o
[ 53%] Building CXX object CMakeFiles/xmrig.dir/src/backend/cpu/CpuThreads.cpp.o
[ 53%] Building CXX object CMakeFiles/xmrig.dir/src/backend/cpu/CpuWorker.cpp.o
[ 54%] Building CXX object CMakeFiles/xmrig.dir/src/backend/cpu/platform/HwlocCpuInfo.cpp.o
[ 54%] Building CXX object CMakeFiles/xmrig.dir/src/backend/cpu/platform/BasicCpuInfo_arm.cpp.o
[ 55%] Building CXX object CMakeFiles/xmrig.dir/src/backend/cpu/platform/lscpu_arm.cpp.o
[ 56%] Building CXX object CMakeFiles/xmrig.dir/src/App.cpp.o
[ 56%] Building CXX object CMakeFiles/xmrig.dir/src/core/config/Config.cpp.o
/root/xmrig/src/backend/cpu/platform/BasicCpuInfo_arm.cpp:31:13: fatal error: 'asm/hwcap.h' file not found
#   include <asm/hwcap.h>
            ^~~~~~~~~~~~~
[ 57%] Building CXX object CMakeFiles/xmrig.dir/src/core/config/ConfigTransform.cpp.o
1 error generated.
--- CMakeFiles/xmrig.dir/src/backend/cpu/platform/BasicCpuInfo_arm.cpp.o ---
*** [CMakeFiles/xmrig.dir/src/backend/cpu/platform/BasicCpuInfo_arm.cpp.o] Error code 1

make[2]: stopped in /root/xmrig/build
In file included from /root/xmrig/src/core/config/ConfigTransform.cpp:20:
/root/xmrig/src/core/config/ConfigTransform.h:43:10: warning: private field 'm_opencl' is not used [-Wunused-private-field]
    bool m_opencl           = false;
         ^
1 warning generated.
1 error

make[2]: stopped in /root/xmrig/build
--- CMakeFiles/xmrig.dir/all ---
...

@Spudz76
Copy link
Contributor

Spudz76 commented May 2, 2021

This might help that part, for FreeBSD 12 or higher (noting you have 13)
arm64-fbsd-try1.patch.txt

@NoResponse13
Copy link
Author

NoResponse13 commented May 3, 2021

patch workerd. but need append

#   if __ARM_FEATURE_CRYPTO
-#   if !defined(__APPLE__)
+#   if !defined(__APPLE__) && !defined(__FreeBSD__)
    m_flags.set(FLAG_AES, getauxval(AT_HWCAP) & HWCAP_AES);
#   else
    m_flags.set(FLAG_AES, true);
#   endif
#   endif

only 2 warrnings

[ 40%] Building CXX object CMakeFiles/xmrig.dir/src/backend/cpu/platform/BasicCpuInfo_arm.cpp.o
[ 41%] Building CXX object CMakeFiles/xmrig.dir/src/backend/cpu/platform/lscpu_arm.cpp.o
/root/xmrig/src/backend/cpu/platform/BasicCpuInfo_arm.cpp:36:12: warning: 'HWCAP_AES' macro redefined [-Wmacro-redefined]
#   define HWCAP_AES (1 << 3)
           ^
/usr/include/machine/elf.h:98:9: note: previous definition is here
#define HWCAP_AES               0x00000008
        ^
...
[ 73%] Building CXX object CMakeFiles/xmrig.dir/src/hw/dmi/DmiBoard.cpp.o
In file included from /root/xmrig/src/hw/api/HwApi.cpp:26:
/root/xmrig/src/hw/dmi/DmiReader.h:35:1: warning: 'DmiReader' defined as a class here but previously declared as a struct; this is valid, but may result in linker errors under the Microsoft C++ ABI [-Wmismatched-tags]
class DmiReader
^
/root/xmrig/src/hw/api/HwApi.h:32:1: note: did you mean class here?
struct DmiReader;
^~~~~~
class

@SChernykh
Copy link
Contributor

@NoResponse13 This is because getauxval is not available on FreeBSD on ARM. Can you try this better fix: #2340 ?

@xmrig xmrig added the bug label May 3, 2021
@xmrig xmrig added this to the v6 milestone May 3, 2021
@NoResponse13
Copy link
Author

perfect

@xmrig xmrig closed this as completed Dec 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants