Page 1 of 1

Oricutron macOS 10.14: Unable to open roms

Posted: Wed Jun 12, 2019 3:45 am
by NekoNoNiaow
Hi,

I just managed to build the latest GitHub Oricutron on macOS (a story for another time) but I get the following error when launching it from the command line:

Code: Select all

$> ./oricutron -m oric1 -k none
Unable to open 'roms/microdis.rom'

Unable to open 'roms/jasmin.rom'

Unable to open 'roms/8dos2.rom'

Unable to open 'images/statusbar.bmp'
The 'roms' folder is present in the same folder as the Oricutron executable and is populated with all the .rom files found in the OSDK but for some reason Oricutron fails to open them. Access rights are fine and the files are perfectly readable.

I have not yet tried to debug that using Xcode (which I anticipate to be an absolute pain) so I figured out that maybe the kittens who already compile Oricutron on macOS have already encountered and fix this issue. If that rings a bell, thank you in advance for sharing the explanation and/or fix. ;)

Thanks!

Re: Oricutron macOS 10.14: Unable to open roms

Posted: Wed Jun 12, 2019 3:41 pm
by ibisum
I tried to build it last week and ran into the same issue. I didn't get it resolved - it seems there is some permissions/sandbox issue with regards to being able to read some files, which - for reasons I didn't
understand yet - got blacklisted in MacOS recently.

EDIT:

Code: Select all

~/Documents/Development/retro/oric/oricutron (master.j ✘)✹✭ ᐅ xattr  images/statusbar.bmp
com.apple.lastuseddate#PS
com.apple.quarantine
~/Documents/Development/retro/oric/oricutron (master.j ✘)✹✭ ᐅ ls -l images/*.bmp
-rw-r--r--  1 j  staff     824 May 12  2018 images/avirec.bmp
-rw-r--r--  1 j  staff     952 May 12  2018 images/disk_active.bmp
-rw-r--r--  1 j  staff     952 May 12  2018 images/disk_ejected.bmp
-rw-r--r--  1 j  staff     952 May 12  2018 images/disk_idle.bmp
-rw-r--r--  1 j  staff     952 May 12  2018 images/disk_modactive.bmp
-rw-r--r--  1 j  staff     952 May 12  2018 images/disk_modified.bmp
-rw-r--r--  1 j  staff  460856 May 12  2018 images/gfx_atmoskbd.bmp
-rw-r--r--  1 j  staff  460854 May 12  2018 images/gfx_oric1kbd.bmp
-rw-r--r--  1 j  staff  460854 May 12  2018 images/gfx_pravetzkbd.bmp
-rw-r--r--  1 j  staff   41098 May 27 11:57 images/status_bar.bmp
-rw-r--r--@ 1 j  staff   30776 May 25 20:15 images/statusbar.bmp
-rw-r--r--  1 j  staff    1016 May 12  2018 images/tape_ejected.bmp
-rw-r--r--  1 j  staff    1016 May 12  2018 images/tape_pause.bmp
-rw-r--r--  1 j  staff    1016 May 12  2018 images/tape_play.bmp
-rw-r--r--  1 j  staff    1016 May 12  2018 images/tape_record.bmp
-rw-r--r--  1 j  staff    1016 May 12  2018 images/tape_stop.bmp
-rw-r--r--  1 j  staff    1078 May 12  2018 images/winicon.bmp
EDIT: I just can't clear the quarantine bit, no matter what I try, i.e. 'xattr -d'.

I think on MacOS 10.14.x going forward, we have to be prepared to deal with sandbox'ing, and probably should have an 'official build' somewhere. I think Iss is doing them? Would be interesting if we could get builds for different MacOS targets somewhere along the line ..

Anyway, I will have another bash at building it locally when I get some time, and/or will tune in to whatever fixes you guys work out?

Re: Oricutron macOS 10.14: Unable to open roms

Posted: Thu Jun 13, 2019 3:14 am
by NekoNoNiaow
ibisum wrote: Wed Jun 12, 2019 3:41 pm I tried to build it last week and ran into the same issue. I didn't get it resolved - it seems there is some permissions/sandbox issue with regards to being able to read some files, which - for reasons I didn't
understand yet - got blacklisted in MacOS recently.

[...]

I think on MacOS 10.14.x going forward, we have to be prepared to deal with sandbox'ing, and probably should have an 'official build' somewhere. I think Iss is doing them? Would be interesting if we could get builds for different MacOS targets somewhere along the line ..

Anyway, I will have another bash at building it locally when I get some time, and/or will tune in to whatever fixes you guys work out?
... wait, wat? oO;

The only reason I can think of why an apparently innocuous BMP file would be blacklisted would be that it was identified by Apple as a security exploit used to execute code contained in the BMP file.
I presume that Apple is not stupid enough to only identify by its name and that they instead use a hash of some kind on its content and that they have been careful to avoid collisions, which means that your statusbar.bmp would likely contain nasty code somehow.

This said, on my side, I do not have this issue at all. (Of note, I am using the latest version from the GitHub master branch.)
Neither "ls -l@ images/*.bmp" nor "xattr" show quarantined files, same fo the .rom files that Oricutron fails to load so this seems to be specific to your machine.
Have you simply tried to delete statusbar.bmp and replace it with another file?

Here I am battling the Xcode project settings in an attempt to build and debug Oricutron from Xcode but that IDE is such a nonsensical mess (and I am being polite, all matters of insults come to mind whenever I have to interact with this piece of ... garbage) that I have trouble even configuring the build properly. I do not even understand why the Apple engineers made Xcode so painfully incomprehensible to use, these guys clearly have never used a proper IDE like Eclipse, Visual Studio or Visual Code...

If I ever succeed in building and executing it from Xcode I will likely create a pull request for my changes in GitHub so everyone can benefit but I have a feeling I am not there yet.
In passing, I had to modify the Makefile in order to have it compile on my machine, I am using the SDL.framework and the original Makefile does not support that option at all. It would be nice if Oricutron sources came with a "how to build on platform X" file explaining which dependencies to install and how/where.

Anyway, I will post if I make any progress. Cheers!

Re: Oricutron macOS 10.14: Unable to open roms

Posted: Thu Jun 13, 2019 1:56 pm
by ibisum
>Have you simply tried to delete statusbar.bmp and replace it with another file?

Yes, I've tried everything, including re-cloning. I don't get it either, but haven't had time to debug it further.

EDIT: I just tried to build the .app Target in the included Xcode project folder, and got this - which doesn't seem like the same issue as you, but nevertheless intriguing - maybe the .app bundle isn't getting the args for some reason:

Code: Select all

2019-06-13 14:58:10.384785+0200 Oricutron[36730:1542073] Failed to load test bundle from file:///Users/j/Library/Developer/Xcode/DerivedData/Oricutron-bhtjbrlegfvgoshjyigqzqvaoocr/Build/Products/Debug/Oricutron.app/Contents/PlugIns/OricutronTests.xctest/: Error Domain=NSCocoaErrorDomain Code=4 "The bundle “OricutronTests.xctest” couldn’t be loaded because its executable couldn’t be located." UserInfo={NSLocalizedFailureReason=The bundle’s executable couldn’t be located., NSLocalizedRecoverySuggestion=Try reinstalling the bundle., NSBundlePath=/Users/j/Library/Developer/Xcode/DerivedData/Oricutron-bhtjbrlegfvgoshjyigqzqvaoocr/Build/Products/Debug/Oricutron.app/Contents/PlugIns/OricutronTests.xctest, NSLocalizedDescription=The bundle “OricutronTests.xctest” couldn’t be loaded because its executable couldn’t be located.}
2019-06-13 14:58:10.440079+0200 Oricutron[36730:1542073] ApplePersistenceIgnoreState: Existing state will not be touched. New state will be written to (null)
2019-06-13 14:58:10.555623+0200 Oricutron[36730:1542073] WARNING: The Gestalt selector gestaltSystemVersion is returning 10.9.5 instead of 10.14.5. This is not a bug in Gestalt -- it is a documented limitation. Use NSProcessInfo's operatingSystemVersion property to get correct system version number.
Call location:
2019-06-13 14:58:10.555695+0200 Oricutron[36730:1542073] 0   CarbonCore                          0x00007fff52898fee ___Gestalt_SystemVersion_block_invoke + 112
2019-06-13 14:58:10.555704+0200 Oricutron[36730:1542073] 1   libdispatch.dylib                   0x00007fff7d46b63d _dispatch_client_callout + 8
2019-06-13 14:58:10.555711+0200 Oricutron[36730:1542073] 2   libdispatch.dylib                   0x00007fff7d46cd4c _dispatch_once_callout + 20
2019-06-13 14:58:10.555717+0200 Oricutron[36730:1542073] 3   CarbonCore                          0x00007fff5283a9a2 _Gestalt_SystemVersion + 945
2019-06-13 14:58:10.555722+0200 Oricutron[36730:1542073] 4   CarbonCore                          0x00007fff52833e8c Gestalt + 149
2019-06-13 14:58:10.555728+0200 Oricutron[36730:1542073] 5   SDL                                 0x00000001004e3d38 SDL_SoftStretch + 14284
2019-06-13 14:58:10.555733+0200 Oricutron[36730:1542073] 6   SDL                                 0x00000001004d9627 SDL_VideoInit + 531
Oricutron 1.2.0 (c)2014 Peter Gordon (pete@petergordon.org.uk)

Usage:	oricutron [-a|--arg [option]] [disk file] [tape file] [snapshot file]
  -m / --machine     = Specify machine type. Valid types are:

                       "atmos" or "a" for Oric Atmos
                       "oric1" or "1" for Oric-1
                       "o16k" for Oric-1 16k
                       "telestrat" or "t" for Telestrat
                       "pravetz", "pravetz8d" or "p" for Pravetz 8D

  -d / --disk        = Specify a disk image to use in drive 0
  -t / --tape        = Specify a tape image to use
  -k / --drive       = Specify a disk drive controller. Valid types are:

                       "microdisc" or "m" for Microdisc
                       "jasmin" or "j" for Jasmin
                       "pravetz" or "p" for Pravetz
                       "none" or "n"

  -s / --symbols     = Load symbols from a file
  -f / --fullscreen  = Run oricutron fullscreen
  -w / --window      = Run oricutron in a window
  -R / --rendermode  = Render mode. Valid modes are:

                       "soft" for software rendering
                       "opengl" for OpenGL

  -b / --debug       = Start oricutron in the debugger
  -r / --breakpoint  = Set a breakpoint

  --turbotape on|off = Enable or disable turbotape
  --lightpen on|off  = Enable or disable lightpen
  --vsynchack on|off = Enable or disable VSync hack
  --scanlines on|off = Enable or disable scanline simulation

  --serial_address N = Set serial card base address to N
                       where N is decimal or hexadecimal within the range of $31c..$3fc
                        (i.e. 796, 0x31c, $31C represent the same value)

  --serial <type>    = Set serial card back-end emulation:

                       "none" - no serial
                       "loopback" - for testing - all TX data is returned to RX
                       "modem[:port]" - emulates com port with attached modem,
                                        only minimal AT command set is supported and
                                        data is redirected to TCP. Default port is 23 (telnet)
                       "com:115200,8,N,1,<device>" - use real or virtual <device> on host as emulated ACIA.
                                        Baudrate, data bits, parity and stop bits can be set as needed
                                  ex.:  Windows: "com:115200,8,N,1,COM1"
                                        Linux:   "com:19200,8,N,1,/dev/ttyS0"
                                                 "com:115200,8,N,1,/dev/ttyUSB0"


Re: Oricutron macOS 10.14: Unable to open roms

Posted: Thu Jun 13, 2019 2:05 pm
by Chema
I understand you tried to clear the extended attributes with xattr -c and other combinations and none worked.

I know very little about MacOS but, did you simply try to put your sources in another file system, such as a USB pendrive with FAT? Maybe that would work, as no extended attributes exist ;)

Re: Oricutron macOS 10.14: Unable to open roms

Posted: Thu Jun 13, 2019 10:49 pm
by NekoNoNiaow
ibisum wrote: Thu Jun 13, 2019 1:56 pm >Have you simply tried to delete statusbar.bmp and replace it with another file?

Yes, I've tried everything, including re-cloning. I don't get it either, but haven't had time to debug it further.
Well, that does not make any sense, this looks like a system level bug. Deleting the file and replacing it with another must clear the issue, if it does not then maybe there is something broken with your filesystem?
I do not like to recommend that solution since so many in the Mac community use it almost religiously for any kind of problem but have you tried using DiskUtility to repair permissions on the corresponding volume?
ibisum wrote: Thu Jun 13, 2019 1:56 pm EDIT: I just tried to build the .app Target in the included Xcode project folder, and got this - which doesn't seem like the same issue as you, but nevertheless intriguing - maybe the .app bundle isn't getting the args for some reason:
It seems the app is trying to load the test bundles and as far as I could tell in my experiments these two do not build and can be removed from the project.
I would just remove them and re-build the app. Then hopefully you should be able to proceed further.
Do you remember which changes you had to do in order for the Xcode project to compile? On my end I am still far from getting there.

Re: Oricutron macOS 10.14: Unable to open roms

Posted: Fri Jun 14, 2019 2:50 am
by NekoNoNiaow
Ok, I finally found the issue with the ROMs loading.

Since Oricutron is meant to be built from Xcode as an App bundle (which is essentially a folder containing the executable and a bunch of other folders and resources), it changes the current directory, and changes it to three folders above the bundle's "Resources" directory.

When run from a .app, I suppose that this is a clumsy way to obtain the .app's folder which must work most of the way (albeit not really conform to macOS conventions).

The issue being that this prevents Oricutron from finding the roms/<file>.rom files which reside at the same level as the executable files, since the current directory is now three levels above that one.

At least that is what happens when I build the executable manually via the Makefile and run the executable from the command line in the same folder where it resides...

Now it still fails a bit later but at least I now see an SDL window even though it does not allow you to do anything with it. ;)

Onto the next issue. ;)

Re: Oricutron macOS 10.14: Unable to open roms

Posted: Fri Jun 14, 2019 7:35 am
by iss
If you didn't already take a look in the Oricutron's Makefile at 'package-osx:' receipt. There are some tricks with symlinks. Else for my builds I'm using a cross environment under Linux which does the job perfectly, but its setup is complex too. One of the goals of my builds is to avoid as much as possible the external dependencies, so I'm linking SDL as static library for all 3 platforms (Linux,Window,macOS).

Re: Oricutron macOS 10.14: Unable to open roms

Posted: Tue Jun 18, 2019 1:29 pm
by NekoNoNiaow
iss wrote: Fri Jun 14, 2019 7:35 am If you didn't already take a look in the Oricutron's Makefile at 'package-osx:' receipt. There are some tricks with symlinks. Else for my builds I'm using a cross environment under Linux which does the job perfectly, but its setup is complex too. One of the goals of my builds is to avoid as much as possible the external dependencies, so I'm linking SDL as static library for all 3 platforms (Linux,Window,macOS).
I do not recall looking at that "package-osx:" receipt thingy so far, thanks for notifying me, I will give it a look.
My main setup is a Mac so cross compilation would be clearly redundant.

I wanted to use static linking for the SDL as well but I used SDL.org supplied framework files and they allow only dynamic linking. This said, with the .app packaging mechanism of macOS (which comes from NextStep), all the necessary dependencies can be bundled alongside the application without risk of users "losing" them.

I am currently in vacation and far away from my main computer, so I only have access to Windows PCs for development so the Mac version will have to wait. I may try to build Oricutron for Windows if I have time but this is far from guaranteed. ;)