-
Notifications
You must be signed in to change notification settings - Fork 985
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
golang
version 1.20
on MacOS
ARM processors generates status-go-library
with missing symbols
#20135
Comments
golang
version 1.20
on MacOS Silicon
generates status-go-library
with missing symbolsgolang
version 1.20
on MacOS
ARM processors generates status-go-library
with missing symbols
To investigate I tried adding more debug flags to the node process that calls contract tests like this : diff --git a/Makefile b/Makefile
index b2ad755f6..6b5b62d32 100644
--- a/Makefile
+++ b/Makefile
@@ -345,7 +345,7 @@ else
yarn node-pre-gyp rebuild && \
yarn shadow-cljs compile mocks && \
yarn shadow-cljs compile test && \
- node --require ./test-resources/override.js "$$SHADOW_OUTPUT_TO"
+ node --trace-warnings --trace-uncaught --inspect-brk --require ./test-resources/override.js "$$SHADOW_OUTPUT_TO"
endif
test: export SHADOW_OUTPUT_TO := target/test/test.js and then I open
just to get a feel of whats going on. |
right away I see something suspicious :
and
|
To validate whether this error is related to our missing symbols problem I nuked all of @WalletConnect dependencies, usage and its reference in tests and this error message disappeared but the This proves that the error messages related to 'bufferutil' and 'utf-8-validate' are not causing the failures we are interested in. It would also make sense for this not to be the culprit since what we are looking for has to be something specific to |
Next up I decided to try and find the backtrace of the abort signal. I added a signal tracing function like this in diff --git a/modules/react-native-status/nodejs/status.cpp b/modules/react-native-status/nodejs/status.cpp
index 620d77032..6ae37f637 100644
--- a/modules/react-native-status/nodejs/status.cpp
+++ b/modules/react-native-status/nodejs/status.cpp
@@ -8,6 +8,7 @@
#include <node.h>
#include <string>
#include <queue>
+#include <execinfo.h>
#include "../../../result/libstatus.h"
@@ -27,6 +28,25 @@ using v8::Number;
using v8::Value;
+void SignalHandler(int signal) {
+ printf("Caught signal: %d\n", signal);
+
+ // Print the backtrace
+ void *backtraceBuffer[8];
+ int numFrames = backtrace(backtraceBuffer, 8);
+ char **symbolList = backtrace_symbols(backtraceBuffer, numFrames);
+
+ printf("Backtrace:\n");
+ for (int i = 0; i < numFrames; ++i) {
+ printf("%s\n", symbolList[i]);
+ }
+
+ free(symbolList);
+
+ std::abort(); // Terminate the program
+}
+
+
void _MultiAccountGenerateAndDeriveAddresses(const FunctionCallbackInfo<Value>& args) {
Isolate* isolate = args.GetIsolate();
Local<Context> context = isolate->GetCurrentContext();
@@ -1925,6 +1945,8 @@ void _RestoreAccountAndLogin(const FunctionCallbackInfo<Value>& args) {
void init(Local<Object> exports) {
+ signal(SIGABRT, SignalHandler);
+ signal(SIGSEGV, SignalHandler);
NODE_SET_METHOD(exports, "multiAccountGenerateAndDeriveAddresses", _MultiAccountGenerateAndDeriveAddresses);
NODE_SET_METHOD(exports, "multiAccountImportPrivateKey", _MultiAccountImportPrivateKey);
NODE_SET_METHOD(exports, "multiAccountLoadAccount", _MultiAccountLoadAccount); |
And then when the abort trap is triggered by node process we are able to latch on to that signal in the cpp code and print the backtrace.
|
these env vars help in adding more metadata to git diff Makefile
diff --git a/Makefile b/Makefile
index b2ad755f6..0eee25cf2 100644
--- a/Makefile
+++ b/Makefile
@@ -345,7 +345,7 @@ else
yarn node-pre-gyp rebuild && \
yarn shadow-cljs compile mocks && \
yarn shadow-cljs compile test && \
- node --require ./test-resources/override.js "$$SHADOW_OUTPUT_TO"
+ DYLD_PRINT_APIS=1 DYLD_PRINT_BINDINGS=1 node --require ./test-resources/override.js "$$SHADOW_OUTPUT_TO"
endif
test: export SHADOW_OUTPUT_TO := target/test/test.js |
I guess one viable route here would be to build status-go-library with go 1.19 and compare the binary file with building status-go-library from 1.20 |
I first found a tag in I then built status-go library like this :
I stored the output from reading symbols of the compiled
I then removed the go 1.19 hack fix which would ensure we now use go 1.20 diff --git a/nix/status-go/library/default.nix b/nix/status-go/library/default.nix
index 3a49a98a78d..831fbfd837a 100644
--- a/nix/status-go/library/default.nix
+++ b/nix/status-go/library/default.nix
@@ -1,9 +1,6 @@
-{ stdenv, meta, source, buildGo119Package, buildGo120Package }:
-let
- # https://github.com/status-im/status-mobile/issues/19802
- # only for Darwin to fix Integration Tests failing with missing symbols on go 1.20
- buildGoPackageIntegrationTest = if stdenv.isDarwin then buildGo119Package else buildGo120Package;
-in buildGoPackageIntegrationTest {
+{ stdenv, meta, source, buildGoPackage }:
+
+buildGoPackage {
pname = source.repo;
version = "${source.cleanVersion}-${source.shortRev}"; and then I then cleaned up the status-go library with I then create a new log file to compare symbols like this :
|
And indeed there were differences which is what I would expect since the obscure error message is of a missing symbol. However I found a familiar symbol which was missing. And indeed this problem was introduced in go 1.20 and happens only on Darwin
The suggestion was to add |
Here is how I added those flags diff --git a/nix/status-go/library/default.nix b/nix/status-go/library/default.nix
index 831fbfd837a..da3bec1e11f 100644
--- a/nix/status-go/library/default.nix
+++ b/nix/status-go/library/default.nix
@@ -22,11 +22,14 @@ buildGoPackage {
'';
# Build the Go library
+ # ld flags and netgo tag are necessary for integration tests to work on MacOS
+ # https://github.com/status-im/status-mobile/issues/20135
buildPhase = ''
runHook preBuild
go build \
-buildmode='c-archive' \
- -tags='gowaku_skip_migrations gowaku_no_rln' \
+ -ldflags '-w -s -extldflags "-lresolv"' \
+ -tags='gowaku_skip_migrations gowaku_no_rln netgo' \
-o "$out/libstatus.a" \
$NIX_BUILD_TOP/main.go
runHook postBuild |
Problem
make test-contract
on MacOS fails with :The problem initially showcased itself after the
golang
1.20
upgrade was merged.ref -> #19802
To fix this problem quickly I had modified the
status-go-library
derivation to build withgoPackage
1.19
only forDarwin
ref -> #19965
However a PR last week at
status-go
bumpedgo-waku
version and along with it a bunch of libraries that are incompatible withgolang
1.19, specificallyquic-go
ref -> status-im/status-go#5150
Here are possible solutions to the current problem:
note : further upgrading go to 1.21 or 1.22 may or may not fix this issue.
The text was updated successfully, but these errors were encountered: