ndless-nspire / Ndless

The TI-Nspire calculator extension for native applications
http://ndless.me
830 stars 103 forks source link

Non-regression check of new SDK #8

Open OlivierA opened 10 years ago

OlivierA commented 10 years ago

To check that PR #5 didn't break too much builds, I have tried to build mViewer 4.3.

nspire-ld libpng/png.o libpng/pngerror.o libpng/pngget.o libpng/pngmem.o libpng/pngread.o libpng/pngrio.o libpng/pngrtran.o libpng/pngrutil.o libpng/pngset.o libpng/pngtrans.o libz/adler32.o libz/crc32.o libz/inffast.o libz/inflate.o libz/inftrees.o libz/zutil.o libjpeg/jdmarker.o libjpeg/jidctred.o libjpeg/jdmaster.o libjpeg/jmemmgr.o libjpeg/jdmerge.o libjpeg/jmemnobs.o libjpeg/jdphuff.o libjpeg/jquant1.o libjpeg/jdapimin.o libjpeg/jdpostct.o libjpeg/jquant2.o libjpeg/jdapistd.o libjpeg/jdsample.o libjpeg/jutils.o libjpeg/jdatasrc.o libjpeg/jerror.o libjpeg/jdcoefct.o libjpeg/jdcolor.o libjpeg/jddctmgr.o libjpeg/jdhuff.o libjpeg/jidctflt.o libjpeg/jcomapi.o libjpeg/jdinput.o libjpeg/jidctfst.o libjpeg/jdmainct.o libjpeg/jidctint.o -lndls -s mviewer.o screen.o console.o image.o dirlist.o browse.o tools.o touchpad.o readpng.o utils.o s_screen.o readjpeg.o -o mviewer_cx.elf
arm-none-eabi-ld: final link failed: Invalid operation
collect2: erreur: ld a retourné 1 code d'état d'exécution
Vogtinator commented 10 years ago

There are several undefined functions warnings or missing types (zlib's z_stream, opendir's DIR, ...), but that was the previous SDK fault, programs depending on need will need proper includes.

Maybe these includes should be added to os.h?

The is_cx macro has disappeared, this is an issue

It was marked as deprecated long ago and #define'd as "has_colors", so I removed it.

The new "include-everything os.h" may be a problem, in the case of mViewer the local pause() function conflicts with newlib's pause(). But on the other side not including everything may break some builds.

Not providing a os.h would have broken more than this, in fact EVERYTHING. Well, every program using syscalls...

ld fails with an error with no details. I have make clean all everything, I don't know what could be wrong.

It tries to invoke "arm-none-eabi-ld" instead of "arm-none-eabi-ld.gold", so there's something wrong with your setup. Does "arm-none-eabi-gcc" accept the "-fuse-ld=gold" option?

Legimet commented 10 years ago

There's nothing wrong with the setup. arm-none-eabi-ld.gold runs arm-none-eabi-ld.

Vogtinator commented 10 years ago

There's nothing wrong with the setup. arm-none-eabi-ld.gold runs arm-none-eabi-ld.

It could be that arm-none-eabi-gcc just ignores the "-fuse-ld" flag and invokes the linker without the necessary arguments which could provoke the "Invalid operation" error. It could be something different, though.

Also, can we just stop supporting toolchains other than arm-none-eabi? They probably won't work anyway.

At least arm-elf-gcc should be supported, it's quite common for prebuilt ARM toolchains.

How about adding the linker args to nspire-gcc, getting rid of arm-none-eabi-ld.gold, and replacing the toolchain's crt*.o with our ones so we don't have to add them in the gcc command (it creates warnings when not linking)?

Then you would have to install them everytime you reinstall or recompile newlib or update GCC.

Legimet commented 10 years ago

I just thought the arm-none-eabi-ld.gold was an ugly hack. There must be a standard way to do this, but I can't find any.

Anyway, the reason mViewer doesn't link is the -s option, removing it fixes it.

And I checked that arm-none-eabi-ld.gold is run.

Vogtinator commented 10 years ago

I didn't even see that.. When I tried to compile it, I used "nspire-tools new mviewer" and added the libraries back in.

Legimet commented 10 years ago

Here's is the full command of arm-none-eabi-ld.gold run by gcc:

/bin/bash /home/legimet/ndless/Ndless/ndless-sdk/bin/arm-none-eabi-ld.gold -plugin /opt/ndless/libexec/gcc/arm-none-eabi/4.9.1/liblto_plugin.so -plugin-opt=/opt/ndless/libexec/gcc/arm-none-eabi/4.9.1/lto-wrapper -plugin-opt=-fresolution=/tmp/ccsn0VRV.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lc -X -o mviewer_cx.elf /opt/ndless/lib/gcc/arm-none-eabi/4.9.1/crti.o /opt/ndless/lib/gcc/arm-none-eabi/4.9.1/crtbegin.o /opt/ndless/lib/gcc/arm-none-eabi/4.9.1/../../../../arm-none-eabi/lib/crt0.o -L/opt/ndless/lib/gcc/arm-none-eabi/4.9.1 -L/opt/ndless/lib/gcc/arm-none-eabi/4.9.1/../../../../arm-none-eabi/lib libpng/png.o libpng/pngerror.o libpng/pngget.o libpng/pngmem.o libpng/pngread.o libpng/pngrio.o libpng/pngrtran.o libpng/pngrutil.o libpng/pngset.o libpng/pngtrans.o libz/adler32.o libz/crc32.o libz/inffast.o libz/inflate.o libz/inftrees.o libz/zutil.o libjpeg/jdmarker.o libjpeg/jidctred.o libjpeg/jdmaster.o libjpeg/jmemmgr.o libjpeg/jdmerge.o libjpeg/jmemnobs.o libjpeg/jdphuff.o libjpeg/jquant1.o libjpeg/jdapimin.o libjpeg/jdpostct.o libjpeg/jquant2.o libjpeg/jdapistd.o libjpeg/jdsample.o libjpeg/jutils.o libjpeg/jdatasrc.o libjpeg/jerror.o libjpeg/jdcoefct.o libjpeg/jdcolor.o libjpeg/jddctmgr.o libjpeg/jdhuff.o libjpeg/jidctflt.o libjpeg/jcomapi.o libjpeg/jdinput.o libjpeg/jidctfst.o libjpeg/jdmainct.o libjpeg/jidctint.o -lndls -s mviewer.o screen.o console.o image.o dirlist.o browse.o tools.o touchpad.o readpng.o utils.o s_screen.o readjpeg.o --start-group -lgcc -lc --end-group /opt/ndless/lib/gcc/arm-none-eabi/4.9.1/crtend.o /opt/ndless/lib/gcc/arm-none-eabi/4.9.1/crtn.o

Vogtinator commented 7 years ago

I just thought the arm-none-eabi-ld.gold was an ugly hack. There must be a standard way to do this, but I can't find any.

The standard way to do this is patching the toolchain and adding a custom prefix, like "arm-ndless-eabi-". Obviously that's much more work and likely to break than the current method.