ksherlock / mpw

Macintosh Programmer's Workshop (mpw) compatibility layer
238 stars 21 forks source link

Build failure with ragel 7 #49

Open ryandesign opened 1 year ago

ryandesign commented 1 year ago

I have installed ragel 7.0.4 and building mpw fails:

/path/to/mpw/environment.rl:162:9: assign: no machine instantiations to write
/bin/sh: line 1: 27156 Segmentation fault: 11  ragel -p -G2 -o environment.cpp
/path/to/mpw/environment.rl
make[2]: *** [mpw/environment.cpp] Error 139

The crash log says:

Thread 0 Crashed::  Dispatch queue: com.apple.main-thread
0   libragel.0.dylib                       0x107255c5d InputData::writeStatement(CodeGenData*, InputLoc&, int, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >&, bool, HostLang const*) + 59
1   libragel.0.dylib                       0x1072567c9 InputData::writeOutput(InputItem*) + 195
2   libragel.0.dylib                       0x107256ce4 InputData::flushRemaining() + 62
3   libragel.0.dylib                       0x10725703e InputData::processReduce() + 72
4   libragel.0.dylib                       0x10725922b InputData::main(int, char const**) + 91
5   ragel                                  0x1070119a9 main + 233
6   dyld                                   0x1087ea51e start + 462

The MacPorts project encountered a similar error building a different program that used ragel:

https://github.com/macports/macports-ports/blob/8064da0ce1b0e7f8562fafc2616c8b7823c37298/editors/textmate2/files/patch-Frameworks_plist_src_ascii.rl-work-around-ragel7-bugs.diff

The MacPorts developer who fixed it believed this was a ragel 7 bug, but I don't know if that's true or if it has been reported to the developer of ragel.

I'm not familiar with ragel and am not certain how to adapt the fix from the MacPorts patchfile to the mpw environment.rl file.

The mpw readme mentions the ragel requirement but does not give a specific version number.

ksherlock commented 1 year ago

Use Ragel 6.10 (which is "stable"). Ragel 7 is still in "development".

ryandesign commented 1 year ago

Thanks, I can confirm that it does build with ragel 6.10. I reported the problem with ragel 7.0.4 to its developer.

MacPorts had updated its ragel port to version 7 years ago, which should not have happened since it was a development version. I've now downgraded MacPorts ragel back to version 6.10 and added a new ragel-devel port for those who want to work with version 7.