Page 1 of 1

Cmake toolchains fail to compile library.

Posted: Fri Feb 15, 2019 1:06 am
by oreo639
This issue was first brought up in the pacman-packages repo, since it affects building the packages there, however I was told to move to here.
For refrence:
https://github.com/devkitPro/pacman-packages/issues/60
https://github.com/devkitPro/pacman-packages/pull/41

The issue is that, in the cmake toolchain file, the line

Code: Select all

set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -specs=3dsx.specs")
causes cmake to fail with the following undefined refrences: (note wildmidi is used as an example however, it affects all cmake applications for the 3ds)

Code: Select all

CMake Error at /usr/share/cmake-3.13/Modules/CMakeTestCCompiler.cmake:52 (message):
  The C compiler

    "/opt/devkitpro/devkitARM/bin/arm-none-eabi-gcc"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: /home/oreo639/git/pacman-packages/3ds/WildMidi/src/wildmidi-wildmidi-0.4.3/CMakeFiles/CMakeTmp
    
    Run Build Command:"/usr/bin/make" "cmTC_52c20/fast"
    /usr/bin/make -f CMakeFiles/cmTC_52c20.dir/build.make CMakeFiles/cmTC_52c20.dir/build
    make[1]: Entering directory '/home/oreo639/git/pacman-packages/3ds/WildMidi/src/wildmidi-wildmidi-0.4.3/CMakeFiles/CMakeTmp'
    Building C object CMakeFiles/cmTC_52c20.dir/testCCompiler.c.obj
    /opt/devkitpro/devkitARM/bin/arm-none-eabi-gcc   -march=armv6k -mtune=mpcore -mfloat-abi=hard -mtp=soft -O2 -mword-relocations -ffunction-sections -fdata-sections -D_3DS -I/opt/devkitpro/portlibs/3ds/include -I/opt/devkitpro/libctru/include    -o CMakeFiles/cmTC_52c20.dir/testCCompiler.c.obj   -c /home/oreo639/git/pacman-packages/3ds/WildMidi/src/wildmidi-wildmidi-0.4.3/CMakeFiles/CMakeTmp/testCCompiler.c
    Linking C executable cmTC_52c20
    /usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_52c20.dir/link.txt --verbose=1
    /opt/devkitpro/devkitARM/bin/arm-none-eabi-gcc -march=armv6k -mtune=mpcore -mfloat-abi=hard -mtp=soft -O2 -mword-relocations -ffunction-sections -fdata-sections -D_3DS -I/opt/devkitpro/portlibs/3ds/include -I/opt/devkitpro/libctru/include    -specs=3dsx.specs  CMakeFiles/cmTC_52c20.dir/testCCompiler.c.obj  -o cmTC_52c20 
    /opt/devkitpro/devkitARM/lib/gcc/arm-none-eabi/8.2.0/../../../../arm-none-eabi/bin/ld: /opt/devkitpro/devkitARM/lib/gcc/arm-none-eabi/8.2.0/../../../../arm-none-eabi/lib/armv6k/fpu/3dsx_crt0.o: in function `startup':
    (.crt0+0x38): undefined reference to `initSystem'
    /opt/devkitpro/devkitARM/lib/gcc/arm-none-eabi/8.2.0/../../../../arm-none-eabi/bin/ld: /opt/devkitpro/devkitARM/lib/gcc/arm-none-eabi/8.2.0/../../../../arm-none-eabi/lib/armv6k/fpu/3dsx_crt0.o: in function `ClrLoop':
    (.crt0+0x84): undefined reference to `__system_argc'
    /opt/devkitpro/devkitARM/lib/gcc/arm-none-eabi/8.2.0/../../../../arm-none-eabi/bin/ld: (.crt0+0x88): undefined reference to `__system_argv'
    /opt/devkitpro/devkitARM/lib/gcc/arm-none-eabi/8.2.0/../../../../arm-none-eabi/bin/ld: (.crt0+0x90): undefined reference to `__ctru_exit'
    collect2: error: ld returned 1 exit status
    make[1]: *** [CMakeFiles/cmTC_52c20.dir/build.make:87: cmTC_52c20] Error 1
    make[1]: Leaving directory '/home/oreo639/git/pacman-packages/3ds/WildMidi/src/wildmidi-wildmidi-0.4.3/CMakeFiles/CMakeTmp'
    make: *** [Makefile:121: cmTC_52c20/fast] Error 2
The packages were able to build if I either removed the line entirely, or included libctru, the library that they are defined in.
I expirenced this issue on 3 systems, two with voidlinux, and one with lubuntu, however wintermute says neither him or the builders run into that issue.
So my question is, is libctru supposed to be pulled automaticaly when building libraries for the 3ds?
If not, are they defined elsewhere?