dyld: Library not loaded: #rpath/libxcrun.dylib referenced from xcrun - osx-yosemite

I'm relatively new to mac and now trying to setup a dev. environment for Cordova based iOS app. I'm using Yosemite 10.10.3
I've installed xcode 6.3.1 and the commandlinetools for 6.3.1, under /Applications/Xcode.app/Contents/Developer/ I can see usr/bin and usr/lib, also xcode-select -p is pointing to this path, so I think the command line tool is fine.
However, when I run xcodebuild I got command not found. I've manually added the path above into the PATH environment variable to make xcodebuild visible, but not sure why this is needed, I thought the installation should have taken care of this.
Then when xcrun was executed in certain script ( npm install -g ios-deploy ), I got the following error:
dyld: Library not loaded: #rpath/libxcrun.dylib referenced from /usr/bin/xcrun, reason: image not found.
I see xcrun is available in /usr/bin as well as in the usr/bin under command line tool installation path. But the libxcrun.dylib is only available in the installation path.
I manually copied this dynamic library to /usr/lib and xcrun worked.
Though it seemed working but I got suspicious, such manual actions shouldn't be the normal post-installation procedure, should they?
Is there something I forgot to do after the command line installation? What if there's more such little files I need to copy/move around? Can I simply specify the installation path somewhere?
BTW, I added the install path/usr/lib into PATH, but didn't work with xcrun, had to copy the .dylib.
There's other mac which the Xcode and CLT were upgraded from previous version, and there no such issue.

Well, after some try-out I've got ios-deploy installed by npm. I'm not sure if what I did is preferred resolution, to me it's more like a workaround.
First of all, as far as I see, if it was upgraded from previous version of CLT or Xcode, such issue doesn't exist, though all the executable behaviour are the same.
e.g. /usr/bin/xcrun will be used, and /usr/lib doesn't have libxcrun.dylib, while #executable_path=../lib, meaning xcrun is looking for library in the ../lib location.
Normally the library not loaded error is expected, but somehow with the upgraded case some hidden setting told xcrun to search for library in the correct path.
I've tried DYLD_LIBRARY_PATH, worked with gcc and xcrun but didn't work with npm install. I can only fix the error by copying the lib file to /usr/lib at the moment.
Well, I'm still getting "cannot infer developer directory from our own path (/usr/bin/xcrun)" warning, even though I've set DEVELOPER_DIR to the correct one, and xcode-select -p shows the same.
But this warning seems not doing harm to npm install -g ios-deploy ...... therefore I can live with it for now.
So the mystery persisted. I still don't know why /usr/bin/xcrun has to be used instead of CLT/usr/bin/xcrun, I still don't know how in the upgraded case /usr/bin/xcrun managed to locate the correct lib file and didn't throw any warning. What's the difference between the new installation and upgrade?
This answer is just providing a workaround to continue without recreating everything on the machine.
Additional information:
As shown in comments, afterwards I found ios-sim is not working, always crash with exception, thus I had to reinstall OS and started over. The issue disappeared. Now the only difference I can remember, is I installed mac ports in between of OS and xcode during last time.
My recommendation would be, install Xcode right after the OS to avoid unexpected system changes.

Related

Configure pdf-tools in Emacs running on MacOS

I am unable to successfully utilize the pdf-tools package.
Environment:
macOS Monterey 12.0.1
Emacs 27.2
To the best of my understanding, I have followed the installation instructions as outline on https://github.com/politza/pdf-tools:
I've installed and confirmed that the installations of poppler and automake are up-to-date
Though it doesn't seem to be required for the MacOS install, I've installed and confirmed that the installations of gcc and glib are up-to-date.
I've set the PKG_CONFIG_PATH in the init.el file using setenv and confirmed its settings using getenv
(setenv "PKG_CONFIG_PATH" "/usr/local/Cellar/zlib/1.2.8/lib/pkgconfig:/usr/local/lib/pkgconfig:/opt/X11/lib/pkgconfig")
When I try to execute pdf-tools-install and select y in response to the question "Need to (re)build the epdfinfo program, do it now?" I get a compilation error which reads:
mode: compilation; default-directory: "~/.emacs.d/elpa/pdf-tools-20211110.513/build/server/"
Comint started at Thu Dec 2 09:17:05
/Users/username/.emacs.d/elpa/pdf-tools-20211110.513/build/server/autobuild -i /Users/username/.emacs.d/elpa/pdf-tools-20211110.513/
Failed to recognize this system, trying to continue.
Configuring and compiling
No such program: autoreconf
Comint exited abnormally with code 1 at Thu Dec 2 09:17:05
I have confirmed that the referenced directory exits and that autoreconf is installed and up-to-date.
For a long while, I had a working pdf-tools setup on my Mac (thank you Andreas Politz and all the other contributors for such a fabulous tool). Suddenly, I don´t really know how or why, it stopped working. I also deleted my homebrew HEAD version of pdf-tools, which made things worse, because I have never again managed to install pdf-tools from Homebrew.
I tried many tweaks, until, finally, I believe the trick that really got things running again was setting the PKG_CONFIG_PATH to everything that mattered inside the init.el file (and downloading XQuartz to get a X11 environment, with the only purpose of having renderproto in the system; it may have been available in an easier way, but it was only like this that I managed to do it).
Here are all the key steps involved in getting pdf-tools back to work in my MacOS Monterey 12.5 running Emacs 28.1 :-)
Download and install XQuartz to get X11 in your Mac (this might be unnecessary, but it helped me).
In case you haven't already, install other dependencies through homebrew:
brew install poppler automake pkg-config
Through M-x list-packages, install pdf-tools.
In your init.el file, set the PKG_CONFIG_PATH using setenv:
(setenv "PKG_CONFIG_PATH" "/usr/local/Cellar/zlib/1.2.12/lib/pkgconfig:/usr/local/lib/pkgconfig:/usr/X11/lib/pkgconfig:/usr/local/Cellar/poppler/22.06.0_1/lib/pkgconfig:/opt/x11/share/pkgconfig")
Of course, you will have to use your own version numbers and update them every time you upgrade zlib and poppler. (zlib now ships with mac OS. If like me you're on mac OS 12.6 or later--and most probably even earlier--you can use /usr/local/opt/zlib/lib/pkgconfig:, which won't have to be updated manually).
Personally, I did all this through the use-package configuration macro that helps organize the init.el file:
(use-package pdf-tools
:ensure t
:config
(setenv "PKG_CONFIG_PATH" "/usr/local/Cellar/zlib/1.2.12/lib/pkgconfig:/usr/local/lib/pkgconfig:/usr/X11/lib/pkgconfig:/usr/local/Cellar/poppler/22.06.0_1/lib/pkgconfig:/opt/x11/share/pkgconfig")
(pdf-tools-install)
(custom-set-variables
'(pdf-tools-handle-upgrades t)))
Close Emacs and and re open it in the Terminal and, type y when prompted to "(re)build the epdfinfo program". (For some reason, rebuilding the epdfinfo program seems to work better in the Terminal than in the GUI version of Emacs).
That's all it should take to get pdf-tools to work. It did for me, anyway.
try installing the package 'autoconf' the same way you installed 'automake'.

Valgrind on macOS Sierra

I following this guide:
valgrind installation guide
After I have downloading the package, and I have run the sh script, but when I launch the make install command, it couldn't create the folder because it don't have the permission (even though I have used the sudo command).
Furthermore I tried with brew but I have this error:
valgrind: This formula either does not compile or function as expected on macOS
versions newer than El Capitan due to an upstream incompatibility.
Error: An unsatisfied requirement failed this build.
You can download Valgrind's latest version from their website. Then, you can just ./autogen.sh to install Valgrind. I personally did not encounter anything needed to make.
However, the sad news is, even the most recent version of Valgrind is not very usable on Mac OS Sierra. The reason is that Apple has not released the part of the source code that makes Valgrind crash, without which, the Valgrind maintainers can hardly do anything. You can read more about the discussion around the issue here .
Because Mac OS kernel is under Apple Public Source License, it has to be open-sourced someday. Thus, a Sierra-complitable version of Valgrind is only a matter of time.
Currently, I use Valgrind under Linux. This is all I can suggest now.
Latest Valgrind (git version 3.13.0) now works on MacOS Sierra but needs Xcode command line tools installed (installs needed headers).
Run this before building Valgrind:
xcode-select --install
Thanks goes to this post.
If you get an error similar to
valgrind: This formula either does not compile or function as expected
on macOS versions newer than Sierra due to an upstream
incompatibility.
you can try the workaround brew install --HEAD valgrind I found this information here https://www.gungorbudak.com/blog/2018/04/28/how-to-install-valgrind-on-macos-high-sierra/
If you happen to be on Sierra still, this works (but not on High Sierra), just do
$ brew install valgrind
valgrind: This formula either does not compile or function as expected on macOS
versions newer than Sierra due to an upstream incompatibility.
Error: An unsatisfied requirement failed this build.
Update: seems it works on "High Sierra" OOTB now too, it now says:
...versions newer than High Sierra due to an upstream incompatibility...
The easy alternative to valgrind on mac is called 'leaks'. It is a command-line tool, so if you don't already have xcode command-line tools installed, do so with
'xcode-select --install'.
Then, to test for leaks, just compile your prog then run
'leaks -atExit -- ./your_prog'

SFML 'make install' SFML_OPENGL_ES missing include file

I was trying to install SFML on my mac (running Yosemite) using CMake GUI. The issue is when I try to do sudo make install.
Here is the output in terminal.
As you can see I get a fatal error: 'EGL/egl.h' file not found
Here are the cmake options that I have enabled (using cmake GUI)
Also the source code directory is the root of this directory (i did git clone).
Edit
Found out that the issue is the SFML_OPENGL_ES option. How would I fix this?
If you just want to install SFML to your Mac just uncheck the SFML_OPENGL_ES in cmake. OPENGL_ES is required if you want to build apps for iOS and Android, but not for Mac OS X.

Trying to install Xcode 3.2.6 on a Lion machine but it won't install correctly (Not Date issue)

So I have some Objective-c code that was created in Xcode 3.1 on OSX 10.5.8, and it will no run in Xcode 4. I used this handy little guide http://hints.macworld.com/article.php?story=20110318050811544 on one of my 10.7.4 box and it worked swimmingly. (I had just upgraded from 10.6).
So now I am trying to do the same, install 3.2, install 4, link SDKs etc on another machine running 10.7.3, and after using the little date hack with the same 3.2 mpkg that i used on the other computer, the installer says it finishes successfully but when I go to look, Xcode isn't installed anywhere, and the directory mentioned in the instructions linked above /Developers/SDKs doesn't even exist (it did on the other computer). I tried copying the 10.5 SDK from the 10.7.4 machine to the 10.7.3 machine and still nothing, 4 won't run it, and I get this error.
ld: cannot link directly with /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk/usr/lib/libcrypto.0.9.7.dylib for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
A little history too, the 10.7.4 machine had xcode 3 installed on it previous to it's update to lion so that was already there and I didn't have to mess with any of that nonsense. Is it something with having had it installed previous to the Lion upgrade?
So, how do I get Xcode 3 to work on the machine, and second does anyone recognize that error?
I think mean Xcode 4 does run, but can't build your project since that error message is from the linker at the last stage of building your project.
Here's a much easier way to install Xcode 3 on Lion: http://anatomicwax.tumblr.com/post/8064949186/installing-xcode-3-2-6-on-lion-redux
Make sure you install it to a different folder named other than Developer. Xcode 4 may go out of its way to find /Developer and remove it. I named mine /Xcode3.

Install mod_mono on Mac OSX

I just started to develop website with mono+asp.net mvc2 on mac osx but I am quite new to mono and mac.
I have got things working from MonoDevelop. My website is running ok with XSP when I run it from MonoDevelop.
Now, I am trying to test it from Apache server, but I don’t know how to set things up. Some instruction I can found are all very old or incomplete. I tried a few of them, but none worked.
Could anyone please help me out?
The best way to install mod_mono on OS X is from source. To do this there are a couple steps.
First, make sure you've installed XCode (which can be found on the DVD or the 2nd CD that came with the machine or the App Store) which will provide you with gcc and the rest of the standard toolchain.
Most of the normal in-between steps can be skipped, assuming you've already installed Mono and MonoDevelop from their stable release packages. If you encounter an error later on, you'll want to install updated versions of XSP and Mono and try again.
Next, download the latest stable release of mod_mono, extract the contents of the archive (by double clicking on the icon) and follow steps 1, 2 & 3 in the INSTALL file, and you should be good to go. This entire process took about ~5 minutes to get up and running :)
I am a novice with mono but followed some instructions. I downloaded and installed everything from here:
http://www.go-mono.com/mono-downloads/download.html
To get Apache to work with mod_mono.so I downloaded source from this page:
http://download.mono-project.com/sources/mod_mono/
You have to compile it. I went into the unpacked directory and wrote this in termminal:
./configure --prefix=/usr
make
sudo make install
This puts the mod_mono.so in correct Apache dir and the mod_mono.conf file. To include it you must add this to your httpd.conf (I put it at the end of the file):
# mod_mono_configuration
Include /etc/apache2/mod_mono.conf
MonoServerPath /Library/Frameworks/Mono.framework/Versions/Current/bin/mod-mono-server2