Compile Max 6.1 external with MinGW x64
I have to create a Max external, and since I’m used to develop on linux and use tools such as gcc and ld, I’ve downloaded MinGW for Windows, both in x86 and x64.
When I compile for max 6.0 (in x86), everything works, I can use my external. But if I compile in x64 (from the Max SDK 6.1.4, with the x64 library) and then try to import the object in Max, the program freezes and I have no choice but to quit. I get the Windows exception code c0000005, which is basically a segmentation fault. I’ve tried with the examples given in the SDK to make sure I have no code error but it also didn’t work.
Does anybody know why this happens? It’s really annoying to waste time on this kind of problem.
Thank you very much!
Did you get anywhere with this? The same thing happens for me on Windows 8.1. I can compile the examples as x86 without any problems, but the x64 version causes a crash in Max. My compile command looks like:
gcc simplemax.c -shared -DWIN_VERSION -DWIN_EXT_VERSION -IC:\Users\rory\Documents\sourcecode\MaxSDK-6.1.4\c74support\max-includes -C:\Users\rory\Documents\sourcecode\MaxSDK-6.1.4\c74support\max-includes\x64 -lMaxAPI -o simplemax.mxe64
No errors are reported in the building and linking stages, but Max still crashes when trying to load it.
Yeah, I know, it’s exactly what’s happening… It’s really annoying.
I guess we could try with Visual Studio Compiler, but I don’t have enough time and I’ve moved to something else now!
Keep me updated, just in case you find something ;)
I think would be kind to get a word by C74 team.
It’s not a 3rd party external problem, given that the problem is present even on the SDK example provided by C74 istelf
wouldn’t be fine to move this post to the DEV section to get more attention on this very interesting topic ( a lot of externals compiled with open sources compilers would certainly be a plus for the whole Max community )
hi asked C74 for support via email. they replied that they don’t give support for their own SDK. well, weird enough.
so, sadly, we’re completely on our own on this issue and i guess as it is now Visual Studio is the only one option.
i wonder who can we ask for help. (minGW team? eric lyon ( author of a great book on max and pd externals design)?)
let’s keep in touch on this if we can.
I doubt that that is an exact quote. However, the SDK provides documentation on building with Visual Studio and 32-bit Cygwin. You want to build with an undocumented toolchain.
Visual Studio is free and documented. 64-bit MinGW is currently unsupported (implicitly in that we don’t mention it in the SDK). Unsupported means you’re on your own until we’re able to support and document that toolchain. Sorry, but we have limited resources to apply to testing and retooling our SDK, and we provide full documentation for setting up the free and usable toolchains which we do support.
Hi Jeremy, i don’t want to be polemic at all.
Just trying to find a way to solve this issue ( which surely and definetly is an issue).
The exact words by Andrew wich is as always very kind were
Sorry, we can’t help with SDK questions in support. You’ll need to keep banging away in the Dev section of the forum
Anyway i still think is kind of strange not having help from C74 with the company’s main product’s SDK.
I understand everything and all the great work C74 does on Max.
BTW i think would a great benefit for the whole community to try to solve this issue ( i.e. there are more custom externals for OSx than for Win. Helping with this minGW could improve the situation )
just my 2 cents.
Alright, finally an answer, thanks!
If c74 can’t help us right now, I think we need people who know the low-level differencies between msvc and mingw (I mean the initial error is a seg fault and I really can’t imagine where it can come from). In the meantime, it would be interesting to try different versions of mingw (all in x64 of course).
If somebody wants to try this… well that’s great! I’m not into that anymore but I’d sure like to know.
I had a few spare minute just now so I tried running this through gdb. The call to class_new() is causing the segfault, but I can’t tell much more than that. Here is the backtrace:
#0 0x0000000064a81590 in class_new ()
#1 0x0000000064a81496 in main () at simplemax.c:38
#2 0x0000000140393dbc in force_install ()
Backtrace stopped: previous frame inner to this frame (corrupt stack?)
I don’t suppose there is a debug version of the MaxAPI.lib available somewhere?
Very useful finding Rory! let’s hope this info will help helping us! :-)
I’m afraid it’s not much use at all without a debug version of the library.
indeed. our hopes are on C74 team. given they don’t give support on the SDK at least we can hope they can investigate the issue for the next SDK version. i mean i guess they have an internal debug version of the library.
Forums > MaxMSP