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

go test fails on Mac M1 #6

Closed
fasmat opened this issue May 23, 2023 · 6 comments · Fixed by #8
Closed

go test fails on Mac M1 #6

fasmat opened this issue May 23, 2023 · 6 comments · Fixed by #8

Comments

@fasmat
Copy link
Member

fasmat commented May 23, 2023

When running make deps and then make test on my machine it fails to load the dylibs required:

$ make test
CGO_CFLAGS="-I/Users/fasmat/workspace/spacemesh/smcli/smkeys/deps" \
        CGO_LDFLAGS="-L/Users/fasmat/workspace/spacemesh/smcli/smkeys/deps" \
        LD_LIBRARY_PATH=/Users/fasmat/workspace/spacemesh/smcli/smkeys/deps \
        go test -v -count 1 -ldflags "-extldflags \"-L/Users/fasmat/workspace/spacemesh/smcli/smkeys/deps -led25519_bip32 -lspacemesh_remote_wallet\"" ./...
dyld[28931]: Library not loaded: /Users/aviv/actions-runner/_work/spacemesh-sdk/spacemesh-sdk/target/release/deps/libed25519_bip32.dylib
  Referenced from: <A55A6C4C-5438-3286-9CB2-389E89AF0791> /private/var/folders/4z/mx354sss66ndtlb135lfjnmc0000gn/T/go-build3364499586/b001/bip32.test
  Reason: tried: '/Users/aviv/actions-runner/_work/spacemesh-sdk/spacemesh-sdk/target/release/deps/libed25519_bip32.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Users/aviv/actions-runner/_work/spacemesh-sdk/spacemesh-sdk/target/release/deps/libed25519_bip32.dylib' (no such file), '/Users/aviv/actions-runner/_work/spacemesh-sdk/spacemesh-sdk/target/release/deps/libed25519_bip32.dylib' (no such file), '/usr/local/lib/libed25519_bip32.dylib' (no such file), '/usr/lib/libed25519_bip32.dylib' (no such file, not in dyld cache)
FAIL    github.com/spacemeshos/smkeys/bip32     0.184s
dyld[28932]: Library not loaded: /Users/aviv/actions-runner/_work/spacemesh-sdk/spacemesh-sdk/target/release/deps/libed25519_bip32.dylib
  Referenced from: <1B6AB72F-EF32-3707-B45D-E08875F5E2F3> /private/var/folders/4z/mx354sss66ndtlb135lfjnmc0000gn/T/go-build3364499586/b156/remote-wallet.test
  Reason: tried: '/Users/aviv/actions-runner/_work/spacemesh-sdk/spacemesh-sdk/target/release/deps/libed25519_bip32.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Users/aviv/actions-runner/_work/spacemesh-sdk/spacemesh-sdk/target/release/deps/libed25519_bip32.dylib' (no such file), '/Users/aviv/actions-runner/_work/spacemesh-sdk/spacemesh-sdk/target/release/deps/libed25519_bip32.dylib' (no such file), '/usr/local/lib/libed25519_bip32.dylib' (no such file), '/usr/lib/libed25519_bip32.dylib' (no such file, not in dyld cache)
FAIL    github.com/spacemeshos/smkeys/remote-wallet     0.330s
FAIL
make: *** [test] Error 1
@lrettig
Copy link
Member

lrettig commented May 23, 2023

I see this issue on Mac too. I think it's not visible in CI because a. we only run tests on linux in CI, and b. the release workflow (for smcli) runs on Mac but doesn't run tests.

@fasmat
Copy link
Member Author

fasmat commented May 24, 2023

The issue is probably fixed by setting rpath settings similar to https://github.com/spacemeshos/post-rs/blob/9f7b5d70ba6ca753f6a0b92bbef8e5cd3fe93480/Cargo.toml#LL52C3-L55C13

It probably works on the CI because there the dylibs are in the folder /Users/aviv/actions-runner/_work/spacemesh-sdk/spacemesh-sdk/target/release/deps/.

@lrettig
Copy link
Member

lrettig commented May 25, 2023

I just tested again using the latest commit from the cffi branch of spacemesh-sdk (which doesn't include the rpath changes) and it now builds and runs on my Mac with no issue. Would you mind trying again?

spacemeshos/spacemesh-sdk@312d74d

@fasmat
Copy link
Member Author

fasmat commented May 26, 2023

I updated the makefile to download v1.0.0 of spacemesh-sdk and then run the tests. It seems like the artifacts of that release don't contain any binaries? I created an issue: spacemeshos/spacemesh-sdk#12

@lrettig
Copy link
Member

lrettig commented May 26, 2023

I updated the makefile to download v1.0.0 of spacemesh-sdk and then run the tests. It seems like the artifacts of that release don't contain any binaries? I created an issue: spacemeshos/spacemesh-sdk#12

Fixed! Use v1.0.1: https://github.com/spacemeshos/spacemesh-sdk/releases/tag/v1.0.1

@lrettig
Copy link
Member

lrettig commented May 29, 2023

To expand upon what I said above:

  • this isn't causing problems in CI here because CI tests are run only on Linux
  • we don't run any release workflow for smkeys
  • we do release smcli (including on macOS), which depends on this, but the libraries are statically linked there

It only causes issues for tests, which use dynamic linking - in both this repository and in smcli.

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

Successfully merging a pull request may close this issue.

2 participants