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
110
Trophies
0
Age
29
Location
SP, Brazil
XP
583
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:
    Elite Beat Agents
  • mthrnite @ mthrnite:
    hell yeah
  • SylverReZ @ SylverReZ:
    @mthrnite, Cheetah Girls, the sequel to Action 52's Cheetah Men.
    +2
  • Psionic Roshambo @ Psionic Roshambo:
    Pokemon Black I played that one a lot
  • K3Nv2 @ K3Nv2:
    Honestly never messed with Pokémon on ds much
  • mthrnite @ mthrnite:
    I played pokemon once, was bored, never tried again
  • Psionic Roshambo @ Psionic Roshambo:
    Oh Dragon Quest IX
  • K3Nv2 @ K3Nv2:
    Spent like 5 hours on switch one never touched it again
  • Psionic Roshambo @ Psionic Roshambo:
    Sentinel of the stary skies
  • K3Nv2 @ K3Nv2:
    Ds is 20 years old this year
  • Psionic Roshambo @ Psionic Roshambo:
    So MJ no longer wants to play with it?
  • K3Nv2 @ K3Nv2:
    He put it down when the 3ds came out
  • SylverReZ @ SylverReZ:
    @K3Nv2, RIP Felix does great videos on the PS3 yellow-light-of-death.
  • Jayro @ Jayro:
    Eventhough the New 3DS XL is more powerful, I still feel like the DS Lite was a more polished system. It's a real shame that it never got an XL variant keeping the GBA slot. You'd have to go on AliExpress and buy an ML shell to give a DS phat the unofficial "DS Lite" treatment, and that's the best we'll ever get I'm afraid.
    +1
  • Jayro @ Jayro:
    The phat model had amazingly loud speakers tho.
    +1
  • SylverReZ @ SylverReZ:
    @Jayro, I don't see whats so special about the DS ML, its just a DS lite in a phat shell. At least the phat model had louder speakers, whereas the lite has a much better screen.
    +1
  • SylverReZ @ SylverReZ:
    They probably said "Hey, why not we combine the two together and make a 'new' DS to sell".
  • Veho @ Veho:
    It's a DS Lite in a slightly bigger DS Lite shell.
    +1
  • Veho @ Veho:
    It's not a Nintendo / iQue official product, it's a 3rd party custom.
    +1
  • Veho @ Veho:
    Nothing special about it other than it's more comfortable than the Lite
    for people with beefy hands.
    +1
  • Jayro @ Jayro:
    I have yaoi anime hands, very lorge but slender.
  • Jayro @ Jayro:
    I'm Slenderman.
    Jayro @ Jayro: I'm Slenderman.