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

Seg Fault on cross compiled binary for ARM #23816

Open
vortex73 opened this issue Jul 9, 2024 · 3 comments
Open

Seg Fault on cross compiled binary for ARM #23816

vortex73 opened this issue Jul 9, 2024 · 3 comments

Comments

@vortex73
Copy link

vortex73 commented Jul 9, 2024

Description

Segmentation fault encountered when cross compiling for arm(cortex-a53).

Nim Version

Nim Compiler Version 2.1.1 [Linux: amd64]
Compiled at 2024-07-07
Copyright (c) 2006-2024 by Andreas Rumpf

git hash: 1dcc364
active boot switches: -d:release

Current Output

Traceback (most recent call last)
pasture.nim              pasture
asyncdispatch.nim        waitFor
asyncdispatch.nim        poll
asyncdispatch.nim        runOnce
asyncdispatch.nim        processPendingCallbacks
asyncmacro.nim           processRequest (Async)
asyncmacro.nim           reqHandler (Async)
system.nim               echoBinSafe
SIGSEGV: Illegal storage access. (Attempt to read from nil?)
Segmentation fault

Compiler warning:
/usr/bin/arm-linux-gnueabihf-ld: /home/vorrtt3x/.cache/nim/pasture_r/@m..@s..@[email protected]@stoolchains@snim-@hdevel@slib@[email protected]: in function `getAddrInfo__pureZnativesockets_u249':
@m..@s..@[email protected]@stoolchains@snim-@hdevel@slib@[email protected]:(.text 0x1284): warning: Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking

Expected Output

write/read from file system

Possible Solution

No response

Additional Information

I'm trying to r/w requests via asynchttpserver.
I've tried compiling with zig cc, gcc toolchains for arm, clang. Even tried using musl-libc.
The following is the config I defined as per my knowledge:

switch("gcc.exe", "zig cc")
switch("define", "release")
switch("cpu", "arm")
switch("os", "linux")
switch("passL", "-static")
switch("d", "debug")
switch("stacktrace", "on")

image

@Araq
Copy link
Member

Araq commented Jul 10, 2024

And what we're supposed to do with this? You don't provide any source code and "zig cc" is not a GCC anyway.

Maybe your stdout was not opened.

@vortex73
Copy link
Author

vortex73 commented Jul 10, 2024

You can view the source here.

@alex65536
Copy link
Contributor

alex65536 commented Jul 11, 2024

Have you tried to create a minimal reproducer for the issue (i.e. by removing your custom logic, HTTP server and async and checking what exactly is relevant to your bug and what is not)?

Also, note that -static linking with glibc doesn't work well in complex cases (like networking). See this warning:

Compiler warning:
/usr/bin/arm-linux-gnueabihf-ld: /home/vorrtt3x/.cache/nim/pasture_r/@m..@s..@[email protected]@stoolchains@snim-@hdevel@slib@[email protected]: in function `getAddrInfo__pureZnativesockets_u249':
@m..@s..@[email protected]@stoolchains@snim-@hdevel@slib@[email protected]:(.text 0x1284): warning: Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking

Though, I'm unsure whether this is relevant, simple standard IO may work well with statically linked glibc.

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

3 participants