This post is spawned by this question
In my Xcode I added the new
Build Phase to copy .dylib files to
/usr/local/lib. And then I tried to rebuiold the application by doing "Command + B".
However, since the destination should be accessed thru the root account I received an error
couldn't create directory /usr/local/lib: Permission denied.
This is correct as the Xcode is started by the regular user and not root. So now I am looking for a way to execute just this build phase as root.
In the question mentioned above I got a direction that OSX is a *nix and the process is the same. While I agree that OSX is a *nix, the process of building/installing are different. On *nix you issue make as a regular user, just as you do Command + B in Xcode. But then when it finishes building in *nix you issue a separate command
sudo make install, which installs all the libraries and binaries in
/usr/local/bin. All IDE on *nix (such as Anjuta and KDevelop) has extra menu to it which when selected ask about the root password and perform the install as
And so what I am looking for is for Xcode to ask me about the root password in order to execute this Build Phase I added to copy my dylib's, because I am not familiar with this IDE.
Igors-MacBook-Air:~ igorkorot$ ls -la /Users/igorkorot/dbhandler/dbhandler/Build/Products/Debug/ total 17344 drwxr-xr-x 13 igorkorot staff 416 Jun 9 18:35 . drwxr-xr-x@ 4 igorkorot staff 128 Nov 16 2018 .. drwxr-xr-x 3 igorkorot staff 96 Jun 10 20:05 dbhandler.app -rwxr-xr-x 1 igorkorot staff 129856 Jun 9 18:34 liblibdbloader.dylib -rwxr-xr-x 1 igorkorot staff 1002940 Jun 9 18:35 liblibdbwindow.dylib -rwxr-xr-x 1 igorkorot staff 1671068 Jun 9 18:35 liblibdialogs.dylib -rwxr-xr-x 1 igorkorot staff 148244 Jun 9 18:34 liblibfieldswindow.dylib -rwxr-xr-x 1 igorkorot staff 587976 Jun 9 18:33 liblibmysql.dylib -rwxr-xr-x 1 igorkorot staff 799272 Jun 9 18:33 liblibodbc.dylib -rwxr-xr-x 1 igorkorot staff 611680 Jun 9 18:33 liblibpostgres.dylib -rwxr-xr-x 1 igorkorot staff 482852 Jun 9 18:33 liblibpropertypages.dylib -rwxr-xr-x 1 igorkorot staff 1619172 Jun 9 18:34 liblibshapeframework.dylib -rwxr-xr-x 1 igorkorot staff 1810304 Jun 9 18:33 liblibsqlite.dylib
And so I tried to add LD_LIBRARY_PATH as /Users/igorkorot/dbhandler/dbhandler/Build/Products/Debug/, but trying to run it (dbhandler.app) from inside Xcode, the program still crashes. Changing the variable to be DYLD_LIBRARY_PATH doesn't make a difference.
I also thought that having the libraries (dylib's) in the same directory as application bundle is all there is to need to successfully start the application and keep the linker satisfied. Apparently I was wrong.
Please refer to the screenshot below.
And this is how it looks like in Xcode: