Espressif tool chain broken after macOS Monterey 12.3 beta 3 install - macos-monterey

After Monterey 12.3 beta 2 installed, the Espressif tool chain is broken. If you compile with platformIO you'll get the following error:
^
Linking .pio/build/esp32dev/firmware.elf
/Users/stephanedeluca/.platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/5.2.0/../../../../xtensa-esp32-elf/bin/ld: /Users/stephanedeluca/.platformio/packages/toolchain-xtensa32/bin/../libexec/gcc/xtensa-esp32-elf/5.2.0/liblto_plugin.so: error loading plugin: dlopen(/Users/stephanedeluca/.platformio/packages/toolchain-xtensa32/bin/../libexec/gcc/xtensa-esp32-elf/5.2.0/liblto_plugin.so, 0x0002): Library not loaded: /opt/osxcross/target/bin/../x86_64-apple-darwin12/lib/libstdc++.6.dylib
Referenced from: /Users/stephanedeluca/.platformio/packages/toolchain-xtensa32/libexec/gcc/xtensa-esp32-elf/5.2.0/liblto_plugin.0.so
Reason: tried: '/opt/osxcross/target/bin/../x86_64-apple-darwin12/lib/libstdc++.6.dylib' (no such file)
collect2: error: ld returned 1 exit status
*** [.pio/build/esp32dev/firmware.elf] Error 1
Looking at my Mac, there is no /opt/osxcross.
I have searched on another Mac with the beta 1 where the tool chain was still working the presence of the folder, and guess what?! there's none!
Any idea what as actually broken by the beta?

Finally, here is a work around: we are going to provide the missing /opt/osxcross folder and contents.
If you do not have gcc installed (this should be unlikely though, install gcc to get the folder content, as follows:
$ brew install gcc
Create the missing /opt/osxcross folder as follows:
$ sudo mkdir -p /opt/osxcross/target/bin/../x86_64-apple-darwin12/lib/
Note that you'll be prompted for your password.
And, finally, copy the folder contents from the gcc build as follows:
$ sudo cp /usr/local/Cellar/gcc/11.2.0_3/lib/gcc/11/libstdc++.6.dylib /opt/osxcross/target/x86_64-apple-darwin12/lib/libstdc++.6.dylib
This completes the fix.
You must restart vscode, Arduino IDE or whatever tool you use. And then build your project, which should compile successfully.
And voila.

Related

Using ZMQ on iOS

I am trying to build an iOS app that is exposed to a fairly extensive Rust project, but I am having issues with one of the dependencies in the project. The Rust project has a ZMQ dependency, and while I am able to build the project on my Mac, when I try to incorporate the Rust project I get the following error:
error: failed to run custom build command for `zmq-sys v0.8.3`
Caused by:
process didn't exit successfully: `/Users/lisa/company/project/project_detail/target/debug/build/zmq-sys-16dfc88dff84d855/build-script-build` (exit status: 101)
--- stdout
cargo:rerun-if-env-changed=LIBZMQ_NO_PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS_aarch64-apple-ios
cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS_aarch64_apple_ios
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-ios
cargo:rerun-if-env-changed=PKG_CONFIG_aarch64_apple_ios
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-ios
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_aarch64_apple_ios
cargo:rerun-if-env-changed=TARGET_PKG_CONFIG_SYSROOT_DIR
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
--- stderr
thread 'main' panicked at 'Unable to locate libzmq:
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.', /Users/lisa/.cargo/registry/src/github.com-1ecc6299db9ec823/zmq-sys-0.8.3/build.rs:31:17
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
I am trying to build the appropriate library for the iOS and iOS simulator architectures without relying on pkg-config, but if someone can provide useful instructions for configuring pkg-config for cross-compilation, I am not opposed to it, I just don't know how and can't find any up to date resources.
I have cloned the libzmq project from this github: https://github.com/zeromq/libzmq.git, then navigate into libzmq.
Inside libzmq, I run ./autogen.sh followed by ./configure --prefix [directory location] --target "aarch64-apple-ios", then make and make install.
The above procedure without the --target flag is how I got the project to compile on my Mac in the first place, and with the target flag in place make and make install both complete successfully, but when I try to build the project using PROJECT_DIR="${PWD}/ProjectName" ./ProjectName/build-rust.sh,
I get the previously posted error.
I am following the Swift-Bridge Book (https://chinedufn.github.io/swift-bridge/building/xcode-and-cargo/index.html) to try to load the Rust libraries into Xcode.
One thing to note: In the libzmq git hub, there is a folder called builds/ios/ and inside this folder is what looks to be a build file for all of the iOS archs, but I haven't been able to get the repo to build with that file. I think figuring out how to use the build_ios.sh build file as opposed to the standard build.sh provided might be the answer, but I've tried dropping build_ios.sh where build.sh is, and ./autogen.sh doesn't work, because it complains that it can't find configure.ac, even though this file does exist.

Command PhaseScriptExecution failed with a nonzero exit code - using CocoaPods

I'm getting the following error when building my project: Command PhaseScriptExecution failed with a nonzero exit code.
This is what I have in my [CP] Embed Pods Frameworks:
I've also done a pod deintegrate and pod install but these frameworks continue to show in red:
I'm on Xcode Version 12.4 and my mac has an Apple M1 chip. Any thoughts as to what I could do to resolve this error?
Clearing the Excluded Architectures solved the issue. I originally had arm64 and x86_64 excluded.
Did you solve your issue?
I got the one of solutions.
First of all, you have to delete the files which are red of iOS, Frameworks . They don't exist anymore, so you shouldn't include them to archive.
then clean up your builds.
(click Xcode -> product -> clean build folder)
go to archive.
(click Xcode -> product -> archive)
If you don't use M1, then you have to exclude architectures "arm64".
That's it.
Hope it works.
clear all files inside Library/Developer/Xcode/DerivedData/
List item clean & build again from xcode
if you're using nvm make sure you don't have another globally installed version of Node/npm.
If you aren't sure whether or not you have a global version, go to your bash_profile/zshrc and comment the three nvm initialization lines (export NVM_DIR="$HOME/.nvm" [...]), then open a new terminal and do node --version, if it still finds something it means that you have a global version somewhere, and you can find its path with which node.
In my case I'm using Homebrew, and I had a global version of Node that I wasn't even aware coming from the yarn formula, I discovered it after running brew uses --installed node. I went ahead and uninstalled yarn using brew uninstall --force yarn, which automatically uninstalled its node/npm dependency, then uncommented the nvm initialization lines, and then I reinstalled yarn using nvm's npm with npm i -g yarn, and now everything works.
Another way, after installing node via brew install node RUN sudo ln -s /opt/homebrew/bin/node /usr/local/bin/node
restart xcode and try to build again.

Can't build and run react-native project on Mac

Referring this issue, I've the same problem. I've MacOs El Captain on VMware.
Node v. 7.8.0
npm v.4.6.1
react-native-cli 2.0.1
react-native 0.46.4
Xcode v. 8.2.1
I've two issues:
- when trying to init a new react-native project, the packages fetching hangs on getting react-native 0.46.4 package from repo. Other packages were downloaded successfully. So I've execute npm install from Windows and then copied the node_modules folder on Mac.
- when trying to run the project on iOS simulator I recieve the following error:
** BUILD FAILED **
...
In file included from /Users/michelebombardi/Desktop/ReactNativeProjects/caliup/node_modules/react-native/React/../third-party/folly-2016.09.26.00/folly/Bits.h:70:
/Users/michelebombardi/Desktop/ReactNativeProjects/caliup/node_modules/react-native/React/../third-party/folly-2016.09.26.00/folly/detail/BitIteratorDetail.h:21:10: fatal error: 'boost/iterator/iterator_adaptor.hpp' file not found
#include <boost/iterator/iterator_adaptor.hpp>
The following build commands failed:
CompileC /Users/michelebombardi/Desktop/ReactNativeProjects/caliup/ios/build/Build/Intermediates/React.build/Debug-iphonesimulator/third-party.build/Objects-normal/x86_64/Conv.o /Users/michelebombardi/Desktop/ReactNativeProjects/caliup/node_modules/react-native/third-party/folly-2016.09.26.00/folly/Conv.cpp normal x86_64 c++ com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
Installing build/Build/Products/Debug-iphonesimulator/CaliUp.app
An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=2):
Failed to install the requested application
An application bundle was not found at the provided path.
Provide a valid path to the desired application bundle.
Print: Entry, ":CFBundleIdentifier", Does Not Exist
Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier build/Build/Products/Debug-iphonesimulator/CaliUp.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist`
I really need to publish my app on the app store before the end of the week.
I've already try all suggested solutions but nothin works.
Could anyone help me?
First try this:
watchman watch-del-all && rm -rf node_modules
If you install node using Homebrew uninstall it and install node from here.(https://nodejs.org/en/)
Now if you used yarn to install node modules:
Try npm install
This error is caused by a failed third party library download in the build step. In your home folder there should be a ~/.rncache directory with a number of compressed C++ libraries. The error occurs when one or more of these files fails to download completely from the github amazon s3 servers. (likely in China)
The problem sticks around because the script in the react-native xcode build doesn't know how to resume the broken download. So you can fix this by deleting your ~/.rncache folder and because these folders are extracted into your modules you should also rm -rf node_modules and reinstall.
More info can be found here and here
May be this will work. Try these steps:
Backup your icons, images etc from ios folder.
Check that app name is set for key "name" in {project-root}\app.json file.
Delete ios/ and android/ directories
Run react-native eject
Replace the icons,images etc you copied earlier
Run react-native link
Launch you app from Xcode using short cut key command+r

Unable to build OpenSSL for iOS Simulator

I'm trying to build OpenSSL for iOS Simulator with the following steps:
(MackBook Pro, OS X Version 10.10.5v + Xcode Version 7.2)
$ mkdir openssl
$ cd openssl
$ wget http://www.openssl.org/source/openssl-1.0.2e.tar.gz
$ tar xvzf openssl-1.0.2e.tar.gz
$ cd openssl-1.0.2e
$ mkdir /tmp/openssl-1.0.2e-i386
$ ./configure BSD-generic32 --openssldir=/tmp/openssl-1.0.2e-i386
$ vi Makefile
Make the following changes:
1) Replace
"CC= gcc"
with
"CC= /Applications/Xcode.app/Contents/Developer/usr/bin/gcc -arch i386"
2) Append
"-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk"
to the end of
"CFLAG= ..."
$ make
However, the following error occurs:
ld: building for OSX, but linking against dylib built for iOS, file '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/lib/libSystem.dylib' for architecture i386
Can someone tell me what is wrong?
Solved this issue by referring other question.
I added "-miphoneos-version-min=6.0" to CFLAG and the issue has gone.
Thanks.
The error is one that you receive whenever you're importing and trying to link an OSX app to an iOS system library. There are many differences between the two platforms, and the libraries are not interchangeable. You're running a line to change the location of the library file that is pulled for the project. Ensure that the library you're pointing to has slices for the system architecture you're trying to build for (i386, in this case).

Install libc++ on mac 10.6.8

I'm currently trying to install the lib++.1.dylib on my mac. I followed the instructions here http://libcxx.llvm.org/ and downloaded the source. When I tried to ./buildit I encountered a clang++: command not found error.
So I went here http://clang.llvm.org/get_started.html and installed clang. Unfortunately now when I went back to installing libcxx, I still got the clang++ error. Clang itself works as clang --help brings up the help menu.
Installing Xcode isn't an option as I am runnning 10.6.8.
How do I proceed i.e. get the clang++ command to work?
There is an instruction for build libc++ on 10.6 in github
https://github.com/llvm-mirror/libcxx/tree/apple
To build on Mac OS X 10.6, you need a helper library and header found
here. cp cxxabi.h to /usr/include, and cp libc++abi.dylib to /usr/lib.
Next:
cd libcxx/lib
export TRIPLE=-apple-
./buildit
That should result in a libc++.1.dylib. To install it I like to use
links instead of copying, but either should work:
cd /usr/lib
sudo ln -sf path-to-libcxx/lib/libc++.1.dylib libc++.1.dylib
sudo ln -sf libc++.1.dylib libc++.dylib
cd /usr/include/c++
sudo ln -sf path-to-libcxx/include v1
Link in instruction not work.
The libcppabi for 10.6 You can download on this link http://www.mediafire.com/download/2aq37hc97n4f47c/libcppabi.zip
It is a fairly complex process to build libc++ on Mac 10.6, as it needs libc++abi to be present, which didn't ship with 10.6. So the working steps are as follow:
Build Clang.
Use this Clang to build libc++abi.
You have to make sure libc++abi and its header are properly placed so that in the next step in can be found.
Then use this Clang to build libc++ and link to this libc++abi.
Also note if you are using Clang 3.3 instead of the latest development trunk, you will also need this patch (http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/unwind.h?r1=172666&r2=189535&view=patch) to unwind.h so that libc++abi can be built properly.
I have tested a working process and updated the homebrew-version formula so it works in homebrew out-of-the-box. You can check the details at https://github.com/Homebrew/homebrew-versions/blob/master/llvm33.rb. Hope this helps.

Resources