I'm trying to compile and build from a .c file but using the 'sh3eb-elf-gcc' command returns me with:
Code:
/usr/local/cross/libgcc/sh3eb-elf-gcc thing.c
/usr/local/cross/lib/gcc/sh3eb-elf/7.2.0/../../../../sh3eb-elf/bin/ld: cannot find -lc
collect2: error: ld returned 1 exit status
This is probably my first time building a compiler so I most likely doing something wrong. I got stuck while doing the 'Learning the Ropes' section on the wiki here. I used Debian Stretch (Linux) when I built the compiler needed to make programs for the FX-CG50.
If you've only built a compiler you don't have a libc, which is traditionally newlib but we provide a minimal fake libc in libfxcg.
You can compile with -nostdlib to tell the compiler to not try to link against libc, but for the Prizm you still need to link against the right crt0 and use the right linker script- all things the example makefiles do for you that are necessary.
Tari wrote:
If you've only built a compiler you don't have a libc, which is traditionally newlib but we provide a minimal fake libc in libfxcg.
You can compile with -nostdlib to tell the compiler to not try to link against libc, but for the Prizm you still need to link against the right crt0 and use the right linker script- all things the example makefiles do for you that are necessary.
Forgive me but I don't understand most of what you meant by linking against the right crt0 and the rest. I am recent to this development stuff. The '-nostdlib' option worked but I can sorta see what you're saying about prizm but I have no idea where to go from there.
bryantzepeda wrote:
↓Forgive me but I don't understand most of what you meant by linking against the right crt0 and the rest. I am recent to this development stuff. The '-nostdlib' option worked but I can sorta see what you're saying about prizm but I have no idea where to go from there.
I believe he is telling you to use the example makefiles, (i.e. just run make), rather than just typing "gcc" and expecting things to work
MateoConLechuga wrote:
bryantzepeda wrote:
↓Forgive me but I don't understand most of what you meant by linking against the right crt0 and the rest. I am recent to this development stuff. The '-nostdlib' option worked but I can sorta see what you're saying about prizm but I have no idea where to go from there.
I believe he is telling you to use the example makefiles, (i.e. just run make), rather than just typing "gcc" and expecting things to work
I tried 'make' and I'm getting this.
Code:
make
/usr/local/cross/bin/sh3eb-elf-gcc -mb -m4a-nofpu -mhitachi -nostdlib -T/usr/src/PrizmSDK-0.3/common/prizm.ld -W1, -gcsections -L/usr/PrizmSDK-0.3/usr/src/PrizmSDK-0.3/lib -lfxcg -lgcc -o /usr/src/PrizmSDK-0.3/projects/example/example.bin
/usr/local/cross/lib/gcc/sh3eb-elf/7.2.0/../../../../sh3eb-elf/bin/ld: cannot find -lfxcg
collect2: error: ld returned 1 exit status
/usr/src/PrizmSDK-0.3/common/prizm_rules:67 recipe for target '/usr/src/Prizm-0.3/projects/example/example.bin' failed
make[1]: *** [/usr/src/PrizmSDK-0.3/projects/example/example.bin] Error 1
Makefile:105: recipe for target 'build' failed
make: *** [build] Error 2
Don't know what I could do except for trying to add in '-lfxcg' the MACHDEP line. I've tried changing the line where it says it's for the prefix on the compiler executables, from 'sh3eb-elf-' to '/usr/local/cross/bin/sh3eb-elf-'. Also changed the original Makefile to this:
Code:
export LIBFXCG_INC := $(FXCGSDK)/usr/src/PrizmSDK-0.3/include
export LIBFXCG_LIB := $(FXCGSDK)/usr/src/PrizmSDK-0.3/lib
I'm just a bit frustrated if there was some dependency we were supposed to install with the compiler, which wasn't in the wiki, because it takes a great amount of time to do it all over again.
You don't need to rebuild the compiler, but you do need to build a copy of libfxcg as a static library (libfxcg.a) and ensure it's in the include search path.
Tari wrote:
You don't need to rebuild the compiler, but you do need to build a copy of libfxcg as a static library (libfxcg.a) and ensure it's in the include search path.
I looked up how to build a static library and I think I'm in over my head (No CS background). So I (successfully?) built libfxcg with the toolchain prefix set to '/usr/local/cross/bin/sh3eb-elf-
I still can't build the examples (same errors) and now I can't use sh3eb-elf-x commands anymore.
Thank you all for the help, I couldn't have done it without you all! I finally got it working. I just had to edit the prefixes on the makefiles, on /libfxcg and /libc, from 'prizm-gcc-' to 'sh3eb-elf-'. Also I copied the makefile from the /examples/make-libfxcg/ folder to each example folder throughout, and then I edited it to match the C and output files.
I used qemu-kvm/virt-manager as my testing ground but it was incredibly slow because somehow my BIOS settings had them turned off and I had sluggish performance when building the compiler. I had to let it run while I slept because it took hours!
Luckily, I looked up my problems and turned on virtualization on my BIOS. The 'sh3eb-elf-x' command disappeared after I setup a GUI desktop environment, but I figured that I had to run this to get it back:
Code: export PATH=$PATH:/usr/local/cross/bin
I tried the helloWorld example and I'm happy that it works! If anyone has an idea on what improvements I should do or should've done, I'd love to hear them!
Sounds like you've worked it all out okay, which is good. All the documentation's kind of a mess since we were making largish changes then everybody kind of lost interest in the platform, so it's helpful that you were able to work things out and provide if not documentation evidence that it's possible to make things work.
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.
»
Go to Registration page
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum