hex007 / freej2me

A free J2ME emulator with libretro, awt and sdl2 frontends.
Other
486 stars 75 forks source link

Fix SDL2 frontend build failure for linux relating to linker option order in Makefile #88

Closed fcard closed 4 years ago

fcard commented 4 years ago

The order in which the link options are placed in relation to the input files matter for certain linkers (gnu ld, for example)

GCC docs: https://gcc.gnu.org/onlinedocs/gcc/Link-Options.html Relevant excerpt:

-llibrary -l library [...] It makes a difference where in the command you write this option; the linker searches and processes libraries and object files in the order they are specified. Thus, ‘foo.o -lz bar.o’ searches library ‘z’ after file foo.o but before bar.o. If bar.o refers to functions in ‘z’, those functions may not be loaded.

Interesting stack overflow question on the subject: https://stackoverflow.com/questions/45135/why-does-the-order-in-which-libraries-are-linked-sometimes-cause-errors-in-gcc

hex007 commented 4 years ago

Thanks