NordSecurity / uniffi-bindgen-go

Uniffi bindings generator for Golang
Mozilla Public License 2.0
65 stars 18 forks source link

[arm64] `test_bindings.sh` fails #50

Closed pacu closed 4 weeks ago

pacu commented 1 month ago

Setup

Apple M1 max
OS: Sonoma 14.5 (23F79)
rustc 1.77.1 (7cf61ebde 2024-03-27)

Commit: 034f4ff683df6b63b8eda1fab56538e6a4c55485

Reproducing steps:

sh build.sh. # --> OK
sh build_bindings.sh # --> OK
sh test_bindings.sh # --> FAILS

Error

+++ dirname test_bindings.sh
++ cd .
++ pwd
+ SCRIPT_DIR=[path_to_repo]uniffi-bindgen-go
+ ROOT_DIR=[path_to_repo]uniffi-bindgen-go
+ BINDINGS_DIR=[path_to_repo]uniffi-bindgen-go/binding_tests
+ BINARIES_DIR=[path_to_repo]uniffi-bindgen-go/target/debug
+ pushd [path_to_repo]uniffi-bindgen-go/binding_tests
+ LD_LIBRARY_PATH=:[path_to_repo]uniffi-bindgen-go/target/debug
+ CGO_LDFLAGS='-luniffi_fixtures -L[path_to_repo]uniffi-bindgen-go/target/debug -lm -ldl'
+ CGO_ENABLED=1
+ go test -v
# github.com/NordSecurity/uniffi-bindgen-go/binding_tests.test
/usr/local/go/pkg/tool/darwin_arm64/link: running clang failed: exit status 1
ld: warning: ignoring duplicate libraries: '-ldl', '-lm', '-luniffi_fixtures'
ld: warning: ignoring file '[path_to_repo]uniffi-bindgen-go/target/debug/libuniffi_fixtures.dylib': found architecture 'x86_64', required architecture 'arm64'
Undefined symbols for architecture arm64:
  "_ffi_arithmetical_rustbuffer_free", referenced from:
      __cgo_f7ea66aed32e_Cfunc_ffi_arithmetical_rustbuffer_free in 000001.o

Contents of target/debug

build
deps
examples
incremental
libuniffi_bindgen_go.d
libuniffi_bindgen_go.rlib
libuniffi_fixtures.a
libuniffi_fixtures.d
libuniffi_fixtures.dylib
libuniffi_fixtures.rlib
uniffi-bindgen-go
uniffi-bindgen-go.d

when removing .a as duplicates. and running sh test_bindings.sh again

+++ dirname test_bindings.sh
++ cd .
++ pwd
+ SCRIPT_DIR=[path_to_repo]uniffi-bindgen-go
+ ROOT_DIR=[path_to_repo]uniffi-bindgen-go
+ BINDINGS_DIR=[path_to_repo]uniffi-bindgen-go/binding_tests
+ BINARIES_DIR=[path_to_repo]uniffi-bindgen-go/target/debug
+ pushd [path_to_repo]uniffi-bindgen-go/binding_tests
+ LD_LIBRARY_PATH=:[path_to_repo]uniffi-bindgen-go/target/debug
+ CGO_LDFLAGS='-luniffi_fixtures -L[path_to_repo]uniffi-bindgen-go/target/debug -lm -ldl'
+ CGO_ENABLED=1
+ go test -v
# github.com/NordSecurity/uniffi-bindgen-go/binding_tests.test
/usr/local/go/pkg/tool/darwin_arm64/link: running clang failed: exit status 1
ld: warning: ignoring duplicate libraries: '-ldl', '-lm', '-luniffi_fixtures'
ld: warning: ignoring file '[path_to_repo]uniffi-bindgen-go/target/debug/libuniffi_fixtures.dylib': found architecture 'x86_64', required architecture 'arm64'
Undefined symbols for architecture arm64:
  "_ffi_arithmetical_rustbuffer_free", referenced from:
      __cgo_f7ea66aed32e_Cfunc_ffi_arithmetical_rustbuffer_free in 000001.o

when removing .dylib as duplicates. and running sh test_bindings.sh again

+++ dirname test_bindings.sh
++ cd .
++ pwd
+ SCRIPT_DIR=[path_to_repo]uniffi-bindgen-go
+ ROOT_DIR=[path_to_repo]uniffi-bindgen-go
+ BINDINGS_DIR=[path_to_repo]uniffi-bindgen-go/binding_tests
+ BINARIES_DIR=[path_to_repo]uniffi-bindgen-go/target/debug
+ pushd [path_to_repo]uniffi-bindgen-go/binding_tests
+ LD_LIBRARY_PATH=:[path_to_repo]uniffi-bindgen-go/target/debug
+ CGO_LDFLAGS='-luniffi_fixtures -L[path_to_repo]uniffi-bindgen-go/target/debug -lm -ldl'
+ CGO_ENABLED=1
+ go test -v
# github.com/NordSecurity/uniffi-bindgen-go/binding_tests.test
/usr/local/go/pkg/tool/darwin_arm64/link: running clang failed: exit status 1
ld: warning: ignoring duplicate libraries: '-ldl', '-lm', '-luniffi_fixtures'
ld: warning: ignoring file '[path_to_repo]uniffi-bindgen-go/target/debug/libuniffi_fixtures.a[2425](f3c5cc7ab326d4d0-atomic_thread_fence.o)': found architecture 'x86_64', required architecture 'arm64'
ld: warning: ignoring file '[path_to_repo]uniffi-bindgen-go/target/debug/libuniffi_fixtures.a[2424](f3c5cc7ab326d4d0-atomic_signal_fence.o)': found architecture 'x86_64', required architecture 'arm64'
ld: warning: ignoring file '[path_to_repo]uniffi-bindgen-go/target/debug/libuniffi_fixtures.a[2423](f3c5cc7ab326d4d0-atomic_flag_test_and_set_explicit.o)': found architecture 'x86_64', required architecture 'arm64'
ld: warning: ignoring file '[path_to_repo]uniffi-bindgen-go/target/debug/libuniffi_fixtures.a[2422](f3c5cc7ab326d4d0-atomic_flag_test_and_set.o)': found architecture 'x86_64', required architecture 'arm64'
ld: warning: ignoring file '[path_to_repo]uniffi-bindgen-go/target/debug/libuniffi_fixtures.a[2421](f3c5cc7ab326d4d0-atomic_flag_clear_explicit.o)': found architecture 'x86_64', required architecture 'arm64'
ld: warning: ignoring file '[path_to_repo]uniffi-bindgen-go/target/debug/libuniffi_fixtures.a[2420](f3c5cc7ab326d4d0-atomic_flag_clear.o)': found architecture 'x86_64', required architecture 'arm64'
ld: warning: ignoring file '[path_to_repo]uniffi-bindgen-go/target/debug/libuniffi_fixtures.a[2419](f3c5cc7ab326d4d0-ucmpti2.o)': found architecture 'x86_64', required architecture 'arm64'
ld: warning: ignoring file '[path_to_repo]uniffi-bindgen-go/target/debug/libuniffi_fixtures.a[2418](f3c5cc7ab326d4d0-ucmpdi2.o)': found architecture 'x86_64', required architecture 'arm64'
pacu commented 4 weeks ago

somehow default toolchain was changed rustup default stable fixed the problem