Compiling custom Mini vMac builds on Cygwin

About Mini vMac and all other 68k emulators, including SoftMac, Executor, and MESS.

Moderators: Cat_7, Ronald P. Regensburg

Post Reply
User avatar
Lucss21a
Student Driver
Posts: 13
Joined: Sat Mar 05, 2022 1:03 pm
Contact:

Compiling custom Mini vMac builds on Cygwin

Post by Lucss21a »

So I was fell into a rabbit hole, that is, compiling custom Mini vMac builds. I know that there's the variation service, but I prefer compiling the source.
I got lucky by compiling Linux builds but I got no luck on compiling Windows or MacOS (Intel only) builds inside Termux.
I tried on my PC to use Cygwin and compile the Windows builds, at least. Then I have a problem of compiling it using normal gcc and make, it spewed an error about _MAX_PATH. Any fix or help?
User avatar
adespoton
Forum All-Star
Posts: 3692
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: Compiling custom Mini vMac builds on Cygwin

Post by adespoton »

I can't be much help as I compile my variations using xCode on macOS. However, on there, GCC actually maps to LLVM. Is it possible it's actually expecting this? Or could it be that your path depth is too deep and you need to store the files closer to root?

I'm pretty sure Paul's variations service actually runs on Linux, so it should be possible to do, once a few environment related issues have been sorted.
User avatar
Lucss21a
Student Driver
Posts: 13
Joined: Sat Mar 05, 2022 1:03 pm
Contact:

Re: Compiling custom Mini vMac builds on Cygwin

Post by Lucss21a »

adespoton wrote: Fri May 13, 2022 2:59 pm I can't be much help as I compile my variations using xCode on macOS. However, on there, GCC actually maps to LLVM. Is it possible it's actually expecting this? Or could it be that your path depth is too deep and you need to store the files closer to root?

I'm pretty sure Paul's variations service actually runs on Linux, so it should be possible to do, once a few environment related issues have been sorted.
So i have mingw-w64-gcc, cygwin-gcc, clang and gcc
Which one should I use?
User avatar
egrath
Space Cadet
Posts: 7
Joined: Fri May 13, 2022 6:20 am

Re: Compiling custom Mini vMac builds on Cygwin

Post by egrath »

Hi,

if you want to use Cygwin to build a version which can run on Windows, i strongly recommend you to use WSL with MinGW as the cross compiler, as it allows you to build standalone executables with no additional dependencies on the Cygwin Runtime/Translation layer.

Short description on how to build with WSL - i have taken the relevant steps from my own documentation on how to build it:

1. Install WSL
2. Install MinGW:

Code: Select all

apt-get install mingw-w64
3. Install SDL prebuilt for MinGW:

Code: Select all

wget https://www.libsdl.org/release/SDL2-devel-2.0.22-mingw.tar.gz
gzip -dc SDL2-devel-2.0.22-mingw.tar.gz | tar -xvf -
cd SDL2-2.0.22
sudo make install-package arch=x86_64-w64-mingw32 prefix=/usr/x86_64-w64-mingw32
4. In vMac Mini's source directory:

Code: Select all

gcc setup/tool.c -o setup_t

# needed to overcoming some limitations
# in the build system
ln -s /usr/bin/x86_64-w64-mingw32-gcc gcc.exe
ln -s /usr/bin/x86_64-w64-mingw32-windres windres.exe
ln -s /usr/bin/x86_64-w64-mingw32-strip strip.exe
ln -s src SRC
export PATH=.:$PATH

# for Macintosh SE
./setup_t -n "minivmac-3.7-test" -e mgw -t wx64 -m SEFDHD -hres 512 -vres 384 -depth 0 -fullscreen 0 -magnify 1 -sound 1 -sony-sum 1 -
sony-tag 1 -speed 1 -ta 2 -em-cpu 2 -mem 4M -chr 0 > setup.sh

# patch the setup file for Windows SDL2 issue with WinMain undefined reference
sed -i '/.*SDL\.h/i printf \"%s\\n\" \"#define SDL_MAIN_HANDLED\" \>\> \"\$\{DestFile\}\"' setup.sh

. setup.sh
export PATH=.:$PATH
make clean
make -j $(nproc)
Hope that helps! If any questions pop up, just ask!
User avatar
Lucss21a
Student Driver
Posts: 13
Joined: Sat Mar 05, 2022 1:03 pm
Contact:

Re: Compiling custom Mini vMac builds on Cygwin

Post by Lucss21a »

egrath wrote: Sat May 14, 2022 7:20 pm Hi,

if you want to use Cygwin to build a version which can run on Windows, i strongly recommend you to use WSL with MinGW as the cross compiler, as it allows you to build standalone executables with no additional dependencies on the Cygwin Runtime/Translation layer.

Short description on how to build with WSL - i have taken the relevant steps from my own documentation on how to build it:

1. Install WSL
2. Install MinGW:

Code: Select all

apt-get install mingw-w64
3. Install SDL prebuilt for MinGW:

Code: Select all

wget https://www.libsdl.org/release/SDL2-devel-2.0.22-mingw.tar.gz
gzip -dc SDL2-devel-2.0.22-mingw.tar.gz | tar -xvf -
cd SDL2-2.0.22
sudo make install-package arch=x86_64-w64-mingw32 prefix=/usr/x86_64-w64-mingw32
4. In vMac Mini's source directory:

Code: Select all

gcc setup/tool.c -o setup_t

# needed to overcoming some limitations
# in the build system
ln -s /usr/bin/x86_64-w64-mingw32-gcc gcc.exe
ln -s /usr/bin/x86_64-w64-mingw32-windres windres.exe
ln -s /usr/bin/x86_64-w64-mingw32-strip strip.exe
ln -s src SRC
export PATH=.:$PATH

# for Macintosh SE
./setup_t -n "minivmac-3.7-test" -e mgw -t wx64 -m SEFDHD -hres 512 -vres 384 -depth 0 -fullscreen 0 -magnify 1 -sound 1 -sony-sum 1 -
sony-tag 1 -speed 1 -ta 2 -em-cpu 2 -mem 4M -chr 0 > setup.sh

# patch the setup file for Windows SDL2 issue with WinMain undefined reference
sed -i '/.*SDL\.h/i printf \"%s\\n\" \"#define SDL_MAIN_HANDLED\" \>\> \"\$\{DestFile\}\"' setup.sh

. setup.sh
export PATH=.:$PATH
make clean
make -j $(nproc)
Hope that helps! If any questions pop up, just ask!
Hello, but I used Windows 10 Pro 1809, so I think WSL wouldn't work for me... Can you please tell me if WSL is compatible with older Windows 10 builds (or 1809 to be exact)?
User avatar
egrath
Space Cadet
Posts: 7
Joined: Fri May 13, 2022 6:20 am

Re: Compiling custom Mini vMac builds on Cygwin

Post by egrath »

Hi, as far as i know, WSL 1 works on 1809. There are plenty of tutorials out there on how to install it. Just do a short Google Research (TM), its as easy as running a few commands.
User avatar
Lucss21a
Student Driver
Posts: 13
Joined: Sat Mar 05, 2022 1:03 pm
Contact:

Re: Compiling custom Mini vMac builds on Cygwin

Post by Lucss21a »

egrath wrote: Sun May 15, 2022 7:55 am Hi, as far as i know, WSL 1 works on 1809. There are plenty of tutorials out there on how to install it. Just do a short Google Research (TM), its as easy as running a few commands.
I have automated scripts for minivmac already that can make the makefiles and stuff, can i use them?
I used this:

Code: Select all

./setup_t -t wx64 -m 128K > 128k.sh && chmod +x 128k.sh
./setup_t -t wx64 -m 512Ke > 512Ke.sh && chmod +x 512Ke.sh
./setup_t -t wx64 -m Plus > Plus.sh && chmod +x Plus.sh
./setup_t -t wx64 -m SE > SE.sh && chmod +x SE.sh
./setup_t -t wx64 -m Classic > Classic.sh && chmod +x Classic.sh
./setup_t -t wx64 -m SEFDHD > SEFDHD.sh && chmod +x SEFDHD.sh
./setup_t -t wx64 -m II > MacII.sh && chmod +x MacII.sh
./setup_t -t wx64 -m Twiggy > Twiggy.sh && chmod +x Twiggy.sh
./setup_t -t wx64 -m Twig43 > Twiggy43.sh && chmod +x Twiggy43.sh
./setup_t -t wx64 -m PB100 > PowerBook100.sh && chmod +x PowerBook100.sh
./setup_t -t wx64 -m II -hres 960 -vres 540 -depth 5 -n "mini-vmac-36.04-maciicustom"  > MacIICustom.sh && chmod +x MacIICustom.sh
./setup_t -t wx64 -m Plus -hres 960 -vres 540 -n "mini-vmac-36.04-pluscustom"  > PlusCustom.sh && chmod +x PlusCustom.sh
./setup_t -t wx64 -m 128K -hres 960 -vres 540 -n "mini-vmac-36.04-128kcustom"  > 128kCustom.sh && chmod +x 128kCustom.sh
ls -lu
cp *.sh Windows
rm -rf *.sh
User avatar
Lucss21a
Student Driver
Posts: 13
Joined: Sat Mar 05, 2022 1:03 pm
Contact:

Re: Compiling custom Mini vMac builds on Cygwin

Post by Lucss21a »

egrath wrote: Sat May 14, 2022 7:20 pm Hi,

if you want to use Cygwin to build a version which can run on Windows, i strongly recommend you to use WSL with MinGW as the cross compiler, as it allows you to build standalone executables with no additional dependencies on the Cygwin Runtime/Translation layer.

Short description on how to build with WSL - i have taken the relevant steps from my own documentation on how to build it:

1. Install WSL
2. Install MinGW:

Code: Select all

apt-get install mingw-w64
3. Install SDL prebuilt for MinGW:

Code: Select all

wget https://www.libsdl.org/release/SDL2-devel-2.0.22-mingw.tar.gz
gzip -dc SDL2-devel-2.0.22-mingw.tar.gz | tar -xvf -
cd SDL2-2.0.22
sudo make install-package arch=x86_64-w64-mingw32 prefix=/usr/x86_64-w64-mingw32
4. In vMac Mini's source directory:

Code: Select all

gcc setup/tool.c -o setup_t

# needed to overcoming some limitations
# in the build system
ln -s /usr/bin/x86_64-w64-mingw32-gcc gcc.exe
ln -s /usr/bin/x86_64-w64-mingw32-windres windres.exe
ln -s /usr/bin/x86_64-w64-mingw32-strip strip.exe
ln -s src SRC
export PATH=.:$PATH

# for Macintosh SE
./setup_t -n "minivmac-3.7-test" -e mgw -t wx64 -m SEFDHD -hres 512 -vres 384 -depth 0 -fullscreen 0 -magnify 1 -sound 1 -sony-sum 1 -
sony-tag 1 -speed 1 -ta 2 -em-cpu 2 -mem 4M -chr 0 > setup.sh

# patch the setup file for Windows SDL2 issue with WinMain undefined reference
sed -i '/.*SDL\.h/i printf \"%s\\n\" \"#define SDL_MAIN_HANDLED\" \>\> \"\$\{DestFile\}\"' setup.sh

. setup.sh
export PATH=.:$PATH
make clean
make -j $(nproc)
Hope that helps! If any questions pop up, just ask!
I tried but should I worry about this:

Code: Select all

src/ENDIANAC.h:101:22: warning: ‘do_put_mem_word’ defined but not used [-Wunused-function]
  101 | LOCALINLINEFUNC void do_put_mem_word(ui3p a, ui4r v)
      |                      ^~~~~~~~~~~~~~~
src/ENDIANAC.h:57:22: warning: ‘do_get_mem_long’ defined but not used [-Wunused-function]
   57 | LOCALINLINEFUNC ui5r do_get_mem_long(ui3p a)
      |                      ^~~~~~~~~~~~~~~
any idea?
User avatar
egrath
Space Cadet
Posts: 7
Joined: Fri May 13, 2022 6:20 am

Re: Compiling custom Mini vMac builds on Cygwin

Post by egrath »

These are just warnings from the compiler, just ignore these actual ones.
User avatar
Lucss21a
Student Driver
Posts: 13
Joined: Sat Mar 05, 2022 1:03 pm
Contact:

Re: Compiling custom Mini vMac builds on Cygwin

Post by Lucss21a »

How'd you compile MacOS builds inside Linux then?
and also kind of off topic but how do I use the Twiggy 4.3T ROM that's available on the MacGUI vault? I don't know how to make it work on Mini vMac...
User avatar
egrath
Space Cadet
Posts: 7
Joined: Fri May 13, 2022 6:20 am

Re: Compiling custom Mini vMac builds on Cygwin

Post by egrath »

Haven't built a Macintosh version on Linux. The description above is just for building a Windows version in Linux.

Compilerwarnings in general are non-fatal opposed to errors. They occur often when using different compilers and/or versions as they all behave a little bit different. Some of them indicate deeper problems which should be managed, some of them not. In your specific case the compiler just complains about a function which is defined, but not used anywhere.
User avatar
adespoton
Forum All-Star
Posts: 3692
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: Compiling custom Mini vMac builds on Cygwin

Post by adespoton »

Lucss21a wrote: Mon May 16, 2022 5:27 pm How'd you compile MacOS builds inside Linux then?
and also kind of off topic but how do I use the Twiggy 4.3T ROM that's available on the MacGUI vault? I don't know how to make it work on Mini vMac...
I'd say ask Paul, but he's been MIA for over a year now. If anyone DOES get in touch with him or someone from his family, please update the "Has anyone seen..." thread.

As for the Twiggy ROM, you need to use a custom Twiggy build of Mini vMac; the default 128k one won't work.

What I do instead is just use the 128k ROM and a modified version of the Twiggy disk image that runs with the 128k ROM; it's simpler, and works with an official 128k build of Mini vMac.

Info on bits of the story available here:
viewtopic.php?t=8809
http://toastytech.com/guis/twiggy.html

And of course, Paul's instructions on setting up the build environment on whatever host platform you've got, for whatever target platform you want, emulating whatever hardware platform you desire, is here: https://www.gryphel.com/c/minivmac/develop.html -- and that includes the Twiggy hardware as an option. I use the https://www.gryphel.com/c/minivmac/change/v37.html source, so that I can target an M1 Mac.
User avatar
Lucss21a
Student Driver
Posts: 13
Joined: Sat Mar 05, 2022 1:03 pm
Contact:

Re: Compiling custom Mini vMac builds on Cygwin

Post by Lucss21a »

adespoton wrote: Mon May 16, 2022 6:57 pm
Lucss21a wrote: Mon May 16, 2022 5:27 pm How'd you compile MacOS builds inside Linux then?
and also kind of off topic but how do I use the Twiggy 4.3T ROM that's available on the MacGUI vault? I don't know how to make it work on Mini vMac...
I'd say ask Paul, but he's been MIA for over a year now. If anyone DOES get in touch with him or someone from his family, please update the "Has anyone seen..." thread.

As for the Twiggy ROM, you need to use a custom Twiggy build of Mini vMac; the default 128k one won't work.

What I do instead is just use the 128k ROM and a modified version of the Twiggy disk image that runs with the 128k ROM; it's simpler, and works with an official 128k build of Mini vMac.

Info on bits of the story available here:
viewtopic.php?t=8809
http://toastytech.com/guis/twiggy.html

And of course, Paul's instructions on setting up the build environment on whatever host platform you've got, for whatever target platform you want, emulating whatever hardware platform you desire, is here: https://www.gryphel.com/c/minivmac/develop.html -- and that includes the Twiggy hardware as an option. I use the https://www.gryphel.com/c/minivmac/change/v37.html source, so that I can target an M1 Mac.
Ah, ok. I also built the version of the emulator that do support the earlier version of the Twiggy ROM as well as the version that supports the modified 128k ROM and the later 4.4T revision.
Post Reply