Skip to content

Macos dev #17

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

Closed
wants to merge 2 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
9 changes: 6 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: "1"
RUSTFLAGS: "-D warnings"
LLVM_CONFIG_PATH: llvm-config-10

jobs:
ci:
Expand All @@ -21,6 +20,7 @@ jobs:
matrix:
os:
- ubuntu-latest
- macos-latest
php-version:
# - "7.0"
- "7.1"
Expand All @@ -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
Expand Down
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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
Expand Down
2 changes: 2 additions & 0 deletions examples/hello/.cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[target.x86_64-apple-darwin]
rustflags = ["-Clink-args=-Wl,-undefined,dynamic_lookup"]
2 changes: 2 additions & 0 deletions examples/http-client/.cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[target.x86_64-apple-darwin]
rustflags = ["-Clink-args=-Wl,-undefined,dynamic_lookup"]
2 changes: 2 additions & 0 deletions examples/logging/.cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[target.x86_64-apple-darwin]
rustflags = ["-Clink-args=-Wl,-undefined,dynamic_lookup"]
7 changes: 7 additions & 0 deletions phper/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down