memory: cross compiling for QNX segfaults
When cross compile master on QNX, I get a segmentation fault from container_node_sizes_impl.hpp
CMake command with toolchain: qnx_toolchain.zip
cmake .. -DCMAKE_TOOLCHAIN_FILE=~/Downloads/qnx_toolchain.cmake -DCMAKE_INSTALL_PREFIX=/home/brian/qnx700/target/qnx7/x86/usr/local -DCMAKE_BUILD_TYPE=Release -DCMAKE_VERBOSE_MAKEFILE=ON -DFOONATHAN_MEMORY_BUILD_EXAMPLES=OFF -DFOONATHAN_MEMORY_BUILD_TESTS=OFF -DFOONATHAN_MEMORY_BUILD_TOOLS=ON
Output:
[ 13%] Generating container_node_sizes_impl.hpp cd /home/brian/Downloads/foonathan_memory/build/src && ../tool/nodesize_dbg --code --alignof "FOONATHAN_ALIGNOF(T)" /home/brian/Downloads/foonathan_memory/build/src/container_node_sizes_impl.hpp Segmentation fault (core dumped) src/CMakeFiles/foonathan_memory.dir/build.make:64: recipe for target 'src/container_node_sizes_impl.hpp' failed make[2]: *** [src/container_node_sizes_impl.hpp] Error 139 make[2]: Leaving directory '/home/brian/Downloads/foonathan_memory/build' CMakeFiles/Makefile2:88: recipe for target 'src/CMakeFiles/foonathan_memory.dir/all' failed make[1]: *** [src/CMakeFiles/foonathan_memory.dir/all] Error 2 make[1]: Leaving directory '/home/brian/Downloads/foonathan_memory/build' Makefile:132: recipe for target 'all' failed make: *** [all] Error 2
build_output.txt
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 24 (17 by maintainers)
Commits related to this issue
- Disable node size debugger when cross compiling without emulator (#78) Fixes #72. — committed to foonathan/memory by razr 4 years ago
- Improve memory_resource detection Also fixes issues with older GCC, see https://github.com/foonathan/memory/issues/72#issuecomment-636134224. — committed to foonathan/memory by foonathan 4 years ago
- Fix compilation errors if node sizes aren't available See #72: https://github.com/foonathan/memory/issues/72#issuecomment-636140321. — committed to foonathan/memory by foonathan 4 years ago
- Improve memory_resource detection Also fixes issues with older GCC, see #72: https://github.com/foonathan/memory/issues/72#issuecomment-636134224. — committed to foonathan/memory by foonathan 4 years ago
- Fix compilation errors if node sizes aren't available See #72: https://github.com/foonathan/memory/issues/72#issuecomment-636140321. — committed to foonathan/memory by foonathan 4 years ago
in case anybody else stumbles across this issue in future with the same problem:
let’s look at the build as a 3-step process.
tool/nodesize_dbg
,include/foonathan/memory/detail/container_node_sizes_impl.hpp
headerfile,when cross-compiling, step 2 will fail, as it is attempting to run the nodesize_dbg binary (built for the target system) on the host system rather than the target.
the simplest workaround for this is the following:
(i’m sure there’s a cleaner way to do it, but this approach works well enough for a one-off build)
(p.s.: if you instead changed up the cmake files to build nodesize_dbg for the host, allowing it to run successfully, the information it would gather from the host system is likely significantly different from the target environment. this would cause the build to succeed but likely lead to runtime errors in any applications linked against the library, so we don’t want to do this.)