Skip to content

PRX builds using psp-cmake fail with _exit linker error and missing exports.exp #309

@santiago046

Description

@santiago046

When compiling any PRX project using psp-cmake, the build fails with a missing _exit symbol during linking. In addition, if the .exp file is not manually copied to the build directory, the generation of exports.c fails due to Could not open file exports.exp.

Steps to Reproduce

  1. Clone pspsdk
git clone https://github.com/pspdev/pspsdk/
  1. Create any minimal PRX project (e.g., in pspsdk/src/samples/prx/testprx) with the following CMakeLists.txt:
cmake_minimum_required(VERSION 3.11)

project(testprx C)

add_prx_module(${PROJECT_NAME}
    main.c
    exports.exp
)

install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.prx DESTINATION .)
  1. Run:
cd pspsdk/src/samples/prx/testprx
psp-cmake -Bbuild
cmake --build build

Output

[ 25%] Generating exports.c from exports.exp for target testprx
Could not open file exports.exp
[ 50%] Building C object CMakeFiles/testprx.dir/main.c.obj
[ 75%] Building C object CMakeFiles/testprx.dir/exports.c.obj
[100%] Linking C executable testprx
/root/pspdev/bin/../lib/gcc/psp/.../ld: warning: cannot find entry symbol module_start; defaulting to 00000000
/root/pspdev/bin/../lib/gcc/psp/15.1.1/../../../../psp/bin/ld: /root/pspdev/psp/lib/libc.a(libc_a-abort.o): in function `abort':
/home/runner/work/pspdev/pspdev/build/psptoolchain/build/psptoolchain-allegrex/build/newlib/build-psp/psp/newlib/../../../newlib/libc/stdlib/abort.c:59:(.text+0x10): undefined reference to `_exit'
collect2: error: ld returned 1 exit status

Note: copying exports.exp to the build directory, or specifing the absolute path to it, fixes Could not open file exports.exp.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions