bmk
bmk copied to clipboard
Crosscompiling for Win32 - outdated
Next to the small spelling error in the readme ("relese") I think the "cross-compiling" section could need an overhaul. Just to use a more current MinGW.
I have gotten MinGW 64 7.1.0 to successfully compile and link by putting -static in the g++ command (I have to execute the g++ command via a command prompt after compiling while the ld.tmp file is current). I cannot figure out how to inject the -static command in bmk however. Is there a way to do that?
Current command: g++.exe -Wl,--stack,4194304 -s -Wl,--subsystem,windows -mwindows -mthreads -o
Correct command: g++.exe" -Wl,--stack,4194304 -s -static -Wl,--subsystem,windows -mwindows -mthreads -o
I believe I may have found the correct file to modify to correctly inject the -static parameter. In bmk_util.bmx I inserted the following at line 338:
If Not makelib cmd:+" -static" End If
Guessing a bit on not needing it for libraries and for version > 6000, so it might need to go somewhere else but so far works.
BMK already contains something in the likes for "linux/raspberrypi":
If opt_static Then
cmd:+" -static"
End If
So I would suggest to use the same thing in the "windows" section (in the "if"-block you already modified)
To use it (after you added the lines above within the win32-block), you call "bmk" as normal but add "static" as param.
Another idea is to use "custom.bmk" and the command addldopt static -static
as it adds to the "ld_opt" variable (static is the name, -static the value) which is appended to this cmd
variable too - in Line 415 and following:
' add any user-defined linker options
files:+ " " + opts
(opts
is a param to the LinkApp()
-function which is set to be globals.Get("ld_opts")
which itself can be filled via said command in custom.bmk. That said command is btw. defined in make.bmk as addldopt
)
Above things are untested and pure suggestions - if they work too, then I would gladly read positive feedback :-)
Maybe the second part wont help you (after reading your thread on syntaxbomb).
If you run a verbose one you should see "-static" appended, if it appends "static" instead, there might be something borked.
Yeah, the addldopt affects the ld.exe commands and this needs to execute as a param of g++. If there was an addgppopt command or something like it that would work to use the option file. Since its questionable if or when TDM will ever be updated it might make sense to put this in code, perhaps using a version quantifier, so that people can use an updated compiler.
Xlsior (from syntaxbomb) also included the static param for console apps, which is around line 347. When I looked at the code I replaced "cmd:+" -mconsole" with "cmd:+" -static -mconsole".
As said above you should be able to add
If opt_static Then
cmd:+" -static"
End If
within that win32-block and when then using "bmk makeapp -g x64 -static file.bmx" you should get " -static" added to the cmd-string.
Let's wait with what Brucey will come up once he is back at his computer :-)
Now I'm understanding. Would work great using bmk on command line but not sure how to implement that in MaxIDE.
Yes, interested in what Brucey decides on! :)