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

Add arm-unknown-linux-musleabi release #296

Merged
merged 1 commit into from
Sep 19, 2020
Merged

Conversation

abcfy2
Copy link
Contributor

@abcfy2 abcfy2 commented Sep 17, 2020

Some old routers (like xiaomi R1D/R2D) could use arm-unknown-linux-musleabi release.

@abcfy2
Copy link
Contributor Author

abcfy2 commented Sep 18, 2020

@zonyitoo

@zonyitoo zonyitoo merged commit 988e69d into shadowsocks:master Sep 19, 2020
@zonyitoo
Copy link
Collaborator

@abcfy2 https://github.com/shadowsocks/shadowsocks-rust/runs/1237780444 Latest build failed with several undefined reference errors, how to fix that?

@abcfy2
Copy link
Contributor Author

abcfy2 commented Oct 11, 2020

Let me check again.

@abcfy2
Copy link
Contributor Author

abcfy2 commented Oct 11, 2020

Maybe the same issue as: https://stackoverflow.com/questions/61934997/undefined-reference-to-stat-time64-when-cross-compiling-rust-project-on-mu

@abcfy2
Copy link
Contributor Author

abcfy2 commented Oct 11, 2020

And same as cross-rs/cross#400 . Maybe we should try build without openssl.

@abcfy2
Copy link
Contributor Author

abcfy2 commented Oct 11, 2020

A little strange. The old version of shadowsocks-rust is working: https://github.com/abcfy2/shadowsocks-rust/runs/1238063416?check_suite_focus=true . But the latest is not.

@zonyitoo
Copy link
Collaborator

I have updated the Cargo.lock for latest dependencies. 367f645#diff-d2ede298d9a75c849170d6ef285eda1e

@zonyitoo
Copy link
Collaborator

zonyitoo commented Oct 11, 2020

And same as rust-embedded/cross#400 . Maybe we should try build without openssl.

Or maybe we can build with feature openssl-vendored.

BUT..

--features "aes-pmac-siv openssl-vendored ${EXTRA_FEATURES}" \
I have already specified that in build script.

@abcfy2
Copy link
Contributor Author

abcfy2 commented Oct 11, 2020

Maybe some new dependencies break this feature? I just use the old version and it's working: https://github.com/abcfy2/shadowsocks-rust/runs/1238063416?check_suite_focus=true

@abcfy2
Copy link
Contributor Author

abcfy2 commented Oct 11, 2020

Seems upstream issue. waiting this PR: rust-lang/libc#1846

@abcfy2
Copy link
Contributor Author

abcfy2 commented Oct 11, 2020

Got it. I've found a quick fix solution. I will create a PR as soon as possible.

@abcfy2
Copy link
Contributor Author

abcfy2 commented Oct 11, 2020

I create a very simple patch to fix build: abcfy2@83b8811

And it works, also can work with qemu-arm:

$ file sslocal
sslocal: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, with debug_info, not stripped

$ qemu-arm ./sslocal --version
shadowsocks 1.8.20

But when I scp this file to my router, it's core dump:

# ./sslocal --version
Illegal instruction (core dumped)

# strace ./sslocal --version
execve("./sslocal", ["./sslocal", "--version"], 0xbe8e6d84 /* 13 vars */) = 0
mmap2(NULL, 960, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x4001f000
set_tls(0x4001f080)                     = 0
set_tid_address(0x71bad0)               = 7250
rt_sigaction(SIGPIPE, {sa_handler=SIG_IGN, sa_mask=[], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x5ad298}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGSEGV, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [RT_1 RT_2], NULL, 8) = 0
rt_sigaction(SIGSEGV, {sa_handler=0x434ad8, sa_mask=[], sa_flags=SA_RESTORER|SA_ONSTACK|SA_SIGINFO, sa_restorer=0x5ad2a0}, NULL, 8) = 0
rt_sigaction(SIGBUS, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGBUS, {sa_handler=0x434ad8, sa_mask=[], sa_flags=SA_RESTORER|SA_ONSTACK|SA_SIGINFO, sa_restorer=0x5ad2a0}, NULL, 8) = 0
sigaltstack(NULL, {ss_sp=NULL, ss_flags=SS_DISABLE, ss_size=0}) = 0
mmap2(NULL, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x400e0000
mprotect(0x400e0000, 4096, PROT_NONE)   = 0
sigaltstack({ss_sp=0x400e1000, ss_flags=0, ss_size=8192}, NULL) = 0
brk(NULL)                               = 0x71c000
brk(0x71d000)                           = 0x71d000
rt_sigprocmask(SIG_BLOCK, ~[RTMIN RT_1 RT_2], [], 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
--- SIGILL {si_signo=SIGILL, si_code=ILL_ILLOPC, si_addr=0x1d85c8} ---
+++ killed by SIGILL (core dumped) +++
Illegal instruction (core dumped)

@abcfy2
Copy link
Contributor Author

abcfy2 commented Oct 12, 2020

@zonyitoo I find remove the RUSTFLAGS="-Ctarget-feature=+aes will solve core dump. But I don't know why the old version (1.8.18) is working.

diff --git a/build/Dockerfile.arm-unknown-linux-musleabi b/build/Dockerfile.arm-unknown-linux-musleabi
index 8971d35..f2b1269 100644
--- a/build/Dockerfile.arm-unknown-linux-musleabi
+++ b/build/Dockerfile.arm-unknown-linux-musleabi
@@ -1,3 +1 @@
 FROM rustembedded/cross:arm-unknown-linux-musleabi-0.2.1
-
-ENV RUSTFLAGS="-Ctarget-feature=+aes"

I will create a PR right now.

@zonyitoo
Copy link
Collaborator

Well, it seems that your router doesn't support ARM's AES instructions

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 this pull request may close these issues.

2 participants