Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

./install-common.sh: line 20: ./serial-macos-latest/serial: Bad CPU type in executable #124

Open
steve5054 opened this issue Mar 8, 2025 · 13 comments
Assignees

Comments

@steve5054
Copy link

Running ./install-mac.sh on a 2019 Macbook Pro (2.6 GHz 6-Core Intel Core i7) I get the following error:

% ./install-mac.sh
Using adb at ./platform-tools/adb
Force a switch into the debug mode to enable ADB
./install-common.sh: line 20: ./serial-macos-latest/serial: Bad CPU type in executable

@rbomze
Copy link
Contributor

rbomze commented Mar 9, 2025

The tool 'serial-macos-latest' in the release.tar is a binary compiled for 'apple silicon' / arm.
To compile it yourself for your x86/amd64 macbook :

> git clone https://github.com/EFForg/rayhunter
> cd rayhunter/serial
> cargo build --release
> cp ../target/release/serial /location/of/your/releasebinaries/serial-macos-latest/serial

Effectively replacing the 'wrong' binary.
Of course you could compile the whole rayhunter project yourself, but this requires gcc installed and other dependencies.

@allpoints
Copy link

It would be trivial to modify the install script(s) to handle that more elegantly. Could I trouble someone with an ARM based mac to post the output of: uname -a and uname -m?

If there's interest in making both binaries available it would be just as easy to have the script download and use the correct one.

@thejoelpatrol
Copy link

@allpoints

$ uname -a
<COMPUTER_NAME> 24.2.0 Darwin Kernel Version 24.2.0: Fri Dec  6 19:03:40 PST 2024; root:xnu-11215.61.5~2/RELEASE_ARM64_T6041 arm64
$ uname -m
arm64

@rossgrady
Copy link

Unfortunately @rbomze 's suggestion doesn't work, at least not as trivially as it seemed it might. The compile gets hung up on missing x86_64 symbols somewhere in/around liblibusb1_sys and that's the point at which I lost interest because I didn't feel like doing a full build of the entire project. :)

So if @allpoints wants to hook us poor x86 Mac owners up with a working serial binary, I'd be into it.

@allpoints
Copy link

@thejoelpatrol thanks, I'm can fold that into the install once i get word on if #133 has been accepted.

@rossgrady I'll see if I can find some time later today to do that

@wisxxx
Copy link

wisxxx commented Mar 11, 2025

Ran into this and got a successful install on an older MacBook (Intel dual core), running macOS 14.7.4.

To get the replacement 'serial', these were my steps (vanilla MacBook):

  • Get the release from; https://github.com/EFForg/rayhunter/releases
  • Install Mac 'xcode' tools
  • Install Rust (which includes Cargo)
  • Get the source tree download ZIP, unzip into default rayhunter-main directory
  • Build the 'serial' executable in default directory : cargo build --release --bin='serial'
  • Copy rayhunter-main/target/release/serial to the the serial-macos-latest directory

Now, the install-mac.sh script should run. Make sure the Orbis is connected.

Note: many thanks to Cooper Quintin for the help.

@rossgrady
Copy link

Update (adding to the above from @wisxxx ):

On my 2020 Intel Mac running Sequoia, something about my toolchain (I'm not a Rust dev but heaven only knows what's left lying around) was throwing a bunch of _________ was built for newer 'macOS' version (14.0) than being linked (10.12)

Since I'm building just-for-me and not for lowest-common-denominator distribution, Teh Internets helped me to realize I could do export MACOSX_DEPLOYMENT_TARGET=14.0 and then the above steps worked A-OK for me.

I now have a rooted Orbis device running Rayhunter. Thanks, y'all!

@wgreenberg wgreenberg self-assigned this Mar 11, 2025
@wgreenberg
Copy link
Collaborator

ack, yeah this is unfortunately a limitation of the Github-hosted CI we're using to build our releases -- there's no (free) way to build for x86 macOS. i think for now, we'll add a section to the README covering what @wisxxx outlined.

@hoopgeek
Copy link

hoopgeek commented Mar 12, 2025

I tried the @wisxxx solution, but can't get it to link. I'm on a Intel MacBook running Sequoia 15.3.1.

rayhunter-main % cargo build --release --bin='serial'          
   Compiling pkg-config v0.3.30
   Compiling cc v1.0.86
   Compiling libc v0.2.155
   Compiling rusb v0.9.3
   Compiling libusb1-sys v0.6.4
   Compiling serial v0.1.0 (/Users/bjn/Downloads/rayhunter-main/serial)
error: linking with `cc` failed: exit status: 1
  |
  = note: env -u IPHONEOS_DEPLOYMENT_TARGET -u TVOS_DEPLOYMENT_TARGET -u XROS_DEPLOYMENT_TARGET LC_ALL="C" PATH="/Users/bjn/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/bin:/usr/local/opt/ruby/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/Users/bjn/.cargo/bin:/Users/bjn/Library/Application Support/JetBrains/Toolbox/scripts" VSLANG="1033" ZERO_AR_DATE="1" "cc" "/var/folders/sb/qpqq2dkn18j_bhzn61zf7bbh0000gp/T/rustcYHe9pQ/symbols.o" "<3 object files omitted>" "/Users/bjn/Downloads/rayhunter-main/target/release/deps/{librusb-f63a3da3d4898c6c.rlib,liblibusb1_sys-4c208c2801badf86.rlib,liblibc-a7c6ea23d57440a6.rlib}" "/Users/bjn/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/{libstd-4342b9106d0415dd.rlib,libpanic_unwind-0a79a6ecf5b18530.rlib,libobject-84e437265aa7041b.rlib,libmemchr-30ebf9d2fcf0bfc8.rlib,libaddr2line-dbfe74fe37aade7e.rlib,libgimli-85a50da1374c89c1.rlib,librustc_demangle-5db1266bfa58bba4.rlib,libstd_detect-e9afbee47cd520d6.rlib,libhashbrown-959071037b1ad0aa.rlib,librustc_std_workspace_alloc-2a434012e00a54bc.rlib,libminiz_oxide-2a0f0a883febe6c2.rlib,libadler-be50c1a262537f4d.rlib,libunwind-07189d75869ed30f.rlib,libcfg_if-696a5bc7b60e0977.rlib,liblibc-4b8d08ad7d2ea874.rlib,liballoc-358cac0c3ed5a5a5.rlib,librustc_std_workspace_core-f56758809865f8ac.rlib,libcore-c79541fdd52d93c7.rlib,libcompiler_builtins-ee44a15358384055.rlib}" "-framework" "CoreFoundation" "-framework" "IOKit" "-framework" "Security" "-liconv" "-lSystem" "-lc" "-lm" "-arch" "x86_64" "-mmacosx-version-min=10.12.0" "-L" "/Users/bjn/Downloads/rayhunter-main/target/release/build/libusb1-sys-a958932b394c5c36/out" "-o" "/Users/bjn/Downloads/rayhunter-main/target/release/deps/serial-3fe2732585093e50" "-Wl,-dead_strip" "-nodefaultlibs"
  = note: some arguments are omitted. use `--verbose` to show all linker arguments
  = note: Undefined symbols for architecture x86_64:
            "___isPlatformVersionAtLeast", referenced from:
                _darwin_capture_release_interface in liblibusb1_sys-4c208c2801badf86.rlib[4](0e3aad1164bcc6fc-darwin_usb.o)
                _darwin_detach_kernel_driver in liblibusb1_sys-4c208c2801badf86.rlib[4](0e3aad1164bcc6fc-darwin_usb.o)
                _darwin_attach_kernel_driver in liblibusb1_sys-4c208c2801badf86.rlib[4](0e3aad1164bcc6fc-darwin_usb.o)
                _darwin_reenumerate_device in liblibusb1_sys-4c208c2801badf86.rlib[4](0e3aad1164bcc6fc-darwin_usb.o)
          ld: symbol(s) not found for architecture x86_64
          clang: error: linker command failed with exit code 1 (use -v to see invocation)
          

error: could not compile `serial` (bin "serial") due to 1 previous error

@mmilleror
Copy link

@hoopgeek I ran into the same issue on MacOs 14.7.4.

@hoopgeek
Copy link

@mmilleror , solved. Add the following to ~/.cargo/config

[target.x86_64-apple-darwin]
rustflags = [
  "-C", "link-arg=-undefined",
  "-C", "link-arg=dynamic_lookup",
]

[target.aarch64-apple-darwin]
rustflags = [
  "-C", "link-arg=-undefined",
  "-C", "link-arg=dynamic_lookup",
]

Found this answer here: https://stackoverflow.com/questions/28124221/error-linking-with-cc-failed-exit-code-1

@NyarlaCat
Copy link

I successfully got this working on an Intel Mac (macOS 14.6.1). If anyone wants to see a step-by-step here's what worked:

  1. Add the following to ~/.cargo/config to fix the linking issues:
[target.x86_64-apple-darwin]
rustflags = [
   "-C", "link-arg=-undefined",
   "-C", "link-arg=dynamic_lookup",
]
[target.aarch64-apple-darwin]
rustflags = [
   "-C", "link-arg=-undefined",
   "-C", "link-arg=dynamic_lookup",
]
  1. Build the Intel-compatible serial tool:
cd rayhunter-0.2.5/serial
cargo build --release --bin='serial'
  1. Copy the compiled binary to replace the ARM version:
cp target/release/serial /path/to/release/serial-macos-latest/serial
  1. If you see "adb: more than one device/emulator", set the specific device:
export ANDROID_SERIAL=<your_device_id>  # Get ID from `adb devices`
  1. Run the installation script:
./install-mac.sh

Just as expected, the web interface is available at http://localhost:8080 after installation.

Credit to @hoopgeek for the Cargo config fix and @wisxxx for the initial compilation steps.

@mmilleror
Copy link

@hoopgeek I had the same experience as @NyarlaCat. I was able to flash my device and collect packets.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants