'Error installing a pod - Bus Error at 0x00000001045b8000
I'm just learning to use cocoapods and am encountering an error when trying to install a pod.
Top of error:
/Library/Ruby/Gems/2.6.0/gems/ffi-1.15.3/lib/ffi/library.rb:275: [BUG] Bus Error at 0x00000001045b8000 ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.arm64e-darwin20]
Bottom of error:
zsh: abort pod install
Have tried the following, as suggested on some threads here and GitHub:
- Uninstalling and re-installing cocoapod
- sudo gem install xcodeproj
- sudo gem update
but nothing seems to be working; the error persists and the .xcworkspace file doesn't appear.
Any help would be much appreciated. Thank you!
Solution 1:[1]
If the other solution (sudo arch -x86_64 gem install ffi) does not work for you, try the following one instead:
gem install --user-install ffi -- --enable-libffi-alloc
After that, run pod install or whatever you were trying to do again, but without prefixing it with arch -x86_64.
It worked for me without issues and this way I could also avoid going the Intel emulation (Rosetta 2) way.
I find this solution in an issue filed on the ffi github project.
Solution 2:[2]
I came across someone having this issue a while ago and I believe one of the suggestions made was to try the following:
install gem using
sudo arch -x86_64 gem install ffi
and then run this
arch -x86_64 pod install
it might work, it might not, I'm not too sure. This is because from the arm64 part of your error message I assume you have an M1 Mac. Either way it's probably worth a try.
Solution 3:[3]
Reinstalling CocoaPods with brew and removing ffi gem solved the issue for me.
sudo gem uninstall cocoapods
sudo gem uninstall ffi
brew install cocoapods
pod install
Solution 4:[4]
You cannot use system here, because according to its documentation, https://man7.org/linux/man-pages/man3/system.3.html
system() returns after the command has been completed.
Since you are using gtk, don't forget library functions provided by glib. It has a bunch of functions related to process and thread handling. For example, you can use GSubprocess class from glib, g_subprocess_new.
#include <gtk/gtk.h>
#include <stdio.h>
#include <stdlib.h>
#include <glib.h>
static void open_app(GtkWidget *Widget, gpointer data) {
g_subprocess_new(G_SUBPROCESS_FLAGS_NONE, NULL, "xreader", NULL);
gtk_main_quit();
}
int main(int argc, char *argv[]) {
GtkWidget *window;
GtkWidget *button1;
gtk_init(&argc, &argv);
/*make window */
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
/*give name to the window*/
gtk_window_set_title(GTK_WINDOW(window), "launcher");
/*make size of window*/
gtk_window_set_default_size(GTK_WINDOW(window), 700, 700);
/*open the window in the meddal*/
gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
button1 = gtk_button_new_with_label("Open Xreader");
gtk_container_add(GTK_CONTAINER(window), button1);
gtk_widget_show_all(window);
g_signal_connect(button1, "clicked", G_CALLBACK(open_app), NULL);
g_signal_connect(window, "destroy", G_CALLBACK(gtk_main_quit), NULL);
gtk_main();
return 0;
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Raphael |
| Solution 2 | CloakedArrow |
| Solution 3 | kandaurov_net |
| Solution 4 | JohnKoch |
