ImageOptim / mozjpeg-rust

Safe Rust wrapper for the MozJPEG library
https://lib.rs/mozjpeg
Other
75 stars 19 forks source link

could not build staticlib #37

Closed nguyencse closed 1 year ago

nguyencse commented 1 year ago

I could not build staticlib for ios target using command cargo lipo --release. It told me that failed to run custom build command for mozjpeg-sys v2.0.3. I really appreciate for your help.

kornelski commented 1 year ago

Before the text "failed to run custom build command for mozjpeg-sys v2.0.3" there should be explanation why it failed.

nguyencse commented 1 year ago

@kornelski thank you for your quick response. before that text, it told me that vendor/simd/arm/aarch64/jsimd.c:33:8: error: thread-local storage is not supported for the current target I downgraded version of mozjpeg to 0.9.1 and got the same issue.

how can I pass this?

kornelski commented 1 year ago

You must set deployment target for iOS higher than ios9.

export IPHONEOS_DEPLOYMENT_TARGET=13.0
nguyencse commented 1 year ago

but how can I do that? because I just run cargo lipo --release by terminal and the error occurred. So I cannot do the next step is integrate my lib to ios (xcode)

kornelski commented 1 year ago

You run:

export IPHONEOS_DEPLOYMENT_TARGET=13.0
cargo lipo --release

or use cargo-xcode and set the target in Xcode.

nguyencse commented 1 year ago

Thank you for your sample command. I found out that what we need is adding a variable to section [env] in config.toml file and run cago lipo --release again. [env] IPHONEOS_DEPLOYMENT_TARGET = "13.0"