marsdev icon indicating copy to clipboard operation
marsdev copied to clipboard

Error compiling z80-tools

Open loupaschris opened this issue 2 years ago • 1 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

loupaschris avatar Jun 21 '22 22:06 loupaschris

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.

andwn avatar Sep 25 '22 13:09 andwn

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

Chekr avatar Jan 20 '23 18:01 Chekr

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

andwn avatar Feb 01 '23 10:02 andwn

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.

andwn avatar Aug 10 '23 11:08 andwn