Skip to content

Commit 9c8dcad

Browse files
committed
fix(simulator): build v4l2_capture as position-independent code
kern_simulator links with -pie, but the v4l2_capture static library was compiled without -fPIC. On toolchains where GCC is not configured with --enable-default-pie (e.g. Fedora 44), linking with -DSIM_WEBCAM=ON fails: relocation R_X86_64_32 against `.rodata` can not be used when making a PIE object; recompile with -fPIE A static archive is linked object-by-object into the executable, so its relocations must be compatible with a PIR output. The lvgl and wally targets already set POSITION_INDEPENDENT_CODE; v4l2_capture was added later and did not. On Debian/Ubuntu the objects were position independent by compiler default, which masked the problem. Simulator-only change: it does not touch any device code path.
1 parent 23ca1f3 commit 9c8dcad

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

simulator/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,7 @@ if(SIM_WEBCAM)
252252
${CMAKE_CURRENT_SOURCE_DIR}/platform/video_sim/v4l2_capture.c
253253
)
254254
endif()
255+
set_target_properties(v4l2_capture PROPERTIES POSITION_INDEPENDENT_CODE ON)
255256
target_include_directories(v4l2_capture PRIVATE
256257
${CMAKE_CURRENT_SOURCE_DIR}/platform/video_sim/include
257258
${CMAKE_CURRENT_SOURCE_DIR}/platform/video_sim

0 commit comments

Comments
 (0)