For_Ward
(For Ward)
May 13, 2025, 11:27pm
1
Hello,
I am using cmake but ELDK is not available it seems. I am trying to cross compile via cmake from WSL2 Debian Bookworm to an armhf machine. It is a single core machine that needs the build.
So far, this is what I have going…
cmake_minimum_required(VERSION 3.25)
project(BeagleCPP)
# find_package(PTHREADS REQUIRED)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_C_COMPILER /usr/bin/arm-linux-gnueabihf-gcc)
set(CMAKE_CXX_COMPILER /usr/bin/arm-linux-gnueabihf-g++)
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH ~/BeagleCPP/)
include_directories(include)
file(GLOB SOURCES "src/*.cpp")
add_executable(BeagleCPP ${SOURCES})
But here, https://cmake.org/cmake/help/book/mastering-cmake/chapter/Cross%20Compiling%20With%20CMake.html , is where I find that ELDK is needed to port to armhf architecture type machines.
32-bit and older but I wanted to test on this machine via cross_compilation before proceeding to arm64/aarch64.
I am not quite sure I understand the basis for having ELDK in the docs. when it is not available…
Or…I am missing the boat. Either way, I have tried with a cross-compiler listed from a Debian repo to no avail.
Seth
P.S. Please send some guidance or ideas.
hsattler
(Hendrik Sattler)
May 14, 2025, 8:20am
2
That’s the bad thing about examples: some people take them literally.
But read all words of the sentence:
" Assuming your target environment is installed under /opt/eldk/ppc_74xx
[…]"
You obviously use another target environment.
1 Like
For_Ward
(For Ward)
May 15, 2025, 1:48am
3
build CMakeLists.txt include src
are the files in my repo I am using…
build
: of course is the build dir.
CMakeLists.txt
: is of course my build file.
include
: are all my .h files.
src
: is all the .cpp files I will be cross_compiling.
I understand about the example now. Since the inception of the build with cmake
, I have learned some new ideas and build rules.
include_directories(include)
file(GLOB SOURCES "src/*.cpp")
add_executable(BeagleCPP ${SOURCES})
At least, does this work with the files in src
and include
for now?
It would build to 100% and then error out at the last second of the build compilation.
Also, would I need to grab a copy of debian (armhf) and then mount
the extracted .iso file to /tmp/
or '/mnt/` and go from that point forward. I am seemingly having a difficult time now trying to summarize so far.
The build is still a WIP and it would be easier on me if I just use the armhf machine but that is not the way I should do it. I say that because cross_compiling is faster and once I can rinse and repeat
, it would be an easy task.
Now, with all that typed out, I took out:
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
I also added the cross_compiler:
set(CMAKE_CROSS_COMPILER /usr/bin/arm-linux-gnueabihf-)
Seth
For_Ward
(For Ward)
May 17, 2025, 9:14am
4
I think my query is with the cross_compiler now and not cmake. Thank you for the time on this site so far.