Error when compiling libNDS rom

thehedge

New Member
OP
Newbie
Joined
Apr 1, 2024
Messages
4
Trophies
0
XP
9
Country
Ireland
Hello, this is my first post on the forums. I'm trying to compile a "Hello world" example in libnds using C, but I get this error:

* Executing task: /opt/devkitpro/devkitARM/bin/arm-none-eabi-gcc -fdiagnostics-color=always -g -I/opt/devkitpro/libnds/include -I/opt/devkitpro/libnds/include/nds '/home/hedgerobo/Documents/VSCode Projects/Crit DS/src/main.c' -o '/home/hedgerobo/Documents/VSCode Projects/Crit DS/src/main' -L/opt/devkitpro/libnds/lib -lnds9 -lnds9d -lc -specs=nosys.specs

/opt/devkitpro/devkitARM/bin/../lib/gcc/arm-none-eabi/13.2.0/../../../../arm-none-eabi/bin/ld: warning: cannot find entry symbol _start; defaulting to 00008020
/opt/devkitpro/devkitARM/bin/../lib/gcc/arm-none-eabi/13.2.0/../../../../arm-none-eabi/bin/ld: warning: /home/hedgerobo/Documents/VSCode Projects/Crit DS/src/main has a LOAD segment with RWX permissions
/opt/devkitpro/devkitARM/bin/../lib/gcc/arm-none-eabi/13.2.0/../../../../arm-none-eabi/bin/ld: /opt/devkitpro/libnds/lib/libnds9.a(interrupts.o): in function `irqInitHandler':
/home/davem/projects/devkitpro/pacman-packages/libnds/src/libnds-1.8.2/arm9/../source/common/interrupts.c:125:(.text.irqInitHandler+0x24): undefined reference to `__irq_vector'
/opt/devkitpro/devkitARM/bin/../lib/gcc/arm-none-eabi/13.2.0/../../../../arm-none-eabi/bin/ld: /opt/devkitpro/libnds/lib/libnds9.a(interrupts.o): in function `irqInit':
/home/davem/projects/devkitpro/pacman-packages/libnds/src/libnds-1.8.2/arm9/../source/common/interrupts.c:148:(.text.irqInit+0x44): undefined reference to `__irq_vector'
/opt/devkitpro/devkitARM/bin/../lib/gcc/arm-none-eabi/13.2.0/../../../../arm-none-eabi/bin/ld: /opt/devkitpro/libnds/lib/libnds9.a(interruptDispatcher.o): in function `IntrRet':
/home/davem/projects/devkitpro/pacman-packages/libnds/src/libnds-1.8.2/arm9/../source/common/interruptDispatcher.s:55:(.itcm+0xc4): undefined reference to `__irq_flags'
/opt/devkitpro/devkitARM/bin/../lib/gcc/arm-none-eabi/13.2.0/../../../../arm-none-eabi/bin/ld: /opt/devkitpro/libnds/lib/libnds9.a(mpu_setup.o): in function `setregions':
/home/davem/projects/devkitpro/pacman-packages/libnds/src/libnds-1.8.2/arm9/../source/arm9/system/mpu_setup.s:37:(.text.__libnds_mpu_setup+0x128): undefined reference to `__dtcm_start'
/opt/devkitpro/devkitARM/bin/../lib/gcc/arm-none-eabi/13.2.0/../../../../arm-none-eabi/bin/ld: /home/davem/projects/devkitpro/pacman-packages/libnds/src/libnds-1.8.2/arm9/../source/arm9/system/mpu_setup.s:76:(.text.__libnds_mpu_setup+0x134): undefined reference to `__itcm_start'
collect2: error: ld returned 1 exit status

* The terminal process "/usr/bin/bash '-c', '/opt/devkitpro/devkitARM/bin/arm-none-eabi-gcc -fdiagnostics-color=always -g -I/opt/devkitpro/libnds/include -I/opt/devkitpro/libnds/include/nds '/home/hedgerobo/Documents/VSCode Projects/Crit DS/src/main.c' -o '/home/hedgerobo/Documents/VSCode Projects/Crit DS/src/main' -L/opt/devkitpro/libnds/lib -lnds9 -lnds9d -lc -specs=nosys.specs'" terminated with exit code: 1.
* Terminal will be reused by tasks, press any key to close it.

If anyone can help that would be appreciated. thanks
 

mrparrot2

Well-Known Member
Member
Joined
Nov 29, 2021
Messages
106
Trophies
0
Age
29
Location
SP, Brazil
XP
566
Country
Brazil
Those are linking errors, which means the linker (in this case the program 'ld') was not able to find some required file needed to finish the linking process. For example, the routine '_start' is the first function executed by the program and has the task of seting up the environment (initialize memory stuff, etc) before calling 'main'.

Most likely your devkitpro instalation has missing files. Reinstall It.
 

thehedge

New Member
OP
Newbie
Joined
Apr 1, 2024
Messages
4
Trophies
0
XP
9
Country
Ireland
What kind of build system are you using? Their native makefiles or their CMake wrapper? Cause that bit -L/opt/devkitpro/libnds/lib -lnds9 -lnds9d -lc -specs=nosys.specs seems a bit weird to me, if I'm not mistaken, nosys.specs aren't the correct specs file. If you perhaps are trying to build by yourself, using a custom system of sorts, be sure to read the sequence of commands executed by the provided makefiles, once you get the grip of it you won't need to use them if that's your stuff.
I'm using a tasks.json, because VSCode is my code editor.

{
"version": "2.0.0",
"tasks": [
{
"label": "Compile Nintendo DS Project",
"type": "shell",
"command": "/opt/devkitpro/devkitARM/bin/arm-none-eabi-gcc",
"args": [
"-fdiagnostics-color=always",
"-g",
"-I/opt/devkitpro/libnds/include",
"-I/opt/devkitpro/libnds/include/nds",
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}",
"-L/opt/devkitpro/libnds/lib",
"-lnds9",
"-lnds9d",
"-lc",
"-specs=nosys.specs"
],
"group": "build",
"presentation": {
"reveal": "silent",
"panel": "shared"
},
"problemMatcher": {
"owner": "cpp",
"fileLocation": [
"absolute"
],
"pattern": {
"regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5
}
}
},
{
"type": "cppbuild",
"label": "C/C++: arm-none-eabi-gcc build active file",
"command": "/opt/devkitpro/devkitarm/bin/arm-none-eabi-gcc",
"args": [
"-fdiagnostics-color=always",
"-g",
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "Task generated by Debugger."
}
]
}
 

thehedge

New Member
OP
Newbie
Joined
Apr 1, 2024
Messages
4
Trophies
0
XP
9
Country
Ireland
I got the Makefile from the link you sent and I modified the devkitARM path to the one I have installed, then I modified my tasks.json to run the Makefile, but I got this output in the terminal.

* Executing task: make -f Makefile.makefile

basename: extra operand ‘DS’
Try 'basename --help' for more information.
make[1]: /home/hedgerobo/Documents/VSCode: No such file or directory
make[1]: *** No rule to make target '/home/hedgerobo/Documents/VSCode'. Stop.
make: *** [Makefile.makefile:94: build] Error 2

* The terminal process "/usr/bin/bash '-c', 'make -f Makefile.makefile'" failed to launch (exit code: 2).
* Terminal will be reused by tasks, press any key to close it.
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    Psionic Roshambo @ Psionic Roshambo: 24,000 hmmmm lol