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

build: add shell wrapper for cc #12

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 5 additions & 16 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,20 @@ rust:
- nightly
- stable

cache:
directories:
- target

os:
- linux
# - osx

git:
submodules: true

addons:
apt:
sources:
- ubuntu-toolchain-r-test
- sourceline: "deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic main"
key_url: "https://apt.llvm.org/llvm-snapshot.gpg.key"
packages:
- lld

script:
- travis_wait cargo build --features static-link --verbose
- travis_wait cargo test --tests --features static-link --no-fail-fast -- --test-threads 1
- travis_wait cargo build --features static-link --verbose
- RUSTFLAGS="-C linker=${PWD}/scripts/cc" travis_wait cargo test --tests --features static-link --no-fail-fast

env:
global:
- LD_LIBRARY_PATH=/usr/local/lib
- RUSTFLAGS="-C link-arg=-fuse-ld=lld"
- RUST_TEST_THREADS=1
# use shell wrapper for cc to fix link error
# - RUSTFLAGS="-C link-arg=-fuse-ld=lld"
22 changes: 22 additions & 0 deletions scripts/cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash -e

# This script handles circular reference link between librocks and librocks_sys,
# by modifying the link order:
# librocks librocks_sys => librocks librocks_sys librocks

SYSTEM_CC="/usr/bin/cc"

ARGS=("$@")

FIXED_ARGS=()

for arg in "${ARGS[@]}"; do
FIXED_ARGS+=($arg)
if [[ $arg == *librocks-*.rlib ]]; then
_librocks=$arg
elif [[ $arg == *librocks_sys-*.rlib ]]; then
FIXED_ARGS+=($_librocks)
fi
done

exec ${SYSTEM_CC} ${FIXED_ARGS[@]}