Homebrew Linking problem with devkitpro

Meziu210

New Member
OP
Newbie
Joined
Oct 23, 2020
Messages
3
Trophies
0
Age
18
XP
39
Country
Italy
So, i wanted to build srb2_3ds(can't leave link, I made the account for this post), but I'm having problems with the linking of the final .elf.
For some reasons, the linker recognizes the same header file twice(or at least this is the issue i think I'm having).
As you can see(the errors are hundreds, but basically all the same, and just replicas of 4 or 5 actually unique errors, that still are "double declaration" errors, so I'll just leave the last one):
Code:
/opt/devkitpro/devkitARM/bin/../lib/gcc/arm-none-eabi/10.2.0/../../../../arm-none-eabi/bin/ld: lua_thinkerlib.o:/home/andrea/Desktop/SRB2/srb2_3ds/source/doomtype.h:256: multiple definition of `ATTRPACK';
i_main.o:/home/andrea/Desktop/SRB2/srb2_3ds/source/nds/../doomtype.h:256: first defined here
collect2: error: ld returned 1 exit status
make[1]: *** [/opt/devkitpro/devkitARM/3ds_rules:42: /home/andrea/Desktop/SRB2/srb2_3ds/srb2_3ds.elf] Error 1
So, the "multiple definition" of ATTRPACK is on "srb2_3ds/source/doomtype.h:256", and the original declaration is on "srb2_3ds/source/nds/../doomtype.h:256", which is in fact the same exact file, at the same exact line, but the file is read twice. What could've I done wrong?
 

elhobbs

Well-Known Member
Member
Joined
Jul 28, 2008
Messages
1,044
Trophies
1
XP
3,030
Country
United States
So, i wanted to build srb2_3ds(can't leave link, I made the account for this post), but I'm having problems with the linking of the final .elf.
For some reasons, the linker recognizes the same header file twice(or at least this is the issue i think I'm having).
As you can see(the errors are hundreds, but basically all the same, and just replicas of 4 or 5 actually unique errors, that still are "double declaration" errors, so I'll just leave the last one):
Code:
/opt/devkitpro/devkitARM/bin/../lib/gcc/arm-none-eabi/10.2.0/../../../../arm-none-eabi/bin/ld: lua_thinkerlib.o:/home/andrea/Desktop/SRB2/srb2_3ds/source/doomtype.h:256: multiple definition of `ATTRPACK';
i_main.o:/home/andrea/Desktop/SRB2/srb2_3ds/source/nds/../doomtype.h:256: first defined here
collect2: error: ld returned 1 exit status
make[1]: *** [/opt/devkitpro/devkitARM/3ds_rules:42: /home/andrea/Desktop/SRB2/srb2_3ds/srb2_3ds.elf] Error 1
So, the "multiple definition" of ATTRPACK is on "srb2_3ds/source/doomtype.h:256", and the original declaration is on "srb2_3ds/source/nds/../doomtype.h:256", which is in fact the same exact file, at the same exact line, but the file is read twice. What could've I done wrong?
What is this? https://github.com/derrekr/srb2_3ds...d62fa5fbac6105315b57ea/source/doomtype.h#L256
 

Meziu210

New Member
OP
Newbie
Joined
Oct 23, 2020
Messages
3
Trophies
0
Age
18
XP
39
Country
Italy
What is this?
That's the correct Github repo. For the line: I don't really know since this game version is very outdated and i can't find the original source of that version. All i know is that doomtype.h is used for version automation and that the struct works differently in newer versions(in fact, I'm trying to compile it to then port it to latest, since the original 3ds porters didn't commit in 2 years). Still, I don't think searching in the source would solve the problem, since i quite made clear what the error is.

Edit:
I managed to just remove ATTRPACK from the struct declaration(it doesn't give any compiling problems, but maybe it won't run correctly). So now I basically have 2 other error messages:
Code:
/opt/devkitpro/devkitARM/bin/../lib/gcc/arm-none-eabi/10.2.0/../../../../arm-none-eabi/bin/ld: lua_thinkerlib.o:/home/andrea/Desktop/SRB2/srb2_3ds/source/doomdef.h:355: multiple definition of `savegamename'; 
i_main.o:/home/andrea/Desktop/SRB2/srb2_3ds/source/nds/../doomdef.h:355: first defined here
Code:
/opt/devkitpro/devkitARM/bin/../lib/gcc/arm-none-eabi/10.2.0/../../../../arm-none-eabi/bin/ld: lua_mobjlib.o:/home/andrea/Desktop/SRB2/srb2_3ds/source/doomstat.h:374: multiple definition of `ntemprecords'; 
d_main.o:/home/andrea/Desktop/SRB2/srb2_3ds/source/doomstat.h:374: first defined here
 
Last edited by Meziu210,

elhobbs

Well-Known Member
Member
Joined
Jul 28, 2008
Messages
1,044
Trophies
1
XP
3,030
Country
United States
That's the correct Github repo. For the line: I don't really know since this game version is very outdated and i can't find the original source of that version. All i know is that doomtype.h is used for version automation and that the struct works differently in newer versions(in fact, I'm trying to compile it to then port it to latest, since the original 3ds porters didn't commit in 2 years). Still, I don't think searching in the source would solve the problem, since i quite made clear what the error is.

Edit:
I managed to just remove ATTRPACK from the struct declaration(it doesn't give any compiling problems, but maybe it won't run correctly). So now I basically have 2 other error messages:
Code:
/opt/devkitpro/devkitARM/bin/../lib/gcc/arm-none-eabi/10.2.0/../../../../arm-none-eabi/bin/ld: lua_thinkerlib.o:/home/andrea/Desktop/SRB2/srb2_3ds/source/doomdef.h:355: multiple definition of `savegamename';
i_main.o:/home/andrea/Desktop/SRB2/srb2_3ds/source/nds/../doomdef.h:355: first defined here
Code:
/opt/devkitpro/devkitARM/bin/../lib/gcc/arm-none-eabi/10.2.0/../../../../arm-none-eabi/bin/ld: lua_mobjlib.o:/home/andrea/Desktop/SRB2/srb2_3ds/source/doomstat.h:374: multiple definition of `ntemprecords';
d_main.o:/home/andrea/Desktop/SRB2/srb2_3ds/source/doomstat.h:374: first defined here
As a note the previous issue used ATTRPACK before it was defined. It is used as a hint to the compiler to not leave any spaces in the definition between elements.
For the new issue savegamename is defined in the header. Change the header to be a forward declaration by adding “extern “ to the beginning here https://github.com/derrekr/srb2_3ds...9d62fa5fbac6105315b57ea/source/doomdef.h#L355
Then copy that declaration (without extern) and add it somewhere else - the top of g_game.c seems appropriate.
 

masagrator

The patches guy
Developer
Joined
Oct 14, 2018
Messages
6,260
Trophies
3
XP
12,014
Country
Poland
It seems like some files are linking to the point that compiler thinks you want to add two the same things.

Try to add at line 16 of original doomtype.h
Code:
#pragma once

Maybe it will resolve issue.

--------------------- MERGED ---------------------------

Or add it to all conflicting headers somewhere at the beginning of files.
 

Meziu210

New Member
OP
Newbie
Joined
Oct 23, 2020
Messages
3
Trophies
0
Age
18
XP
39
Country
Italy
It seems like some files are linking to the point that compiler thinks you want to add two the same things.

Try to add at line 16 of original doomtype.h
Code:
#pragma once

Maybe it will resolve issue.

--------------------- MERGED ---------------------------

Or add it to all conflicting headers somewhere at the beginning of files.
Didn't change anything, and I have no idea why...
I'll continue searching for now, I'll update if i find anything
 

elhobbs

Well-Known Member
Member
Joined
Jul 28, 2008
Messages
1,044
Trophies
1
XP
3,030
Country
United States
Didn't change anything, and I have no idea why...
I'll continue searching for now, I'll update if i find anything
See my previous post about changing multiple declarations in header files to forward declarations. It seems that previous versions of gcc allowed this with potentially unpredictable results. Newer versions mark this as an error. The fix is to change the declarations to forward declarations in the header file using the extern keyword. Then put a single declaration in only one source file.
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • Psionic Roshambo @ Psionic Roshambo:
    Tandem even
  • The Real Jdbye @ The Real Jdbye:
    i think i heard of that, it's a good idea, shouldn't need a dedicated GPU just to run a LLM or video upscaling
  • The Real Jdbye @ The Real Jdbye:
    even the nvidia shield tv has AI video upscaling
  • The Real Jdbye @ The Real Jdbye:
    LLMs can be run on cpu anyway but it's quite slow
  • BakerMan @ BakerMan:
    Have you ever been beaten by a wet spaghetti noodle by your girlfriend because she has a twin sister, and you got confused and fucked her dad?
  • Psionic Roshambo @ Psionic Roshambo:
    I had a girlfriend who had a twin sister and they would mess with me constantly.... Until one chipped a tooth then finally I could tell them apart.... Lol
  • Psionic Roshambo @ Psionic Roshambo:
    They would have the same hair style the same clothes everything... Really messed with my head lol
  • Psionic Roshambo @ Psionic Roshambo:
    @The Real Jdbye, I could see AMD trying to pull off the CPU GPU tandem thing, would be a way to maybe close the gap a bit with Nvidia. Plus it would kinda put Nvidia at a future disadvantage since Nvidia can't make X86/64 CPUs? Intel and AMD licensing issues... I wonder how much that has held back innovation.
  • The Real Jdbye @ The Real Jdbye:
    i don't think nvidia wants to get in the x64 cpu market anyways
  • The Real Jdbye @ The Real Jdbye:
    you've seen how much intel is struggling getting into the gpu market
  • The Real Jdbye @ The Real Jdbye:
    and nvidia is already doing ARM
  • The Real Jdbye @ The Real Jdbye:
    i don't think they want to take more focus away from their gpus
  • Psionic Roshambo @ Psionic Roshambo:
    Yeah I think Nvidia s future lays in AI GPU acceleration stuff if they can get that going it's going to be super interesting in the long term
  • Psionic Roshambo @ Psionic Roshambo:
    AI assisted game creation might become a thing
  • Psionic Roshambo @ Psionic Roshambo:
    At least that's something I think would be pretty cool.
  • Psionic Roshambo @ Psionic Roshambo:
    Don some VR glasses and gloves and talk to the computer and paint entire worlds
  • Psionic Roshambo @ Psionic Roshambo:
    "OK Cortana I want that mountain a little taller and more snow on top, and I would like some random ancient pine forest around the bottom"
  • Psionic Roshambo @ Psionic Roshambo:
    "Now we need a spring fed river flowing down the north side and add some wild life appropriate for the biome"
  • Psionic Roshambo @ Psionic Roshambo:
    Many TBs of assets and the programming of something like that is going to be tough but I think it's something we might see in 20 years maybe sooner
  • The Real Jdbye @ The Real Jdbye:
    @Psionic Roshambo AI assisted game creation is kinda already here, there was recently that AI that can turn any 2D image into a fully modeled 3D object, it's not perfect, but it's a starting point, beats starting from zero
  • The Real Jdbye @ The Real Jdbye:
    before that there was one to generate a fully modeled scene from a 2D image
  • The Real Jdbye @ The Real Jdbye:
    but most recently, there was one that actually generates a working unity scene with terrain and textures already set up that you can import right into unity, that's a huge time saver right there
  • The Real Jdbye @ The Real Jdbye:
    and using LLMs to generate NPC dialogue and even dynamically generated quests is something i'm sure is already happening
  • The Real Jdbye @ The Real Jdbye:
    will just take some time for games made using those things to be completed and released
    The Real Jdbye @ The Real Jdbye: will just take some time for games made using those things to be completed and released