Open ebilgi opened 2 years ago
Unfortunately I cannot guide you, as I don't have much experience cross-compiling C/C++ code. However, I recommend you look into how cmake can help you here; if cmake can do it, it should work here.
Not sure that if you still consider how to build libsocket with cross compiler. Here is the way how i build the library for beaglebone board and hope that it can help you:
Step 1: Create a toolchain file to specifies the cross-compiler - i name it: 'beaglebone.toolchain.cmake' (locate the file in the same place with CMakeLists.txt file), file's content:
# Set the cross-compiler and toolchain file for BeagleBone Black
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_C_COMPILER /home/mhle/Learning/BBB/toolchain/gcc-linaro-6.5.0-2018.12-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc)
set(CMAKE_CXX_COMPILER /home/mhle/Learning/BBB/toolchain/gcc-linaro-6.5.0-2018.12-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-g++)
set(CMAKE_FIND_ROOT_PATH /home/mhle/Learning/BBB/toolchain/gcc-linaro-6.5.0-2018.12-x86_64_arm-linux-gnueabihf)
Step 2: perform build:
$ mkdir build && cd build
$ cmake -DCMAKE_TOOLCHAIN_FILE=beaglebone.toolchain.cmake ..
$ make # or make install
From your side, you can find and download cross-toolchain of your machine. Then modify the correct path on the file that i suggest and perform build. Hope that it can help you!
Dear All, I wonder about cross compilation. I know that with cross compilation I export the toolchains to the shall. Makefiles generally have some clues about CC or CROSS_COMPILATION. I have not compiled for cross platform. Could you guide me ? Thank you for your time, Best Regards