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
  • K3Nv2 @ K3Nv2:
    This is how I want to bone but it's my views that I know are right
    +1
  • AncientBoi @ AncientBoi:
    👈 [belongs to one]
    +2
  • K3Nv2 @ K3Nv2:
    I wish people that think they're right about everything didn't exist half the time
  • AncientBoi @ AncientBoi:
    Such as you?
  • K3Nv2 @ K3Nv2:
    That's your way of thinking
  • BigOnYa @ BigOnYa:
    I bet it be tough finding a job, if you were a nudist.
  • AncientBoi @ AncientBoi:
    or vice versa
  • K3Nv2 @ K3Nv2:
    Nah it's easy all they gotta do is blow long breaths of air
  • BigOnYa @ BigOnYa:
    Confronts a nudist "Why be a nudist?" "I'm not a nudist you dick, I'm homeless and poor."
    +1
  • AncientBoi @ AncientBoi:
    I'm also saving 💰 . You know how much it is to just wash your clothes? pffffft
    +1
  • K3Nv2 @ K3Nv2:
    I saved 1k this month by being poor tbh
    +1
  • BigOnYa @ BigOnYa:
    Been eating Ramen all month, but my PC is badass!
    +1
  • K3Nv2 @ K3Nv2:
    Ramen still delicious don't care how much money I'll have
    +1
  • Minox @ Minox:
    I'm eating less, but mostly because I'm trying to avoid getting called heavy again during this year's health exam
    +1
  • Minox @ Minox:
    There's only so many ways they can say "You're fat by our country's standards"
    +1
  • K3Nv2 @ K3Nv2:
    My cholesterol was almost 350 so really stopped going out lol
  • AncientBoi @ AncientBoi:
    [uploads some 🐟 for you] :D @Minox
  • Minox @ Minox:
    I'll stick with my kimchi thank you
  • K3Nv2 @ K3Nv2:
    Triglycerides almost 900
  • Minox @ Minox:
    No idea what any of those things you mention are
    +1
  • K3Nv2 @ K3Nv2:
    Cholesterol and Triglycerides? Basically a way they measure fatty cells in your blood
  • AncientBoi @ AncientBoi:
    Cholesterol is sorta high, according to my doc
  • K3Nv2 @ K3Nv2:
    I've been taking fiber pills, eating more grapes, switched to wheat bread in hopes to lower it
    K3Nv2 @ K3Nv2: I've been taking fiber pills, eating more grapes, switched to wheat bread in hopes to lower it