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
588
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
  • No one is chatting at the moment.
  • K3Nv2 @ K3Nv2:
    I've been taking fiber pills, eating more grapes, switched to wheat bread in hopes to lower it
    +1
  • BigOnYa @ BigOnYa:
    I like wheat bread, I even like the chunky wheat bread with pieces of whole grain in it.
  • K3Nv2 @ K3Nv2:
    Been getting this honey wheat bread from aldis pretty decent not very sweet to out do it
  • K3Nv2 @ K3Nv2:
    Me making any food at home is an improvement to how I use to be
    +1
  • BigOnYa @ BigOnYa:
    I have an bread machine and use it alot, better than breads you buy, but don't last as long, cause no bs preservatives
  • K3Nv2 @ K3Nv2:
    I got compliments about my weight loss and thought well guess I can pig out again now I'm the piggy
  • BigOnYa @ BigOnYa:
    My biggest prob is alcohol, definitely is fattening
  • K3Nv2 @ K3Nv2:
    I know when to stop at least honestly don't get those that go and go with food
  • BigOnYa @ BigOnYa:
    Or those that order 2 big macs , large fry, ice cream sundie, then a diet coke
  • K3Nv2 @ K3Nv2:
    I might get downing two big macs but nah that's it
  • BigOnYa @ BigOnYa:
    Ok that will be $15.99, cash or charge?
  • K3Nv2 @ K3Nv2:
    My go to orders usually a mcdouble and a mcchicken and I'm happy rarely mess with fries
  • K3Nv2 @ K3Nv2:
    Pro tip ask for that clowns jizzmac sauce on your mcdouble
    +1
  • BigOnYa @ BigOnYa:
    Do they charge extra when you add sauce,etc? I know burger king used to not, but don't know nowadays
  • K3Nv2 @ K3Nv2:
    They may squrit it for free if you ask nice
    +1
  • K3Nv2 @ K3Nv2:
    Last time I got bk it was 35c per sauce fuck you king of my nutsack
    +1
  • K3Nv2 @ K3Nv2:
    I'll buy a bottle of baby rays BBQ for $2 and add it from home out of spite
    +1
  • BigOnYa @ BigOnYa:
    I like baby rays, my favorite is KC masterpiece tho. Figured all you could buy is that there.
  • K3Nv2 @ K3Nv2:
    The metro doesn't discriminate good sauce
    +1
  • Psionic Roshambo @ Psionic Roshambo:
    Baby Rays isn't that what killed the crocodile hunter?
  • Psionic Roshambo @ Psionic Roshambo:
    If only he had done an endorsement for them....
  • Psionic Roshambo @ Psionic Roshambo:
    Oy mate don't let a bad bbq sauce kill your party! Baby Rays are killing it!! The flavor hits you right in the chest!
    +1
  • Xdqwerty @ Xdqwerty:
    My phone only has 13% battery so i don't have much time left
  • Xdqwerty @ Xdqwerty:
    Now 12%
  • BigOnYa @ BigOnYa:
    Happy birthday, btw
    BigOnYa @ BigOnYa: Happy birthday, btw