Building Basilisk II on Catalina

About BasiliskII, a 68k Mac emulator for Windows, MacOSX, and Linux that can run System 7.x through MacOS 8.1.

Moderators: Cat_7, Ronald P. Regensburg

Post Reply
User avatar
mabam
Master Emulator
Posts: 497
Joined: Wed Apr 10, 2013 9:32 am

Building Basilisk II on Catalina

Post by mabam »

I tried to build Basilisk II according to the section “Building BasiliskII and SheepShaver in OSX/macOS” at https://www.emaculation.com/doku.php/co ... r_basilisk.

I didn’t succeed in creating a universal build using Xcode 12.4 and I don’t know whether that’s possible on Catalina at all. But I just need an Intel build anyway so I used the command line instructions. There was no BasiliskII.app built and entering “make install” only results in some files being put in /usr/local/share/BasiliskII/ and in BasiliskII being copied to /usr/local/bin/ as a Unix executable.

I also tried the instructions for a universal build on https://github.com/kanjitalk755/macemu/ ... /README.md, but running “make” failed for gmp-6.2.1.

Is is at all possible to build current macemu code on Catalina?
User avatar
Ronald P. Regensburg
Expert User
Posts: 7821
Joined: Thu Feb 09, 2006 10:24 pm
Location: Amsterdam, Netherlands

Re: Building Basilisk II on Catalina

Post by Ronald P. Regensburg »

It should be possible, I built my first universal builds in Catalina on Intel.

Using the current instructions on https://github.com/kanjitalk755/macemu is easiest by far (scroll down on that page for the instructions).

For BasiliskII on macOS, first gmp 6.2.1 and mpfr 4.1.0 need to be installed, also as instructed on that page. Note that when you build on Intel, for both gmp and mpfr you need to change the configure command and ignore the make check command. (Also as instructed on kanjitalk755/macemu page.)

Use the latest Xcode version you can install in Catalina.
User avatar
mabam
Master Emulator
Posts: 497
Joined: Wed Apr 10, 2013 9:32 am

Re: Building Basilisk II on Catalina

Post by mabam »

I’m trying again in a clean Catalina VM. I’ve installed Xcode 12.4 and its Command Line Tools. I’ve also installed homebrew.

When I follow the instructions to install gmp-6.2.1 on https://github.com/kanjitalk755/macemu, after entering “CFLAGS="-arch arm64" CXXFLAGS="$CFLAGS" ./configure -host=aarch64-apple-darwin --disable-shared”, I get:

Code: Select all

checking compiler cc -arch arm64 ... no
configure: error: could not find a working compiler, see config.log for details

And in config.log it says:

Code: Select all

configure:5926: checking compiler cc -arch arm64 
Test compile: 
configure:5940: cc -arch arm64  conftest.c >&5
ld: warning: ignoring file /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/lib/libSystem.tbd, missing required architecture arm64 in file /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/lib/libSystem.tbd
ld: dynamic main executables must link with libSystem.dylib for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
configure:5943: $? = 1
failed program was:

int main () { return 0; }
configure:7030: result: no
configure:7268: error: could not find a working compiler, see config.log for details

How did you compile gmp-6.2.1 on your Catalina system? Or did you have a different way?
User avatar
Ronald P. Regensburg
Expert User
Posts: 7821
Joined: Thu Feb 09, 2006 10:24 pm
Location: Amsterdam, Netherlands

Re: Building Basilisk II on Catalina

Post by Ronald P. Regensburg »

I remember that I could not instal gmp 6.2.1 and/or mpfr 4.1.0 properly because of files with the same name that were already installed with/through homebrew, files that could not be replaced by the installation. I needed to remove those files manually first.

I cannot reproduce any of this now, because I do not have access to an Intel Mac anymore.

You can try to build for Intel only:

You may need to do some cleanup on gmp 6.2.1 and mpfr 4.1.0, and possibly homebrew, first.

SDL2.framework version 2.0.14 or later needs to be installed in /Library/Frameworks/

Install gmp 6.2.1 and mpfr 4.1.0 as described on kanjitalk755/macemu, without the changes needed to build a universal build on Intel.

Open macemu/BasiliskII/src/MacOSX/BasiliskII.xcodeproj in Xcode.
Make sure the project is set to build for "My Mac" or "Any Mac (Intel)"

Then run the build commands:

Code: Select all

$ cd macemu/BasiliskII/src/MacOSX
$ xcodebuild build -project BasiliskII.xcodeproj -configuration Release
User avatar
mabam
Master Emulator
Posts: 497
Joined: Wed Apr 10, 2013 9:32 am

Re: Building Basilisk II on Catalina

Post by mabam »

I just succeeded with a universal build.

Googling the “could not find a working compiler …” error brought up https://github.com/actions/virtual-envi ... ssues/3288. This doesn’t seem to apply for gmp 6.2.1 or mpfr 4.1.0 and I wouldn’t know how to implement this anyway. But it made me realise that the configure script of these two found /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/SDKSettings.plist which contains "x86_64" only, while they need to find /Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk/SDKSettings.plist containing "x86_64", "x86_64h", "arm64", and "arm64e".

So as a work-around I renamed /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk to MacOSX10.15.sdk.old in Finder and used its original name for a softlink to MacOSX11.1.sdk:

Code: Select all

cd /Library/Developer/CommandLineTools/SDKs
sudo ln -s MacOSX11.1.sdk MacOSX10.15.sdk
I could then compile gmp 6.2.1 and mpfr 4.1.0 for a universal build as instructed by kanjitalk755.


But step-by-step (for reference):
  1. Set up a macOS Catalina VM.
  2. • Install Xcode 12.4 + Command Line Tools for Xcode 12.4
    • Set Xcode path:

    Code: Select all

    sudo xcode-select --switch /Applications/Xcode.app
  3. Install homebrew followed by:

    Code: Select all

    brew install autoconf automake libtool
    (I’m not sure libtool is actually needed.)
  4. Download SDL2-2.0.14.dmg (or newer – as instructed in the present README.md at kanjitalk755’s macemu repo) and copy the contained folder “SDL2.framework” to /Library/Frameworks/
  5. Apply the work-around as described above.
  6. Build gmp 6.2.1 and mpfr 4.1.0 as instructed in kanjitalk755’s README.md (see link in step 4).
  7. Reverse the above work-around.
  8. cd into macemu/BasiliskII/src/MacOSX/ and compile:

    Code: Select all

    xcodebuild build -project BasiliskII.xcodeproj -configuration Release
  9. Find “BasiliskII.app” in ~/Documents/macemu/BasiliskII/src/MacOSX/build/Release/
I can’t test the arm64 part of the compilation as I don’t have access to an Apple Silicon Mac.

But:
I used the latest code from kanjitalk755’s repo and I actually found the etherhelper tool working in the self-compiled Basilisk II app.
Last edited by mabam on Mon Dec 06, 2021 10:45 pm, edited 2 times in total.
User avatar
Ronald P. Regensburg
Expert User
Posts: 7821
Joined: Thu Feb 09, 2006 10:24 pm
Location: Amsterdam, Netherlands

Re: Building Basilisk II on Catalina

Post by Ronald P. Regensburg »

Good find!
I am interested to hear kanjitalk755 comment on your workaround.

I can’t test the arm64 part of the compilation as I don’t have access to an Apple Silicon Mac.
If you send a link in a PM, I can test it on my M1 iMac.
User avatar
mabam
Master Emulator
Posts: 497
Joined: Wed Apr 10, 2013 9:32 am

Re: Building Basilisk II on Catalina

Post by mabam »

Ronald P. Regensburg wrote: Sun Dec 05, 2021 9:39 pm
I can’t test the arm64 part of the compilation as I don’t have access to an Apple Silicon Mac.
If you send a link in a PM, I can test it on my M1 iMac.

PM sent
kanjitalk755
Apple Corer
Posts: 239
Joined: Thu Nov 09, 2017 12:06 pm

Re: Building Basilisk II on Catalina

Post by kanjitalk755 »

mabam wrote: Sun Dec 05, 2021 6:07 pm So as a work-around I renamed /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk to MacOSX10.15.sdk.old in Finder and used its original name for a softlink to MacOSX11.1.sdk:
Older versions of CommandLineTools are source of trouble.
It's a good idea to select Xcode unless you really need other versions.
mabam wrote: Sun Dec 05, 2021 6:07 pm

Code: Select all

sudo xcode-select -switch /Applications/Xcode.app
User avatar
Ronald P. Regensburg
Expert User
Posts: 7821
Joined: Thu Feb 09, 2006 10:24 pm
Location: Amsterdam, Netherlands

Re: Building Basilisk II on Catalina

Post by Ronald P. Regensburg »

@ mabam:
Your build runs fine natively on my M1 iMac.
User avatar
mabam
Master Emulator
Posts: 497
Joined: Wed Apr 10, 2013 9:32 am

Re: Building Basilisk II on Catalina

Post by mabam »

kanjitalk755 wrote: Mon Dec 06, 2021 4:09 am
mabam wrote: Sun Dec 05, 2021 6:07 pm So as a work-around I renamed /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk to MacOSX10.15.sdk.old in Finder and used its original name for a softlink to MacOSX11.1.sdk:
Older versions of CommandLineTools are source of trouble.
It's a good idea to select Xcode unless you really need other versions.
mabam wrote: Sun Dec 05, 2021 6:07 pm

Code: Select all

sudo xcode-select -switch /Applications/Xcode.app
I actually used “--switch” (with two hyphens). Just fixed that in my original post.

When googling for it, I also found people sometimes use:

Code: Select all

xcode-select --switch /Library/Developer/CommandLineTools
But that didn’t help for compiling gmp or mpfr either.
There’s probably a better way to do it than my work-around, but I wouldn’t know how.
User avatar
mabam
Master Emulator
Posts: 497
Joined: Wed Apr 10, 2013 9:32 am

Re: Building Basilisk II on Catalina

Post by mabam »

Ronald P. Regensburg wrote: Mon Dec 06, 2021 8:30 am @ mabam:
Your build runs fine natively on my M1 iMac.
Thank you, that’s good to hear!
User avatar
mabam
Master Emulator
Posts: 497
Joined: Wed Apr 10, 2013 9:32 am

Re: Building Basilisk II on Catalina

Post by mabam »

How would I compile with VDE (discussed here: viewtopic.php?t=10076)? It seems I have to add “--with-vdeplug” but

Code: Select all

xcodebuild build -project BasiliskII.xcodeproj -configuration Release --with-vdeplug
doesn’t work.

I guess this switch is to be use with the configure command, but how do I run that together with xcodebuild so I get a universal build?

In macemu/BasiliskII/src/Unix/, when running

Code: Select all

./configure --with-vdeplug
or

Code: Select all

./autogen.sh --with-vdeplug
the switch seems to be accepted, but I get

Code: Select all

./configure: line 7134: syntax error near unexpected token `sdl2,'
./configure: line 7134: `      PKG_CHECK_MODULES(sdl2, sdl2 >= 2.0,'
kanjitalk755
Apple Corer
Posts: 239
Joined: Thu Nov 09, 2017 12:06 pm

Re: Building Basilisk II on Catalina

Post by kanjitalk755 »

I modified the Xcode Project for testing VDE.

Code: Select all

$ brew install vde
And try:
https://github.com/kanjitalk755/macemu/tree/test_vde

I recommend Debug target.
User avatar
mabam
Master Emulator
Posts: 497
Joined: Wed Apr 10, 2013 9:32 am

Re: Building Basilisk II on Catalina

Post by mabam »

Thanks a lot @kanjitalk755!

When trying to compile according to your instructions I get:

Code: Select all

/Users/mabam/Documents/macemu-test_vde/BasiliskII/src/Unix/ether_unix.cpp:90:10: fatal error: 
      'libvdeplug.h' file not found
#include <libvdeplug.h>
         ^~~~~~~~~~~~~~
1 error generated.

[…]

** BUILD FAILED **


The following build commands failed:
	CompileC /Users/mabam/Documents/macemu-test_vde/BasiliskII/src/MacOSX/build/BasiliskII.build/Debug/BasiliskII.build/Objects-normal/arm64/ether_unix.o /Users/mabam/Documents/macemu-test_vde/BasiliskII/src/Unix/ether_unix.cpp normal arm64 c++ com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
I think that’s because brew installs vde only for x86_64 as that’s what I’m running on.
For gmp and mpfr it was fine to compile for arm64 only as they were only needed for that part of the universal binary. But vde is needed for both parts.

So my plan was to compile vde from https://downloads.sourceforge.net/proje ... 3.2.tar.gz for arm64 and use the package installed via brew for x86_64, while making sure the respective locations match the header search paths in line 1041 and 1050 of macemu/BasiliskII/src/MacOSX/BasiliskII.xcodeproj/project.pbxproj.

I used the workaround described earlier above:
mabam wrote: Sun Dec 05, 2021 6:07 pm So as a work-around I renamed /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk to MacOSX10.15.sdk.old in Finder and used its original name for a softlink to MacOSX11.1.sdk:
with the configure command from the present README.md intended for gmp and mpfr, but failed:

Code: Select all

% CFLAGS="-arch arm64" CXXFLAGS="$CFLAGS" ./configure -host=aarch64-apple-darwin --disable-shared
configure: WARNING: if you wanted to set the --build type, don't use --host.
    If a cross compiler is detected then cross compile mode will be used
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for aarch64-apple-darwin-strip... no
checking for strip... strip
checking for a thread-safe mkdir -p... ./install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking for aarch64-apple-darwin-g++... no
checking for aarch64-apple-darwin-c++... no
checking for aarch64-apple-darwin-gpp... no
checking for aarch64-apple-darwin-aCC... no
checking for aarch64-apple-darwin-CC... no
checking for aarch64-apple-darwin-cxx... no
checking for aarch64-apple-darwin-cc++... no
checking for aarch64-apple-darwin-cl.exe... no
checking for aarch64-apple-darwin-FCC... no
checking for aarch64-apple-darwin-KCC... no
checking for aarch64-apple-darwin-RCC... no
checking for aarch64-apple-darwin-xlC_r... no
checking for aarch64-apple-darwin-xlC... no
checking for g++... g++
checking whether the C++ compiler works... yes
checking for C++ compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... yes
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking for style of include used by make... GNU
checking dependency style of g++... gcc3
checking for aarch64-apple-darwin-gcc... no
checking for gcc... gcc
configure: WARNING: using cross tools not prefixed with host triplet
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking dependency style of gcc... gcc3
checking whether ln -s works... yes
checking build system type... x86_64-apple-darwin19.6.0
checking host system type... Invalid configuration `aarch64-apple-darwin': machine `aarch64-apple' not recognized
configure: error: /bin/sh ./config.sub aarch64-apple-darwin failed

So I decided to approach it differently:
–> This is for compiling on an Intel machine only. On Apple Silicon one would probably also need a workaround, but a different one.

For the x86_64 part, I just installed via homebrew as already mentioned above:

Code: Select all

brew install vde

For arm64, I downloaded the Big Sur bottle from brew which is already compiled (instructions found at https://stackoverflow.com/a/69858397/11521718) and then linked it to /opt/homebrew:

Code: Select all

pkgname=vde_2.3.2_arm64_big_sur
curl -L -H "Authorization: Bearer QQ==" -o "$pkgname".tar.gz https://ghcr.io/v2/homebrew/core/vde/blobs/sha256:d504166629275fb173304ee78b134a6c5b5eabba65c054f2fede1949204382dd && \
mkdir "$pkgname" && tar xf "$pkgname".tar.gz -C "$pkgname" --strip-components 2 && \
[ ! -d "/opt/homebrew/" ] && sudo ln -s "$PWD/$pkgname" /opt/homebrew || echo "Could not create link to /opt/homebrew as it already exists."
The link command in the last line is kind of a dirty shortcut that only results in a correct location if “homebrew” does not yet exist in /opt. So I put a check in front and an error message in case it does already exist.

But that also failed to compile:

Code: Select all

ld: warning: ignoring file /opt/homebrew/lib/libvdeplug.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
Undefined symbols for architecture x86_64:
  "_vde_close", referenced from:
      ether_exit() in ether_unix.o
  "_vde_datafd", referenced from:
      ether_init() in ether_unix.o
  "_vde_open_real", referenced from:
      ether_init() in ether_unix.o
  "_vde_recv", referenced from:
      ether_do_interrupt() in ether_unix.o
  "_vde_send", referenced from:
      ether_do_write(unsigned int) in ether_unix.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

CompileC /Users/mabam/Documents/macemu-test_vde/BasiliskII/src/MacOSX/build/BasiliskII.build/Debug/BasiliskII.build/Objects-normal/arm64/utils_macosx.o /Users/mabam/Documents/macemu-test_vde/BasiliskII/src/MacOSX/utils_macosx.mm normal arm64 objective-c++ com.apple.compilers.llvm.clang.1_0.compiler (in target 'BasiliskII' from project 'BasiliskII')
    cd /Users/mabam/Documents/macemu-test_vde/BasiliskII/src/MacOSX
    export LANG\=en_US.US-ASCII
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x objective-c++ -target arm64-apple-macos10.7 -fmessage-length\=80 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit\=0 -fcolor-diagnostics -stdlib\=libc++ -Wno-trigraphs -O0 -fno-common -Wno-missing-field-initializers -Wno-missing-prototypes -Werror\=return-type -Wdocumentation -Wunreachable-code -Wno-implicit-atomic-properties -Wno-objc-interface-ivars -Wno-arc-repeated-use-of-weak -Wno-non-virtual-dtor -Wno-overloaded-virtual -Wno-exit-time-destructors -Wno-missing-braces -Wparentheses -Wno-switch -Wunused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wuninitialized -Wconditional-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion -Wno-float-conversion -Wno-non-literal-null-conversion -Wno-objc-literal-conversion -Wshorten-64-to-32 -Wno-newline-eof -Wno-selector -Wno-strict-selector-match -Wundeclared-selector -Wno-deprecated-implementations -Wno-c++11-extensions -DHAVE_CONFIG_H -DUSE_XCODE\=1 -DDEBUG\=1 -DHAVE_LIBVDEPLUG -DOBJC_OLD_DISPATCH_PROTOTYPES\=0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk -fstrict-aliasing -Wprotocol -Wdeprecated-declarations -Winvalid-offsetof -g -Wno-sign-conversion -Winfinite-recursion -Wno-move -Wno-comma -Wno-block-capture-autoreleasing -Wno-strict-prototypes -Wno-range-loop-analysis -Wno-semicolon-before-method-body -iquote /Users/mabam/Documents/macemu-test_vde/BasiliskII/src/MacOSX/build/BasiliskII.build/Debug/BasiliskII.build/BasiliskII-generated-files.hmap -I/Users/mabam/Documents/macemu-test_vde/BasiliskII/src/MacOSX/build/BasiliskII.build/Debug/BasiliskII.build/BasiliskII-own-target-headers.hmap -I/Users/mabam/Documents/macemu-test_vde/BasiliskII/src/MacOSX/build/BasiliskII.build/Debug/BasiliskII.build/BasiliskII-all-target-headers.hmap -iquote /Users/mabam/Documents/macemu-test_vde/BasiliskII/src/MacOSX/build/BasiliskII.build/Debug/BasiliskII.build/BasiliskII-project-headers.hmap -I/Users/mabam/Documents/macemu-test_vde/BasiliskII/src/MacOSX/build/Debug/include -I/opt/homebrew/include -I/Library/Frameworks/SDL2.framework/Headers -I../MacOSX -I../include -I../uae_cpu_2021 -I../Unix -I../slirp -I/Users/mabam/Documents/macemu-test_vde/BasiliskII/src/MacOSX/build/BasiliskII.build/Debug/BasiliskII.build/DerivedSources-normal/arm64 -I/Users/mabam/Documents/macemu-test_vde/BasiliskII/src/MacOSX/build/BasiliskII.build/Debug/BasiliskII.build/DerivedSources/arm64 -I/Users/mabam/Documents/macemu-test_vde/BasiliskII/src/MacOSX/build/BasiliskII.build/Debug/BasiliskII.build/DerivedSources -F/Users/mabam/Documents/macemu-test_vde/BasiliskII/src/MacOSX/build/Debug -F/Library/Frameworks -MMD -MT dependencies -MF /Users/mabam/Documents/macemu-test_vde/BasiliskII/src/MacOSX/build/BasiliskII.build/Debug/BasiliskII.build/Objects-normal/arm64/utils_macosx.d --serialize-diagnostics /Users/mabam/Documents/macemu-test_vde/BasiliskII/src/MacOSX/build/BasiliskII.build/Debug/BasiliskII.build/Objects-normal/arm64/utils_macosx.dia -c /Users/mabam/Documents/macemu-test_vde/BasiliskII/src/MacOSX/utils_macosx.mm -o /Users/mabam/Documents/macemu-test_vde/BasiliskII/src/MacOSX/build/BasiliskII.build/Debug/BasiliskII.build/Objects-normal/arm64/utils_macosx.o

** BUILD FAILED **


The following build commands failed:
	Ld /Users/mabam/Documents/macemu-test_vde/BasiliskII/src/MacOSX/build/BasiliskII.build/Debug/BasiliskII.build/Objects-normal/x86_64/Binary/BasiliskII normal x86_64
(1 failure)

If I do not use the separate homebrew bottle for arm64 but link the x86_64 version to /opt/homebrew:

Code: Select all

sudo ln -s /usr/local/Cellar/vde/2.3.2_1 /opt/homebrew
I get this:

Code: Select all

ld: warning: ignoring file /opt/homebrew/lib/libvdeplug.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
Undefined symbols for architecture arm64:
  "_vde_close", referenced from:
      ether_exit() in ether_unix.o
  "_vde_datafd", referenced from:
      ether_init() in ether_unix.o
  "_vde_open_real", referenced from:
      ether_init() in ether_unix.o
  "_vde_recv", referenced from:
      ether_do_interrupt() in ether_unix.o
  "_vde_send", referenced from:
      ether_do_write(unsigned int) in ether_unix.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

** BUILD FAILED **


The following build commands failed:
	Ld /Users/markus/Documents/macemu-test_vde/BasiliskII/src/MacOSX/build/BasiliskII.build/Debug/BasiliskII.build/Objects-normal/arm64/Binary/BasiliskII normal arm64
(1 failure)

Any ideas as to how I can fix that?
kanjitalk755
Apple Corer
Posts: 239
Joined: Thu Nov 09, 2017 12:06 pm

Re: Building Basilisk II on Catalina

Post by kanjitalk755 »

Maybe no one has tested the VDE option except for linux platform.
The first thing to do is to find out if it works on mac platform.
The Debug target is set to build only the active target, so try it.
User avatar
adespoton
Forum All-Star
Posts: 4208
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: Building Basilisk II on Catalina

Post by adespoton »

I already have VDE installed on M1 Monterey, but haven't attempted using it with BII yet.
User avatar
mabam
Master Emulator
Posts: 497
Joined: Wed Apr 10, 2013 9:32 am

Re: Building Basilisk II on Catalina

Post by mabam »

I just tried different things.

I am only able to compile the vde_test branch if I first delete the softlink at /opt/homebrew, open BasiliskII.xcodeproj in Xcode and select “Product –> Scheme –> Basilisk II” and “Product –> Destination –> My Mac”. I don’t edit the scheme which means its setting stays on a debug (if I select “release”, it fails to build). But the resulting BasiliskII.app is not able to launch.

This is from the Problem Report:

Code: Select all

Process:               BasiliskII [1908]
Path:                  /Applications/Basilisk II Kopie 2/BasiliskII.app/Contents/MacOS/BasiliskII
Identifier:            net.cebix.basilisk
Version:               Basilisk II 1.0, SDL2 port (???)
Code Type:             X86-64 (Native)
Parent Process:        ??? [1]
Responsible:           BasiliskII [1908]
User ID:               501

Date/Time:             2021-12-09 15:38:48.428 +0100
OS Version:            Mac OS X 10.15.7 (19H1323)
Report Version:        12
Anonymous UUID:        81648973-6621-C753-7E76-1C12D18CA3D0

Sleep/Wake UUID:       186E2EBC-CE43-48F2-B94C-51065EA375DB

Time Awake Since Boot: 10000 seconds
Time Since Wake:       3700 seconds

System Integrity Protection: disabled

Crashed Thread:        0

Exception Type:        EXC_CRASH (SIGABRT)
Exception Codes:       0x0000000000000000, 0x0000000000000000
Exception Note:        EXC_CORPSE_NOTIFY

Termination Reason:    DYLD, [0x1] Library missing

Application Specific Information:
dyld: launch, loading dependent libraries

Dyld Error Message:
  Library not loaded: /usr/local/opt/vde/lib/libvdeplug.3.dylib
  Referenced from: /Applications/Basilisk II Kopie 2/BasiliskII.app/Contents/MacOS/BasiliskII
  Reason: image not found

Binary Images:
            0x4000 -           0x307ff7 +net.cebix.basilisk (Basilisk II 1.0, SDL2 port - ???) <3D63A7F0-42F8-3FF5-8B67-E67FF2BF93FF> /Applications/Basilisk II Kopie 2/BasiliskII.app/Contents/MacOS/BasiliskII
         0x1490000 -          0x1522267  dyld (750.7) <FCEF919F-F7F8-3C1A-B208-7ECDCB5EA674> /usr/lib/dyld
User avatar
adespoton
Forum All-Star
Posts: 4208
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: Building Basilisk II on Catalina

Post by adespoton »

One thing to note (which you already likely know, but for other users): M1 Homebrew has a different path than x86_64 Homebrew, so using full path instead of variables and inferred paths is likely to cause breakages. M1 homebrew is at /opt/homebrew/ and x86 at /usr/local/homebrew/ .

Since Catalina won't have anything at /opt/homebrew/ by default, you may encounter issues. One potential fix is to symlink /usr/local/homebrew to /opt/homebrew. That way, you'll have the right paths on Catalina, and they'll still map correctly on M1.
User avatar
mabam
Master Emulator
Posts: 497
Joined: Wed Apr 10, 2013 9:32 am

Re: Building Basilisk II on Catalina

Post by mabam »

Yes, that’s similar to what I did here:
mabam wrote: Wed Dec 08, 2021 12:25 pm For arm64, I downloaded the Big Sur bottle from brew which is already compiled (instructions found at https://stackoverflow.com/a/69858397/11521718) and then linked it to /opt/homebrew:

Code: Select all

pkgname=vde_2.3.2_arm64_big_sur
curl -L -H "Authorization: Bearer QQ==" -o "$pkgname".tar.gz https://ghcr.io/v2/homebrew/core/vde/blobs/sha256:d504166629275fb173304ee78b134a6c5b5eabba65c054f2fede1949204382dd && \
mkdir "$pkgname" && tar xf "$pkgname".tar.gz -C "$pkgname" --strip-components 2 && \
[ ! -d "/opt/homebrew/" ] && sudo ln -s "$PWD/$pkgname" /opt/homebrew || echo "Could not create link to /opt/homebrew as it already exists."
The link command in the last line is kind of a dirty shortcut that only results in a correct location if “homebrew” does not yet exist in /opt. So I put a check in front and an error message in case it does already exist.
I used the homebrew Big Sur arm64 bottle for that as first I thought precompiled VDE would get used, similar to gmp and mpfr for arm64 builds.
But choosing “Product –> Destination –> Any Mac” (universal) didn’t build successfully; choosing “My Mac” (Intel only) did, though the app didn’t launch.

But for now it probably makes sense that only Intel builds, since kanjitalk755 wrote:
kanjitalk755 wrote: Thu Dec 09, 2021 12:34 am The Debug target is set to build only the active target, so try it.
User avatar
mabam
Master Emulator
Posts: 497
Joined: Wed Apr 10, 2013 9:32 am

Re: Building Basilisk II on Catalina

Post by mabam »

mabam wrote: Thu Dec 09, 2021 5:10 pm I used the homebrew Big Sur arm64 bottle for that as first I thought precompiled VDE would get used, similar to gmp and mpfr for arm64 builds.
Okay, forget what I wrote … It dawns to me that I got it even wronger than I thought.

The way gmp and mpfr were integrated when compiling got me on the wrong track. I first thought precompiled VDE was needed in order to get packed into BasiliskII.app at compile time. Then I thought I was wrong about the first part and it would be part of VDE’s source that was used for compilation. But now I realise that VDE is not only needed for compilation, but the machine where BasiliskII.app gets installed also needs to have VDE installed. :oops:

I had VDE installed in my VM with the build environment, but not on my host where the build mentioned in my post from almost seven hours ago failed to launch.
Now, with VDE installed on my host, the Basilisk II build does launch!
Find BasiliskII_testVDE_intel_debug.zip at https://c.web.de/@337526389169198226/Yi ... XaxP0sxWmw.

Next step is to figure out what to put in ~/.basilisk_ii_prefs after “ether”.
Any help is very much appreciated (as I’m quite clueless so far …)!

EDIT:
When entering ifconfig in Terminal, I see that the VDE install has added en2, en4, bridge100, and bridge101:

Code: Select all

en2: flags=8b63<UP,BROADCAST,SMART,RUNNING,PROMISC,ALLMULTI,SIMPLEX,MULTICAST> mtu 1500
	options=400<CHANNEL_IO>
	ether 0a:95:5f:14:0d:d3 
	media: autoselect
	status: active
en4: flags=8963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
	options=400<CHANNEL_IO>
	ether d6:b1:f7:71:b4:b5 
	media: autoselect
	status: active
bridge100: flags=8a63<UP,BROADCAST,SMART,RUNNING,ALLMULTI,SIMPLEX,MULTICAST> mtu 1500
	options=3<RXCSUM,TXCSUM>
	ether e2:d5:5e:3b:f1:64 
	inet 192.168.105.1 netmask 0xffffff00 broadcast 192.168.105.255
	inet6 fe80::1c3a:dfbf:a3c2:b77e%bridge100 prefixlen 64 secured scopeid 0xc 
	inet6 fd4a:ce45:61e6:4b4a:831:87a0:5b08:30eb prefixlen 64 autoconf secured 
	inet6 fd4a:ce45:61e6:4b4a:cc29:d91:e416:fa66 prefixlen 64 autoconf temporary 
	Configuration:
		id 0:0:0:0:0:0 priority 0 hellotime 0 fwddelay 0
		maxage 0 holdcnt 0 proto stp maxaddr 100 timeout 1200
		root id 0:0:0:0:0:0 priority 0 ifcost 0 port 0
		ipfilter disabled flags 0x0
	member: en2 flags=3<LEARNING,DISCOVER>
	        ifmaxaddr 0 port 10 priority 0 path cost 0
	nd6 options=201<PERFORMNUD,DAD>
	media: autoselect
	status: active
bridge101: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
	options=3<RXCSUM,TXCSUM>
	ether e2:d5:5e:3b:f1:65 
	Configuration:
		id 0:0:0:0:0:0 priority 0 hellotime 0 fwddelay 0
		maxage 0 holdcnt 0 proto stp maxaddr 100 timeout 1200
		root id 0:0:0:0:0:0 priority 0 ifcost 0 port 0
		ipfilter disabled flags 0x0
	member: en0 flags=3<LEARNING,DISCOVER>
	        ifmaxaddr 0 port 5 priority 0 path cost 0
	member: en4 flags=3<LEARNING,DISCOVER>
	        ifmaxaddr 0 port 11 priority 0 path cost 0
	media: autoselect
	status: active
bridge100 has en2 as member, bridge101 en0 and en4. But neither configuring Basilisk II with “ether en2” nor with “ether en4” gives it network access (would have been too easy …).
Last edited by mabam on Fri Dec 10, 2021 2:09 am, edited 1 time in total.
kanjitalk755
Apple Corer
Posts: 239
Joined: Thu Nov 09, 2017 12:06 pm

Re: Building Basilisk II on Catalina

Post by kanjitalk755 »

According to ether_unix.cpp, it looks good as follows.

Code: Select all

ether vde
User avatar
mabam
Master Emulator
Posts: 497
Joined: Wed Apr 10, 2013 9:32 am

Re: Building Basilisk II on Catalina

Post by mabam »

I’ll be busy the coming days and it probably won’t be before next weekend until I can continue working on this.
User avatar
mabam
Master Emulator
Posts: 497
Joined: Wed Apr 10, 2013 9:32 am

Re: Building Basilisk II on Catalina

Post by mabam »

I really would like to get this going. I just have less time than I hoped at the moment. Have to postpone until next year.
Post Reply