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

Added macOS compile script #71

Merged
merged 5 commits into from
Jan 22, 2022
Merged

Added macOS compile script #71

merged 5 commits into from
Jan 22, 2022

Conversation

kms1212
Copy link
Contributor

@kms1212 kms1212 commented Jan 6, 2022

According to issue #67, I added a script for compiling binary for macOS.

@CATboardBETA
Copy link

This does not function on M1 MacBook Pro 2021. I've disabled SIP and given terminal full disk access, but I still get "Operation not permitted" when I run macOS-compile.sh.

@olback
Copy link
Owner

olback commented Jan 9, 2022

This does not function on M1 MacBook Pro 2021. I've disabled SIP and given terminal full disk access, but I still get "Operation not permitted" when I run macOS-compile.sh.

Did you make the script executable? chmod +x macOS-compile.sh.

@CATboardBETA
Copy link

CATboardBETA commented Jan 9, 2022

Yes, I did that previously

@olback

@cvpeck
Copy link

cvpeck commented Jan 16, 2022

additional info for MacOS on Intel.

error[E0463]: can't find crate for core| = note: theaarch64-apple-darwintarget may not be installed = help: consider downloading the target withrustup target add aarch64-apple-darwin

Probably worth adding that to the instructions

@cvpeck
Copy link

cvpeck commented Jan 16, 2022

further error (not sure how to fix)
`
The following warnings were emitted during compilation:

warning: pkg-config has not been configured to support cross-compilation.

error: failed to run custom build command for glib-sys v0.14.0

Caused by:
process didn't exit successfully: /Users/xxxx/Documents/KiCad/library-loader/target/release/build/glib-sys-0bad67eb640f0555/build-script-build (exit status: 1)
--- stdout
cargo:rerun-if-env-changed=GLIB_2.0_NO_PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS_aarch64-apple-darwin
cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS_aarch64_apple_darwin
cargo:rerun-if-env-changed=TARGET_PKG_CONFIG_ALLOW_CROSS
cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS
cargo:rerun-if-env-changed=PKG_CONFIG_aarch64-apple-darwin
cargo:rerun-if-env-changed=PKG_CONFIG_aarch64_apple_darwin
cargo:rerun-if-env-changed=TARGET_PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_aarch64-apple-darwin
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_aarch64_apple_darwin
cargo:rerun-if-env-changed=TARGET_PKG_CONFIG_SYSROOT_DIR
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
cargo:warning=pkg-config has not been configured to support cross-compilation.

Install a sysroot for the target platform and configure it via
PKG_CONFIG_SYSROOT_DIR and PKG_CONFIG_PATH, or install a
cross-compiling wrapper for pkg-config and set it via
PKG_CONFIG environment variable.
warning: build failed, waiting for other jobs to finish...
error: build failed
`

This is on MacOS Monterey 12.1 Intel

@kms1212
Copy link
Contributor Author

kms1212 commented Jan 18, 2022

@cvpeck I think I set the cargo build target to only the Apple M1 chip.
I'm sorry but please edit macos-compile.sh script and run it.

From:

$CARGO build --release --target=aarch64-apple-darwin

To:

$CARGO build --release --target=x86_64-apple-darwin

This might be working.

@kms1212
Copy link
Contributor Author

kms1212 commented Jan 18, 2022

@cvpeck
I tried to build on x86_64 with Rosetta, but the same problem has occurred. glib-sys doesn't detect glib package from pkg-config on x86_64, I'm sorry but I cannot fix this problem. To prevent confusion, I renamed macos-compile.sh to macos-compile-aarch64.sh.

Edit:
macos-compile-x86_64.sh is for testing.

@cvpeck
Copy link

cvpeck commented Jan 19, 2022 via email

@kms1212
Copy link
Contributor Author

kms1212 commented Jan 19, 2022

Thank you for testing the script!
I'll restore the macOS build script for x86_64.

@olback
Copy link
Owner

olback commented Jan 21, 2022

You shouldn't need to specify the target when running/compiling. The compiler know what architecture it is running on and will target that automatically.

Is this ready to merge?

README.md Outdated Show resolved Hide resolved
@olback olback merged commit 8b3af24 into olback:master Jan 22, 2022
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.

None yet

4 participants