diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9d010ba9..093a3a44 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,7 +11,6 @@ env: CARGO_TERM_COLOR: always RUST_BACKTRACE: "1" RUSTFLAGS: "-D warnings" - LLVM_CONFIG_PATH: llvm-config-10 jobs: ci: @@ -21,6 +20,7 @@ jobs: matrix: os: - ubuntu-latest + - macos-latest php-version: # - "7.0" - "7.1" @@ -34,8 +34,11 @@ jobs: - name: Checkout uses: actions/checkout@v2 - - name: Install libclang - run: sudo apt-get install -y llvm-10-dev libclang-10-dev +# - name: Install LLVM and Clang +# uses: KyleMayes/install-llvm-action@v1 +# with: +# version: "10.0" +# directory: ${{ runner.temp }}/llvm - name: Setup PHP uses: shivammathur/setup-php@v2 diff --git a/README.md b/README.md index 7a927369..fe786171 100644 --- a/README.md +++ b/README.md @@ -62,7 +62,7 @@ sudo apt install llvm-10-dev libclang-10-dev php-cli cargo new myapp ``` -3. Add the dependencies and metadata to you Cargo project. +3. Add the dependencies and metadata to you `Cargo.toml`. ```toml [lib] @@ -72,6 +72,13 @@ crate-type = ["cdylib"] phper = "0.2" ``` +In addition, if you are using `macos`, you should add these rust flags to your `.cargo/config.toml`. + +```toml +[target.x86_64-apple-darwin] +rustflags = ["-Clink-args=-Wl,-undefined,dynamic_lookup"] +``` + 4. Add these code to `main.rs`. ```rust diff --git a/examples/hello/.cargo/config.toml b/examples/hello/.cargo/config.toml new file mode 100644 index 00000000..b07e7a12 --- /dev/null +++ b/examples/hello/.cargo/config.toml @@ -0,0 +1,2 @@ +[target.x86_64-apple-darwin] +rustflags = ["-Clink-args=-Wl,-undefined,dynamic_lookup"] diff --git a/examples/http-client/.cargo/config.toml b/examples/http-client/.cargo/config.toml new file mode 100644 index 00000000..b07e7a12 --- /dev/null +++ b/examples/http-client/.cargo/config.toml @@ -0,0 +1,2 @@ +[target.x86_64-apple-darwin] +rustflags = ["-Clink-args=-Wl,-undefined,dynamic_lookup"] diff --git a/examples/logging/.cargo/config.toml b/examples/logging/.cargo/config.toml new file mode 100644 index 00000000..b07e7a12 --- /dev/null +++ b/examples/logging/.cargo/config.toml @@ -0,0 +1,2 @@ +[target.x86_64-apple-darwin] +rustflags = ["-Clink-args=-Wl,-undefined,dynamic_lookup"] diff --git a/phper/src/lib.rs b/phper/src/lib.rs index 08d16a50..8c40feee 100644 --- a/phper/src/lib.rs +++ b/phper/src/lib.rs @@ -28,6 +28,13 @@ crate-type = ["cdylib"] phper = "0.2" ``` +In addition, if you are using `macos`, you should add these rust flags to your `.cargo/config.toml`. + +```toml +[target.x86_64-apple-darwin] +rustflags = ["-Clink-args=-Wl,-undefined,dynamic_lookup"] +``` + 4. Add these code to `main.rs`. ```no_run