pspdev / pspdev/pspsdk

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

Open
#309 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
1.2k
Forks
183
Avg merge
1d 8h
Merged PRs (30d)
5

Description

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure from pspsdk/src/samples/prx/testprx using the shown CMakeLists.txt and the psp-cmake build commands. Inspect how add_prx_module handles exports.exp and the PRX link configuration; done means the project builds without copying exports.exp and without the undefined _exit linker error.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, cmake
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.