andwn/marsdev

Error compiling z80-tools

loupaschris opened this issue · 4 comments

When I execute make z80-tools I have the following output :

cd sjasm/Sjasm && make
make[2] : on entre dans le répertoire « /home/loupaschris/marsdev/z80-tools/sjasm/Sjasm »
g++ -Wp,-MD,.deps/direct.d -Wall -O2 -DMAX_PATH=MAXPATHLEN -c -o direct.o direct.cpp
direct.cpp: In function ‘int ParseDirective()’:
direct.cpp:38:6: warning: suggest explicit braces to avoid ambiguous ‘else’ [-Wdangling-else]
38 | if (!(n=getinstr(lp)))
| ^
direct.cpp: In function ‘void dirBYTE()’:
direct.cpp:72:24: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
72 | if (!teller) { error(".byte with no arguments",0); return; }
| ^~~~~~~~~~~~~~~~~~~~~~~~~
direct.cpp: In function ‘void dirDC()’:
direct.cpp:87:24: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
87 | if (!teller) { error(".byte with no arguments",0); return; }
| ^~~~~~~~~~~~~~~~~~~~~~~~~
(... and much more)

I'm on Ubuntu 20.04
My gcc version is the following one :

gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0

Any help would be greatly appreciated

andwn commented

What is the output at the bottom? Those are ignorable warnings. Wild guess is it's z80asm that fails in the end. I removed that tool because none of the examples require it, and it fails to build on 9 out of 10 machines I throw at it.

Chekr commented

I am also having errors with the z80 tools.

end error output:

/usr/bin/ld: direct.o: relocation R_X86_64_32S against symbol `_Z5piZ80v' can not be used when making a PIE object; recompile with -fPIE                         
/usr/bin/ld: loose.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE                             
/usr/bin/ld: parser.o: relocation R_X86_64_32 against symbol `temp' can not be used when making a PIE object; recompile with -fPIE                               
/usr/bin/ld: piz80.o: relocation R_X86_64_32 against symbol `lp' can not be used when making a PIE object; recompile with -fPIE                                  
/usr/bin/ld: reader.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE                            
/usr/bin/ld: sjasm.o: relocation R_X86_64_32 against symbol `structtab' can not be used when making a PIE object; recompile with -fPIE                           
/usr/bin/ld: sjio.o: relocation R_X86_64_32 against symbol `filename' can not be used when making a PIE object; recompile with -fPIE                             
/usr/bin/ld: tables.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE                            
collect2: error: ld returned 1 exit status                                                                                                                       
make[2]: *** [Makefile:27: sjasm] Error 1                                                                                                                        
make[1]: *** [Makefile:28: /home/chekr/mars/bin/sjasm] Error 2                                                                                                    
make: *** [Makefile:32: z80-tools] Error 2
andwn commented

For me it is working. What OS? GCC version?

andwn commented

z80-tools (specifically z80asm) has been removed a while ago and Sjasm was moved into the sgdk target. I have no way of knowing if the issues above persist, just that they don't happen on any of my Debian (bullseye/bookworm) or macOS installs. Perhaps there is some configuration or use flag overriding the default value of -fPIE, or llvm and gnu compiler environments on the host being mixed, like here:
https://stackoverflow.com/questions/19364969/compilation-fails-with-relocation-r-x86-64-32-against-rodata-str1-8-can-not

As a general recommendation try and post your OS and GCC version like the guy up top did. For now I'm going to close this issue since I haven't gotten other complaints about Sjasm in 6 months and the reporter(s) seem to have lost interest.