vhelin / wla-dx

WLA DX - Yet Another GB-Z80/Z80/Z80N/6502/65C02/65CE02/65816/68000/6800/6801/6809/8008/8080/HUC6280/SPC-700/SuperFX Multi Platform Cross Assembler Package
Other
549 stars 98 forks source link

Error when compiling under Ubuntu 14.04 due to order of -lm option in makefiles #18

Closed syldes81 closed 10 years ago

syldes81 commented 10 years ago

Under Ubutu 14.04, the wla-* tools do not compile, resulting in an almost empty binaries folder. Example for wla-65816:

gcc -lm main.o parse.o include_file.o pass_1.o pass_2.o pass_3.o pass_4.o stack.o listfile.o -owla-65816
pass_1.o: In function `parse_directive':
pass_1.c:(.text+0xb9f0): undefined reference to `cos'
pass_1.c:(.text+0xc6d2): undefined reference to `sin'
collect2: error: ld returned 1 exit status
make: *** [all] Error 1
cp: cannot stat 'wla-65816': No such file or directory

As found here, the -lm option (to link against the math library for the sin and cos functions) must appear after objects files since Ubuntu 11.04 (see https://wiki.ubuntu.com/NattyNarwhal/ToolchainTransition)

So in the makefiles, LDFLAGS should be placed after OFILES. This is the sed command I executed which allowed me to compile the tools: sed -i 's/$(LDFLAGS) $(OFILES)/$(OFILES) $(LDFLAGS)/g' makefiles/makefile.unix.* So please change the gcc option ordering change in order to be able to compile the wla-* tools under Ubuntu.

cr1901 commented 10 years ago

Why does this mirror a previous Issue? :(

Okay, sometime in June, I changed the build system to be autogenerated on a target-toolchain basis. There are still a few holes in it, and this in fact is a regression to Issue #1.

In retrospect, this might've not been a great idea on my part to include these files in the repository (and I may remove them/provide them as a gist for those interested in porting to a new toolchain), because it does make the tree more difficult to analyze, and the autogenerated scripts do have unintentional differences (besides formatting) compared to the original scripts.

I have a copy on a remote machine that has fixes to the build system (including this problem), but I have not pushed it yet. I will do so when I have access to this machine sometime this week.

cr1901 commented 10 years ago

Okay, all makefile issues should be fixed. Please update your local copy and try recompiling the binaries. run_unit_tests.sh path, as declared on line 25 on may need to be changed (binaries should come BEFORE the rest of the path :P), but I assume Ville had a reason for doing it in "reverse".

vhelin commented 10 years ago

On Sun, Nov 16, 2014 at 6:50 AM, William D. Jones notifications@github.com wrote:

Okay, all makefile issues should be fixed. Please update your local copy and try recompiling the binaries. run_unit_tests.sh path, as declared on line 25 on may need to be changed (binaries should come BEFORE the rest of the path :P), but I assume Ville had a reason for doing it in "reverse".

Thanks!

Reason for doing it in reverse: it just worked back in the day. :)

— Reply to this email directly or view it on GitHub https://github.com/vhelin/wla-dx/issues/18#issuecomment-63204363.

syldes81 commented 10 years ago

I confirm binaries are compiled out of the box on Ubuntu 14.04 now. Thank you guys for the good work !