Recently I installed Code::Blocks and everything worked with the mingw compiler. But after following this guide (to the letter) I find myself unable to build even the simplest valid C programs: https://github.com/glankk/n64. The error is always the same:
||=== Build: Debug in test (compiler: n64) ===|
c:\msys64\opt\n64-toolchain\bin\..\lib\gcc\mips64\7.2.0\..\..\..\..\mips64\bin\ld.exe:--defsym|1|syntax error|
||error: ld returned 1 exit status|
||=== Build failed: 2 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|
I am using Code::Blocks 16.01, and here is an example of a c file that won't build:
I don't want to waste anyone's time if this is a simple problem, but I really cannot find a solution. Do I need to rebuild the compiler?
Thank you for responding! I am going to start rebuilding the compiler now to see if that works. Here is the build log:
Build started on: 20-10-2017 at 12:53.57
Build ended on: 20-10-2017 at 12:53.57
-------------- Build: Debug in test (compiler: n64)---------------
mips64-g++.exe -o bin\Debug\test.exe obj\Debug\test.o -T "C:\Program Files (x86)\CodeBlocks\n64-master"/ldscripts/gl-n64.ld -Wl,--defsym,start=0x -specs=nosys.specs -flto -Wl,--gc-sections
c:/msys64/opt/n64-toolchain/bin/../lib/gcc/mips64/7.2.0/../../../../mips64/bin/ld.exe:--defsym:1: syntax error
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minute(s), 0 second(s))
2 error(s), 0 warning(s) (0 minute(s), 0 second(s))
Try putting "n64-master" in a place that does NOT have spaces or special chars in the path.
Please post a full re-build log if you still have problems.
Re-build does not mean build.
Edited: added my re-build log; minus the clean portain.
-------------- Build: Debug in test (compiler: n64)---------------
mips64-gcc.exe -Wall -g -ffunction-sections -fdata-sections -flto -ffat-lto-objects -I C:\Users\stahta01\devel\open_source_code\no_version_control\n64-master/include -IC:\Users\stahta01\devel\open_source_code\no_version_control\n64-master\include -c C:\Users\stahta01\devel\open_source_code\no_version_control\test\test\main.c -o obj\Debug\main.o
mips64-g++.exe -o bin\Debug\test.exe obj\Debug\main.o -T C:\Users\stahta01\devel\open_source_code\no_version_control\n64-master/ldscripts/gl-n64.ld -Wl,--defsym,start=0x80000400 -specs=nosys.specs -flto -Wl,--gc-sections
Output file is bin\Debug\test.exe with size 3.04 KB
Tim S.
I moved n64-master to c:/users/trevor/desktop/. No dice...
-------------- Clean: Debug in test (compiler: n64)---------------
Cleaned "test - Debug"
-------------- Build: Debug in test (compiler: n64)---------------
mips64-gcc.exe -Wall -g -ffunction-sections -fdata-sections -flto -ffat-lto-objects -I C:\Users\Trevor\Desktop\n64-master/include -IC:\Users\Trevor\Desktop\n64-master\include -c "C:\Users\Trevor\Documents\Code Blocks\projects\test\test.c" -o obj\Debug\test.o
mips64-g++.exe -o bin\Debug\test.exe obj\Debug\test.o -T C:\Users\Trevor\Desktop\n64-master/ldscripts/gl-n64.ld -Wl,--defsym,start=0x -specs=nosys.specs -flto -Wl,--gc-sections
c:/msys64/opt/n64-toolchain/bin/../lib/gcc/mips64/7.2.0/../../../../mips64/bin/ld.exe:--defsym:1: syntax error
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minute(s), 0 second(s))
2 error(s), 0 warning(s) (0 minute(s), 0 second(s))
Then, the issue is likely because "-Wl,--defsym,start=0x" the value 0x is wrong. But, I have no idea where the value is set.
I was hoping the linker script was the place it was set; and, the reason it failed was the spaces.
From Compiler Custom Vars.
-T $(LDSCRIPT) -Wl,--defsym,start=0x$(address) -specs=nosys.specs -flto -Wl,--gc-sections
For some reason your value of $(address) is blank; but, I have no idea where that value is located.
Tim S.