Skip to content

Commit

Permalink
update cross installation
Browse files Browse the repository at this point in the history
  • Loading branch information
ssrlive committed Mar 9, 2025
1 parent 662588a commit 603cccc
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 11 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,18 @@ jobs:
run: |
rustc --version
rustup target add ${{ matrix.target }}
- name: Install cross
if: ${{ matrix.host_os == 'ubuntu-latest' }}
run: |
source /home/runner/.cargo/env
.github/workflows/install-cross.sh
- name: Build
if: ${{ !cancelled() }}
shell: bash
run: |
if [[ "${{ matrix.host_os }}" == "ubuntu-latest" ]]; then
sudo .github/workflows/install-cross.sh
cross build --verbose --target ${{ matrix.target }}
if [[ "${{ matrix.target }}" == "x86_64-unknown-linux-gnu" ]]; then
./build-android.sh debug aarch64-linux-android
Expand Down
17 changes: 10 additions & 7 deletions .github/workflows/install-cross.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
#!/bin/bash

curl -s https://api.github.com/repos/cross-rs/cross/releases/latest \
| grep cross-x86_64-unknown-linux-gnu.tar.gz \
| cut -d : -f 2,3 \
| tr -d \" \
| wget -qi -
# curl -s https://api.github.com/repos/cross-rs/cross/releases/latest \
# | grep cross-x86_64-unknown-linux-gnu.tar.gz \
# | cut -d : -f 2,3 \
# | tr -d \" \
# | wget -qi -

tar -zxvf cross-x86_64-unknown-linux-gnu.tar.gz -C /usr/bin
rm -f cross-x86_64-unknown-linux-gnu.tar.gz
# tar -zxvf cross-x86_64-unknown-linux-gnu.tar.gz -C /usr/bin
# rm -f cross-x86_64-unknown-linux-gnu.tar.gz

rustup default stable
cargo install cross --git https://github.com/cross-rs/cross --rev 36c0d7810ddde073f603c82d896c2a6c886ff7a4 --root /usr/local/
cross --version
3 changes: 2 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ jobs:
cargo install cbindgen
mkdir release
if [[ "${{ contains(matrix.host_os, 'ubuntu') }}" == "true" && "${{ matrix.host_os }}" != "ubuntu-20.04" ]]; then
sudo .github/workflows/install-cross.sh
source /home/runner/.cargo/env
.github/workflows/install-cross.sh
fi
- name: Build
Expand Down
4 changes: 2 additions & 2 deletions src/android.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ pub unsafe extern "C" fn Java_com_github_shadowsocks_bg_OverTlsWrapper_runClient
let mut stat = STAT_PATH.lock().map_err(|e| Error::from(e.to_string()))?;
*stat = Some(stat_path);

overtls_set_traffic_status_callback(1, Some(send_traffic_stat), std::ptr::null_mut());
unsafe { overtls_set_traffic_status_callback(1, Some(send_traffic_stat), std::ptr::null_mut()) };
}
let config_path = get_java_string(&mut env, &config_path)?.to_owned();
set_panic_handler();
Expand Down Expand Up @@ -141,7 +141,7 @@ fn remove_panic_handler() {
static STAT_PATH: std::sync::Mutex<Option<String>> = std::sync::Mutex::new(None);

unsafe extern "C" fn send_traffic_stat(traffic_status: *const TrafficStatus, _ctx: *mut c_void) {
let traffic_status = *traffic_status;
let traffic_status = unsafe { *traffic_status };
if let Err(e) = _send_traffic_stat(&traffic_status) {
log::error!("failed to send traffic stat, error={:?}", e);
}
Expand Down

0 comments on commit 603cccc

Please sign in to comment.