| View previous topic :: View next topic |
| Author |
Message |
protomank
Joined: 18 Dec 2008 Posts: 67 Location: Porto Alegre, RS, Brazil
|
Posted: Wed Aug 01, 2012 8:17 am Post subject: Help compiling game |
|
|
ee-g++ -Wl,-O1 -o rockbot.elf main.o character.o graphicslib.o inputlib.o game.o stage.o classmap.o classplayer.o timerlib.o sceneslib.o soundlib.o projectilelib.o classnpc.o stage_select.o class_config.o object.o class_colorcycle.o option_picker.o dialogs.o file_io.o classboss.o animation.o ending.o colision_detection.o -L/usr/lib/i386-linux-gnu -mno-crt0 -T/usr/local/ps2dev/ps2sdk/ee/startup/linkfile /usr/local/ps2dev/ps2sdk/ee/startup/crt0.o ../ports/ps2/cdvd.s ../ports/ps2/usbd.s ../ports/ps2/usbhdfsd.s ../ports/ps2/SJPCM.s -L. -L/usr/local/ps2dev/gsKit/lib -L../lib -L/usr/local/ps2dev/ps2sdk/ports/lib -lSDL_image -ljpeg -ltiff -lpng -lz -ldebug -lSDL_ttf -lsdlmixer -lfreetype -lcdvd -lsdl -lm -lsyscall -lmf -lpacket -ldma -lc -lkernel -lsyscall -lc -lstlport -L/usr/local/ps2dev/ps2sdk/ee/lib -L/usr/local/ps2dev/gsKit/lib -L/usr/local/ps2dev/ps2sdk/ports/lib
/usr/local/ps2dev/ps2sdk/ee/lib/libc.a(fflush.o)(.text+0x98): In function `fflush':
src/stdio.c: undefined reference to `errno'
/usr/local/ps2dev/ps2sdk/ee/lib/libc.a(fflush.o)(.text+0x9c):src/stdio.c: undefined reference to `errno'
/usr/local/ps2dev/ps2sdk/ee/lib/libc.a(fileno.o)(.text+0x1c): In function `fileno':
src/stdio.c: undefined reference to `errno'
/usr/local/ps2dev/ps2sdk/ee/lib/libc.a(fileno.o)(.text+0x20):src/stdio.c: undefined reference to `errno'
/usr/local/ps2dev/ps2sdk/ee/lib/libc.a(fdopen.o)(.text+0xa8): In function `fdopen':
src/stdio.c: undefined reference to `errno'
/usr/local/ps2dev/ps2sdk/ee/lib/libc.a(fdopen.o)(.text+0xac):src/stdio.c: more undefined references to `errno' follow
I hope is there anyone here to help me out... |
|
| Back to top |
|
 |
protomank
Joined: 18 Dec 2008 Posts: 67 Location: Porto Alegre, RS, Brazil
|
Posted: Thu Aug 02, 2012 10:08 pm Post subject: |
|
|
Messing with the link line, I also got: std::basic_string<char, std::char_traits<char>, std::allocator<char> >::_Rep::_S_terminal
/usr/local/ps2dev/ee/lib/gcc-lib/ee/3.2.2/../../../../ee/lib/libstdc++.a(ios.o)(.text+0x178):../../../../libstdc++-v3/libsupc++/new:89: undefined reference to `_impure_ptr'
That several people also had, but I did not found a good solution. Anyone? |
|
| Back to top |
|
 |
ragnarok2040
Joined: 09 Aug 2006 Posts: 274
|
Posted: Fri Aug 03, 2012 10:02 am Post subject: |
|
|
You need to rename or create a symlink to newlib's libc.a in ee/ee/lib to a different name than ps2sdk's libc.a. I usually change it to libn.a. It was used to compile g++ and its libraries, hence the missing symbols.
Then link the libraries in the following order: -lc -lstdc++ -lc -ln. This prevents newlib's symbols from having precedence over ps2sdk's symbols, for the most part.
There might be problems where symbol attributes conflict. There won't be a compile error, but you might get things like the malloc from newlib instead of ps2sdk, etc. |
|
| Back to top |
|
 |
protomank
Joined: 18 Dec 2008 Posts: 67 Location: Porto Alegre, RS, Brazil
|
Posted: Sat Aug 04, 2012 3:11 am Post subject: |
|
|
I almost felt from my chair when I saw WHO answered me! :D
Good to see you alive and well ragnarock! Hope you and your brother are doing well.
I knew you had this issue before, your solution seems to be logic, I'll try it tonight. Thanks A LOT! |
|
| Back to top |
|
 |
ragnarok2040
Joined: 09 Aug 2006 Posts: 274
|
Posted: Sun Aug 05, 2012 12:40 am Post subject: |
|
|
There was a bit of trouble, but we're fine for now. After moving to Windows, trying to develop for the ps2 with mingw became quite a chore, and trouble with my brother popped up, so I took a hiatus which lasted a bit longer than I thought it would. I can explain by pm, if you want, :D.
Back on topic, I have a patch file for newlib where I added some weak attributes to the various standard C symbols that ps2sdk's libc has defined. All of the code pasting sites seem to have added size limits or various other limitations so I had to upload the newlib patch to a file host.
http://www.filedropper.com/newlib-1100-ps2newpatchtar
Here are the changes to remove the weak attribute from ps2sdk's libc:
http://pastie.org/4389452
http://pastie.org/4389455
This is just to ensure the definitions in ps2sdk are used. I think ps2sdk's libc was designed to be used as a fallback for when a developer used his/her own custom libc definitions, but it gets in the way when newlib becomes the fallback libc library with its strong definitions.
At least... that's how I remember it. |
|
| Back to top |
|
 |
cosmito
Joined: 04 Mar 2007 Posts: 317 Location: Portugal
|
Posted: Wed Aug 15, 2012 7:41 am Post subject: |
|
|
Good to hear from you ragnarok!
Regarding your patch, maybe the best way would be creating a branch at
https://github.com/ps2dev (I see you are a member) or even commit the changes to the master branch?
It's valuable work that shouldn't be lost. |
|
| Back to top |
|
 |
ragnarok2040
Joined: 09 Aug 2006 Posts: 274
|
Posted: Thu Aug 16, 2012 2:59 pm Post subject: |
|
|
Hey, :D, yeah it's been a while, heh.
I was thinking of implementing a BE_STRONG flag in my ps2sdk fork and doing a pull request. That would preserve the original behavior and symbols. Only after I sync my fork with the official ps2sdk git, however. I only had a full newlib patch when I posted, but I can make a smaller addendum patch, so it can be optionally applied after the newlib patch as part of the ps2toolchain git.
And, I'm not sure if some consequences could pop up stemming from weak newlib symbols and strong ps2sdk symbols. I haven't noticed anything, as of yet, but I've only played around with 4 or 5 versions of snes9x. Of which, only 1.5x used C++ extensively.
I've been busy making Debian-based packing building scripts for ps2sdk and my other stuff. I'm amazed I got gcc-3.2.2 to compile and run on Mint 13 x86_64. |
|
| Back to top |
|
 |
ragnarok2040
Joined: 09 Aug 2006 Posts: 274
|
Posted: Tue Aug 21, 2012 12:19 pm Post subject: |
|
|
I managed to sync my fork with the official ps2sdk git. The develop branch has the commit needed for setting up ps2sdk without weak symbols. Add -DNO_WEAK to EE_CFLAGS in ee/Rules.make before compiling ps2sdk or do EE_CFLAGS=-DNO_WEAK make, in order to change the default behavior.
http://github.org/ragnarok2040/ps2sdk
http://pastie.org/4559415
Newlib needs to be recompiled with this patch so it can be used in tandem with ps2sdk's libc. As far as I know, these symbols were the only ones that had collisions, when I was compiling snes9x. There might be other symbols that may need the weak attribute.
Explanation:
I noticed newlib was overriding ps2sdk in snes9x, so I removed the weak attribute from ps2sdk's libc. Some symbols from newlib collided with ps2sdk, so I made those weak, then reverted the change in ps2sdk to make its symbols weak again.
The linker should have picked the first encountered symbol in ps2sdk's libc as the definition, but it seemed to pick at random from either library. Enabling ps2sdk's symbols to be strong with the weak newlib symbols seems to work for consistent builds of snes9x.
It might be possible to use "-Wl,--whole-archive $(PS2SDK)/ee/lib/libc.a -Wl,--no-whole-archive" when linking without having to recompile ps2sdk. It's similar to linking every object file in libc into your program ensuring ee-ld picks those symbols' definitions first but I haven't had the chance to test it since I'm still setting up. |
|
| Back to top |
|
 |
deba5er
Joined: 04 Feb 2008 Posts: 176
|
Posted: Thu Sep 13, 2012 12:41 pm Post subject: snes9x at psx-scene |
|
|
@ragnarok2040
http://psx-scene.com/forums/official-fceux-snes9x-forums/
AKuHAK has revived your old thread and is working from your source but may need some assistance. ps2dev is having problems with new accounts, so new devs can't make it onto ps2dev.org to post. Could you login to psx-scene and answer a few questions on compilation? |
|
| Back to top |
|
 |
|