Error in cmake after libtuv update
tylerw1369 opened this issue · comments
I try to compile using my de10 nano and get this error .
root@lampa:~/dcurl# make BUILD_FPGA_ACCEL=1
git submodule update --init deps/libtuv
Submodule 'deps/libtuv' (https://github.com/DLTcollab/libtuv.git) registered for path 'deps/libtuv'
Cloning into '/root/dcurl/deps/libtuv'...
Submodule path 'deps/libtuv': checked out '3177b57937056ab5255adc4ad338d5e4ee844eab'
CC build/curl.o
CC build/constants.o
CC build/trinary.o
CC build/dcurl.o
CC build/implcontext.o
CC build/common.o
CC build/pow_c.o
CC build/pow_fpga_accel.o
make -C deps/libtuv TUV_BUILD_TYPE=release TUV_CREATE_PIC_LIB=yes
make[1]: Entering directory '/root/dcurl/deps/libtuv'
mkdir -p ./build/armv7l-linux/release/cmake
cmake -B./build/armv7l-linux/release/cmake -H./ -DCMAKE_TOOLCHAIN_FILE=./cmake/config/config_armv7l-linux.cmake -DCMAKE_BUILD_TYPE=release -DTARGET_PLATFORM=armv7l-linux -DBUILDTESTER=yes -DBUILD_HOST_HELPER=no -DCREATE_SHARED_LIB=no -DCREATE_PIC_LIB=yes -DTUV_FEATURE_PROCESS=ON
CMake Error at /usr/share/cmake-3.7/Modules/CMakeDetermineSystem.cmake:94 (message):
Could not find toolchain file: ./cmake/config/config_armv7l-linux.cmake
Call Stack (most recent call first):
CMakeLists.txt:16 (project)
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!
Makefile:63: recipe for target 'all' failed
make[1]: *** [all] Error 1
make[1]: Leaving directory '/root/dcurl/deps/libtuv'
mk/submodule.mk:23: recipe for target 'deps/libtuv/build/armv7l-linux/release/lib/libtuv.o' failed
make: *** [deps/libtuv/build/armv7l-linux/release/lib/libtuv.o] Error 2
On ARM64 machines, I encountered similar problem:
$ make
make -C deps/libtuv TUV_BUILD_TYPE=release TUV_CREATE_PIC_LIB=yes
make[1]: Entering directory '/home/ubuntu/dcurl/deps/libtuv'
mkdir -p ./build/aarch64-linux/release/cmake
cmake -B./build/aarch64-linux/release/cmake -H./ -DCMAKE_TOOLCHAIN_FILE=./cmake/config/config_aarch64-linux.cmake -DCMAKE_BUILD_TYPE=release -DTARGET_PLATFORM=aarch64-linux -DBUILDTESTER=yes -DBUILD_HOST_HELPER=no -DCREATE_SHARED_LIB=no -DCREATE_PIC_LIB=yes -DTUV_FEATURE_PROCESS=ON
CMake Error at /usr/share/cmake-3.10/Modules/CMakeDetermineSystem.cmake:100 (message):
Could not find toolchain file: ./cmake/config/config_aarch64-linux.cmake
Call Stack (most recent call first):
CMakeLists.txt:16 (project)
@marktwtn, We might have to put pre-configured cmake options in directory libtuv/cmake/option/
, otherwise generic armv7l (such as Raspberry Pi 2/3) and aarch64 (I'm using Cavium ThunderX; ARMv8-A) targets could not get compiled.
After providing two files, I got dcurl
built on aarch64 target.
- File
libtuv/cmake/option/option_arm-linux.cmake
:
include("cmake/option/option_unix_common.cmake")
include("cmake/option/option_linux_common.cmake")
- File
libtuv/cmake/config/config_aarch64-linux.cmake
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR arm64)
set(CMAKE_C_COMPILER aarch64-linux-gnu-gcc)
The error is caused by the hardware platform mismatching of libtuv
used in dcurl
since the way of detecting hardware platform is quite simple.
Here is the modification needs to be done:
dcurl modification
- Detect and classify the hardware platform of
arm
andaarch64
correctly.
libutv modification
- Support more boards of
arm
-Linux
combination. It only supportsRPi2
now. - Add the cmake files of
aarch64
.
After providing two files, I got
dcurl
built on aarch64 target.* File `libtuv/cmake/option/option_arm-linux.cmake`:
Did you mean the file option_aarch64-linux.cmake
?
After providing two files, I got
dcurl
built on aarch64 target.* File `libtuv/cmake/option/option_arm-linux.cmake`:
Did you mean the file
option_aarch64-linux.cmake
?
Exactly. We can simply enable arm/aarch64 build first, that is crucial for us to prepare new releases. Then, we might contribute back to libtuv
upstream.
Take the RPi2
with arm
-Linux
as example.
It would add the flags in libtuv/cmake/option/option_arm-linux.cmake
:
-mcpu=cortex-a7
-mfloat-abi=hard
-mfpu=neon-vfpv4
If we want to support de10 nano
, there are two methods:
- Support all the boards of
arm
32-bit CPU structure without adding the extra C flags likeRPi2
.
However, it might have the risk of getting a executable or library which is not optimized or can not be executed. - Support
de10 nano
only by specifying the target board and add the extra C flags like:
-mcpu=cortex-a9
With this method, we have to assign the target board when building thedcurl
.
We don't have to tune board-specific options since the computing is taking place in FPGA rather than Arm side.
Sorry for my misunderstanding of the original problem.
The issue will focus on building the dcurl
with FPGA
enabled only.
No CPU
and libtuv
related code will be built together.
And I will open another issue for making dcurl
built on aarch64
platform as well.