Comments (5)
Does this cmake invocation usually work? Can you cross-compile other projects successfully with those options?
from jsoncpp.
I appreciate your response. However, I usually avoid cmake, so I cannot adequately answer your question. But I've tried
passing some of these cross-compilation flags directly and also by creating
and passing a toolchain file.
https://cmake.org/cmake/help/book/mastering-cmake/chapter/Cross%20Compiling%20With%20CMake.html
Here's my aarch-toochain.cmake file
# aarch64-toolchain.cmake
# Set the target system name
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR aarch64)
# Set the cross compilers
set(bin_path /usr/bin)
set(CMAKE_C_COMPILER ${bin_path}/aarch64-linux-gnu-gcc)
set(CMAKE_CXX_COMPILER ${bin_path}/aarch64-linux-gnu-g++)
# Set the target architecture
set(CMAKE_SYSTEM_PROCESSOR aarch64)
here's my cmake .. -DCMAKE_TOOLCHAIN_FILE=../aarch-toolchain.cmake
output
-- The CXX compiler identification is GNU 11.4.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/aarch64-linux-gnu-g++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- JsonCpp Version: 00.11.0
-- Compiled with C++11(or newer) standard!
-- Looking for C++ include clocale
-- Looking for C++ include clocale - found
-- Looking for localeconv
-- Looking for localeconv - found
-- Looking for C++ include sys/types.h
-- Looking for C++ include sys/types.h - found
-- Looking for C++ include stdint.h
-- Looking for C++ include stdint.h - found
-- Looking for C++ include stddef.h
-- Looking for C++ include stddef.h - found
-- Check size of lconv
-- Check size of lconv - done
-- Performing Test HAVE_DECIMAL_POINT
-- Performing Test HAVE_DECIMAL_POINT - Success
-- Found Python3: /usr/bin/python3.10 (found version "3.10.12") found components: Interpreter
-- Configuring done
-- Generating done
-- Build files have been written to: /home/derrekito/Downloads/jsoncpp/build
It seems to skip looking at CXX processor, which makes me think this has something to do with the project defaulting to my host compiler.
from jsoncpp.
I don't know cmake very well.
This line is very suspicious:
-- Check for working CXX compiler: /usr/bin/aarch64-linux-gnu-g++ - skipped
There's sometimes a config log you can look at to see deeper diagnostics?
Maybe someone else with more cmake experience can chime in?
from jsoncpp.
My CMakeCache.txt seems to suggest that CMAKE is recognizing the cross-compile args, but isn't actually producing a cross-compiled object.
cat CMakeCache.txt | grep aarch64
CMAKE_ADDR2LINE:FILEPATH=/usr/bin/aarch64-linux-gnu-addr2line
CMAKE_AR:FILEPATH=/usr/bin/aarch64-linux-gnu-ar
CMAKE_CXX_COMPILER_AR:FILEPATH=/usr/bin/aarch64-linux-gnu-gcc-ar-11
CMAKE_CXX_COMPILER_RANLIB:FILEPATH=/usr/bin/aarch64-linux-gnu-gcc-ranlib-11
CMAKE_LINKER:FILEPATH=/usr/bin/aarch64-linux-gnu-ld
CMAKE_NM:FILEPATH=/usr/bin/aarch64-linux-gnu-nm
CMAKE_OBJCOPY:FILEPATH=/usr/bin/aarch64-linux-gnu-objcopy
CMAKE_OBJDUMP:FILEPATH=/usr/bin/aarch64-linux-gnu-objdump
CMAKE_RANLIB:FILEPATH=/usr/bin/aarch64-linux-gnu-ranlib
CMAKE_READELF:FILEPATH=/usr/bin/aarch64-linux-gnu-readelf
CMAKE_STRIP:FILEPATH=/usr/bin/aarch64-linux-gnu-strip
CMAKE_TOOLCHAIN_FILE:FILEPATH=/home/derrekito/Downloads/jsoncpp/aarch64-toolchain.cmake
from jsoncpp.
CMakeLists.txt is overriding the compiler settings. Commenting out the set(CMAKE_CXX_COMPILER "/usr/bin/g++")
line fixed my issue.
file lib/libjsoncpp.so.00.11.0
lib/libjsoncpp.so.00.11.0: ELF 64-bit LSB shared object, ARM aarch64, version 1 (SYSV), dynamically linked, BuildID[sha1]=c0f7bfaca719ab7e6a28dd6f21a382192cdebff2, not stripped
I'll edit the CMakeLists.txt to check for the flag before clobbering such settings.
if(NOT CMAKE_CXX_COMPILER)
set(CMAKE_CXX_COMPILER "/usr/bin/g++")
endif()
The only issue now is that tests fail when the compiled object isn't meant for the host system. Should I press with a pull request anyway??
from jsoncpp.
Related Issues (20)
- VS2022 x64, building INSTALL fails ( napi not found in Dependencies folder ) HOT 1
- Trailing comma before comment in array crashes
- LF to CRLF
- VS2013 debug build crashes compiler
- terminate called after throwing an instance of 'Json::LogicError'
- GDB pretty print support
- How to set both key and value pair as variable
- Tests write to source tree when invoked via CMake
- Undefined reference to things HOT 2
- Why are the branches of the if statement not implemented consistently?
- CMake 3.27 warns about compatibility with CMake <3.5 HOT 1
- Add a security policy
- I cannot figure out how to build this on MinGW32
- Failed to compile with C++23 HOT 6
- macOS 14.3.1 23D60 arm64 error
- how std::string and a Json::Value string convert, each other?
- add a runtime API for version information HOT 1
- If I am using the Centos6.5 linux system, which version is suitable for me to use ?
- Adding Values after call to clear() fails.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jsoncpp.