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
108
Trophies
0
Age
29
Location
SP, Brazil
XP
577
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
  • K3Nv2 @ K3Nv2:
    America's been hating it's own President since the Clinton days so it'll always be devided
    +1
  • mthrnite @ mthrnite:
    i hated reagan but i'm old as dirt so...
    +1
  • mthrnite @ mthrnite:
    it's hard out there for a centrist
    +1
  • mthrnite @ mthrnite:
    esp. since trump destroyed the gop
  • Psionic Roshambo @ Psionic Roshambo:
    Reagan gave us Star Wars lol
  • mthrnite @ mthrnite:
    i think the würm will turn eventually and we'll have a real choice again
  • Psionic Roshambo @ Psionic Roshambo:
    I hope so it would be nice to have someone that's not paid off by foreign interests
  • Psionic Roshambo @ Psionic Roshambo:
    Getting to be where they should wear jackets like NASCAR so you can visually identify who they are sponsored by lol
  • mthrnite @ mthrnite:
    just weed out the fuckin' loonies and i'd be happy... er.
  • Psionic Roshambo @ Psionic Roshambo:
    True that
  • Psionic Roshambo @ Psionic Roshambo:
    But power attracts narcissistic personalities
  • mthrnite @ mthrnite:
    i know romney or cheney doesn't have a chance in hell because of our voting system, if that could eventually change... wishful thinking i know
    +1
  • Psionic Roshambo @ Psionic Roshambo:
    Top to bottom from the president to the local mayor
  • Psionic Roshambo @ Psionic Roshambo:
    I know some people think that it's time to exorcise our revolutionary right but I hope not
  • Psionic Roshambo @ Psionic Roshambo:
    Those things are messy and lots of pain
  • mthrnite @ mthrnite:
    a house divided will not stand
  • mthrnite @ mthrnite:
    i think it was Lincoln or maybe grandma that said that
  • DinohScene @ DinohScene:
    it was you yourself who said it, 24 minutes ago
    +1
  • DinohScene @ DinohScene:
    making history my friend!
  • BakerMan @ BakerMan:
    iu

    ayo u eatin dis?
  • AncientBoi @ AncientBoi:
    Pfffffft I used to make dat :creep:
  • Xdqwerty @ Xdqwerty:
    Watching a movie
    +1
  • AncientBoi @ AncientBoi:
    which one?
    Xdqwerty @ Xdqwerty: @AncientBoi, https://en.wikipedia.org/wiki/Metegol +1