can't compile bmx:

Archives Forums/BlitzMax Bug Reports/can't compile bmx:

Mathieu A(Posted 2016) [#1]
I've got this error of compilation. I used tdm64-gcc-5.1.0-2 version.
I have windows 10 and intel i7. I also used the last version of Blide.

I have lots of problem to build module but now I can't compile my code :

C:/BlitzMax/mod/pub.mod/stdc.mod/stdc.debug.win32.x86.a(stdc.c.debug.win32.x86.o):stdc.c:(.text+0x3a9): undefined reference to `__mingw__wopendir'
C:/BlitzMax/mod/pub.mod/stdc.mod/stdc.debug.win32.x86.a(stdc.c.debug.win32.x86.o):stdc.c:(.text+0x3e6): undefined reference to `__mingw__wclosedir'
C:/BlitzMax/mod/pub.mod/stdc.mod/stdc.debug.win32.x86.a(stdc.c.debug.win32.x86.o):stdc.c:(.text+0x3f9): undefined reference to `__mingw_closedir'
C:/BlitzMax/mod/pub.mod/stdc.mod/stdc.debug.win32.x86.a(stdc.c.debug.win32.x86.o):stdc.c:(.text+0x41b): undefined reference to `__mingw__wreaddir'
C:/BlitzMax/mod/pub.mod/stdc.mod/stdc.debug.win32.x86.a(stdc.c.debug.win32.x86.o):stdc.c:(.text+0x44c): undefined reference to `__mingw_readdir'
Build Error: Failed to link C:\Users\maaud_000\Desktop\Test\test.debug.exe
Thank you very much if you have any solution.


therevills(Posted 2016) [#2]
You need to get an older version of MinGW, try the tdm-gcc-4.5.2.exe from here:

https://sourceforge.net/projects/tdm-gcc/files/TDM-GCC%20Installer/Previous/1.1006.0/

Cheers,
Steve


Mathieu A(Posted 2016) [#3]
Ok thanks therevills. I'll test this!


markcw(Posted 2016) [#4]
I think the problem is your versions of bcc and bmk in bin are too old for the version of MinGW you have and produce this fatal error.

I have just written an install guide here if you need it: http://www.blitzmax.com/Community/posts.php?topic=105834


grable(Posted 2016) [#5]
You have old LIB files. Copy the new ones over and recompile all mods.

EDIT:
But munch is right too, you need to update BMK to include some extra LIBs depending on what mingw disto your using.
These are the ones i added, in addition to adding -m32 to gcc, -b pe-i386 to ld and --target=pe-i386 to ar. Since i use TDM-GCC-64 5.1.0.
Also, if your using the 64-bit version, make sure you copy from lib\gcc\x86_64-w64-mingw32\5.1.0\32 and x86_64-w64-mingw32\lib32.



grable(Posted 2016) [#6]
Seems i had a partially broken setup, by using 32-bit versions of ld everything worked. But when i replaced it with the one from TDM-GCC-64 it just would not read any lib files, complaining about invalid format.

I finally fixed my setup by borrowing some code from the open source version of blitz, that uses gcc to link instead.
Now all thats needed to update mingw is to copy ar.exe to BlitzMax\bin (optionally deleting BlitzMax\lib) and never having to worry about wrong or missing libs again ;)

Replace bmk_util.bmx with the one from here: https://raw.githubusercontent.com/blitz-research/blitzmax/master/src/bmk/bmk_util.bmx
EDIT: Added link to original file instead.