alsbury / spice2json

Utility to generate a basic JSON representation of a SpiceDB Schema
MIT License
4 stars 1 forks source link

Binary is getting killed #3

Open AlexeyRaga opened 5 months ago

AlexeyRaga commented 5 months ago

First, thanks for the project!

I am trying to use published binary to run on my MacOS M3 I get an error:

cannot be opened because the developer cannot be verified.

OK, this seems to be workaroundable, and I try to fix it with:

$ sudo xattr -r -d com.apple.quarantine spice2json

The verification message disappears, but now I see just killed:

$ ./spice2json
[1]    43271 killed     ./spice2json

The file seems to be right:

$ file spice2json
spice2json: Mach-O 64-bit executable arm64

I am not a Golang dev, just trying to use the utility, so can't say anything... But maybe some external libs are not getting statically linked or something similar?...

AlexeyRaga commented 5 months ago

Found the issue! upx doesn't work for MacOS.

Here is what I did:

$ upx spice2json-local
                       Ultimate Packer for eXecutables
                          Copyright (C) 1996 - 2024
UPX 4.2.3       Markus Oberhumer, Laszlo Molnar & John Reiser   Mar 27th 2024

        File size         Ratio      Format      Name
   --------------------   ------   -----------   -----------
upx: spice2json-ben: CantPackException: macOS is currently not supported (try --force-macos)

Packed 0 files.

$ upx spice2json-local --force-macos
                       Ultimate Packer for eXecutables
                          Copyright (C) 1996 - 2024
UPX 4.2.3       Markus Oberhumer, Laszlo Molnar & John Reiser   Mar 27th 2024

        File size         Ratio      Format      Name
   --------------------   ------   -----------   -----------
  27154864 ->  11452432   42.17%   macho/arm64   spice2json-local

Packed 1 file.

$ ls -alh spice*
-rwxr-xr-x 1 alexey staff 7.3M Apr 19 07:18 spice2json
-rwxr-xr-x 1 alexey staff  11M May 13 11:36 spice2json-local

$ ./spice2json-local
Killed: 9

And if we get the released binary from this repository and decompress it back ( upx -d ) then it works again!

Maybe consider not packing MacOS binaries with UPX?

thewunder commented 3 months ago

Thanks for digging in, I haven't actually used the darwin binary. I'll update our build settings

thewunder commented 3 months ago

@AlexeyRaga give v0.3.4-rebuild2 a try for me