Hi, ALL,
I'm writing a program that should operate with different DBMSes...
I'm using Xcode and test it under OSX High Sierra 10.13.6.
The compilation of my code succeeds however, when I tried to run it from Terminal, I got following:
Filed to load shared library liblibdbloader.dylib: dlopen(liblibdbloader.dylib, 2). Library not loaded: /usr/local/lib/liblibmysql.dylib.
Referenced from
Reason: image not found
At the end of the compilation I'm running a script which contains following lines:
cp -f ~/dbhandler/dbhandler/mysql-server/BuildOSX/libmysql/libmysqlclient.dylib "$TARGET_BUILD_DIR/$TARGET_NAME.app/Contents/Frameworks/libmysqlclient.dylib"
install_name_tool -id "@rpath/Frameworks/libmysqlclient.dylib" "$TARGET_BUILD_DIR/$TARGET_NAME.app/Contents/Frameworks/libmysqlclient.dylib"
cp ~/dbhandler/dbhandler/Build/Products/Debug/liblibmysql.dylib "$TARGET_BUILD_DIR/$TARGET_NAME.app/Contents/Frameworks/liblibmysql.dylib"
install_name_tool -id '@rpath/Frameworks/liblibmysql.dylib' "$TARGET_BUILD_DIR/$TARGET_NAME.app/Contents/Frameworks/liblibmysql.dylib"
install_name_tool -change "/Users/igorkorot/dbhandler/dbhandler/mysql-server/buildOSX/libmysql/libmysqlclient.21.dylib" @executable_path/../Frameworks/libmysqlclient.dylib "$TARGET_BUILD_DIR/$TARGET_NAME.app/Contents/Frameworks/liblibmysql.dylib"
install_name_tool -change "/usr/local/lib/liblibmysql.dylib" @executable_path/../Frameworks/liblibmysql.dylib "$TARGET_BUILD_DIR/$TARGET_NAME.app/Contents/Frameworks/liblibdbloader.dylib"
Trying to verify the linkage I have:
Igors-MacBook-Air:Frameworks igorkorot$ otool -L liblibmysql.dylib
liblibmysql.dylib:
@rpath/Frameworks/liblibmysql.dylib (compatibility version 1.0.0, current version 1.0.0)
@executable_path/../Frameworks/libmysqlclient.dylib (compatibility version 21.0.0, current version 21.0.0)
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 400.9.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.50.4)
Igors-MacBook-Air:Frameworks igorkorot$ otool -L libmysqlclient.dylib
libmysqlclient.dylib:
@rpath/Frameworks/libmysqlclient.dylib (compatibility version 21.0.0, current version 21.0.0)
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 400.9.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.50.4)
Igors-MacBook-Air:Frameworks igorkorot$ pwd
/Users/igorkorot/dbhandler/dbhandler/Build/Products/Debug/dbhandler.app/Contents/Frameworks
Igors-MacBook-Air:Frameworks igorkorot$
I don't understand why the linker still trying to load the library from the /usr/local/lib. The library is not referencing anything from /usr/local/lib.
Can someone explain what is going on?
Post
Replies
Boosts
Views
Activity
Hi, ALL,
I have a Application Bundle where I have a main executable and couple if dylibs.
In the Xcode there are 2 options: "Dynamic Library Install Name" and "Dynamic Library Install Name Base". Right now they are point to "/usr/local/lib".
I thought that I overrode them with the Post Build script by using "install_name_tool -id" and "install_name_tool -change", but apparently when I run the program I still see them being referenced from "/usr/local/lib".
I can't change those options in the Xcode dylib project because when I build it the folder "myAppBundle.app/Content/Frameworks" do not exist yet and therefore the build system will not know about it.
What is the proper way to reference the dylib inside the Xcode?
Thank you.
Hi, ALL,
WHat is the way to use "~" with the "install_name_tool -change" command?
Problem:
I'm using self-build library in my development. I build this library in my home directory and then successfully link it to my application. Then I make a script that copies all dylib that my application uses inside the Bundle and using "install_name_tool -change" command to relink them from new location.
The current commands look like this:
[code]
cp -f /home/igorkorot/wxWidgets/buildC11/libwx-* "$TARGET_BUILD_DIR/$TARGET_NAME.app/Contents/Frameworks/libwx-*"
install_name_tool -change "/Users/igorkorot/wxWidgets/buildC11/lib/libwx_" @executable_path/../Frameworks/libwx_"$TARGET_BUILD_DIR/$TARGET_NAME.app/Contents/Frameworks/libwx_*"
[/code]
I'd like to remove the references to "/Users/igorkorot" and instead use "~" to reference a "home directory"
How can I do that?
Thank you.
Hi, ALL,
I' have a Mac laptop with OSX 10.13 and Xcode 9.
I am trying to develop a cross-platform C++ application using wxWidgets.
It builds fine and I can successfully run it from the Terminal with "open myapp.app".
However, trying to Run/Debug the application from inside Xcode fails - the application is crashing.
Could someone please help me to run/debug the application from inside the Xcode?
If needed - I can give a link to the GitHub
Thank you in advance.
Hi, ALL,
I'm developing a software using C++/wxWidgets and I hit an interesting wall.
Everytime I try to run it from inside Xcode I am experiencing a crash.
However, when I try to run it from the Terminal, it executes OK.
When I open the Debug Console in its output I see:
2023-01-26 08:47:02.755426-0600 dbhandler[55285:3097440] dynamic_cast error 1: Both of the following type_info's should have public visibility. At least one of them is hidden. 8wxWindow, 12DatabaseType.
"DatabaseType" is a class I made in order to display the dialog and it is located in one of the dylib's my program uses.
It does have public visibility, though.
My question is - how do I make Xcode run my program successfully, so that I will be able to debug it on Mac?
I am running OSX High Sierra 10.13.6 with Xcode 9.4.1.
(Trying to find the cause I see that this error is found when the programs are running from Terminal. That is not the case here).
Thank you.
Hi, ALL,
I am trying to build my application that depends on the wxWidgets.
I built wxWidgets myself and now I'm trying to copy everything into the Application Bundle to make a self-contained distribution.
Here is what I have:
In the wxWidgets build directory:
Igors-MacBook-Air:lib igorkorot$ pwd /Users/igorkorot/wxWidgets/buildC11/lib Igors-MacBook-Air:lib igorkorot$ ls -la libwx_base* -rwxr-xr-x 1 igorkorot staff 4524504 Jul 6 22:16 libwx_baseu-3.2.0.0.0.dylib lrwxr-xr-x 1 igorkorot staff 27 Jul 6 22:16 libwx_baseu-3.2.0.dylib -> libwx_baseu-3.2.0.0.0.dylib lrwxr-xr-x 1 igorkorot staff 23 Jul 6 22:16 libwx_baseu-3.2.dylib -> libwx_baseu-3.2.0.dylib -rwxr-xr-x 1 igorkorot staff 732432 Jul 6 22:16 libwx_baseu_net-3.2.0.0.0.dylib lrwxr-xr-x 1 igorkorot staff 31 Jul 6 22:16 libwx_baseu_net-3.2.0.dylib -> libwx_baseu_net-3.2.0.0.0.dylib lrwxr-xr-x 1 igorkorot staff 27 Jul 6 22:16 libwx_baseu_net-3.2.dylib -> libwx_baseu_net-3.2.0.dylib -rwxr-xr-x 1 igorkorot staff 163636 Jul 6 22:16 libwx_baseu_xml-3.2.0.0.0.dylib lrwxr-xr-x 1 igorkorot staff 31 Jul 6 22:16 libwx_baseu_xml-3.2.0.dylib -> libwx_baseu_xml-3.2.0.0.0.dylib lrwxr-xr-x 1 igorkorot staff 27 Jul 6 22:16 libwx_baseu_xml-3.2.dylib -> libwx_baseu_xml-3.2.0.dylib Igors-MacBook-Air:lib igorkorot$ otool -L libwx_baseu-3.2.dylib libwx_baseu-3.2.dylib: /Users/igorkorot/wxWidgets/buildC11/lib/libwx_baseu-3.2.0.0.0.dylib (compatibility version 1.0.0, current version 1.0.0) /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit (compatibility version 1.0.0, current version 275.0.0) /System/Library/Frameworks/Carbon.framework/Versions/A/Carbon (compatibility version 2.0.0, current version 158.0.0) /System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa (compatibility version 1.0.0, current version 22.0.0) /System/Library/Frameworks/QuartzCore.framework/Versions/A/QuartzCore (compatibility version 1.2.0, current version 1.11.0) /System/Library/Frameworks/AudioToolbox.framework/Versions/A/AudioToolbox (compatibility version 1.0.0, current version 492.0.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.50.4) /System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL (compatibility version 1.0.0, current version 1.0.0) /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.11) /System/Library/Frameworks/Security.framework/Versions/A/Security (compatibility version 1.0.0, current version 58286.51.6) /usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0) /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 400.9.0) /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (compatibility version 45.0.0, current version 1561.40.112) /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1452.23.0) /System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices (compatibility version 1.0.0, current version 822.31.0) /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 1452.23.0) /usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0) Igors-MacBook-Air:lib igorkorot$
The commands I am running are as follows:
`#Copy and relink wxWidgets base library
echo “Copy wxWidgets base library”
cp -f ~/wxWidgets/buildC11/lib/libwx_baseu-3.2.dylib "$TARGET_BUILD_DIR/$TARGET_NAME.app/Contents/Frameworks/libwx_baseu-3.2.dylib"
echo “Copy and relink wxWidgets network library”
cp -f ~/wxWidgets/buildC11/lib/libwx_baseu_net-3.2.dylib "$TARGET_BUILD_DIR/$TARGET_NAME.app/Contents/Frameworks/libwx_baseu_net-3.2.dylib"
install_name_tool -change ~/wxWidgets/buildC11/lib/libwx_baseu-3.2.dylib @executable_path/../Frameworks/libwx_baseu-3.2.dylib "$TARGET_BUILD_DIR/$TARGET_NAME.app/Contents/Frameworks/libwx_baseu_net-3.2.dylib"
`
But when I tried to verify that, this is the results:
Igors-MacBook-Air:Frameworks igorkorot$ pwd /Users/igorkorot/dbhandler/dbhandler/Build/Products/Debug/dbhandler.app/Contents/Frameworks Igors-MacBook-Air:Frameworks igorkorot$ ls -la libwx_base* -rwxr-xr-x 1 igorkorot staff 4524504 Dec 13 21:17 libwx_baseu-3.2.dylib -rwxr-xr-x 1 igorkorot staff 732432 Dec 13 21:17 libwx_baseu_net-3.2.dylib -rwxr-xr-x 1 igorkorot staff 163636 Dec 13 21:17 libwx_baseu_xml-3.2.dylib Igors-MacBook-Air:Frameworks igorkorot$ otool -L libwx_baseu_net-3.2.dylib libwx_baseu_net-3.2.dylib: /Users/igorkorot/wxWidgets/buildC11/lib/libwx_baseu_net-3.2.0.0.0.dylib (compatibility version 1.0.0, current version 1.0.0) /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit (compatibility version 1.0.0, current version 275.0.0) /System/Library/Frameworks/Carbon.framework/Versions/A/Carbon (compatibility version 2.0.0, current version 158.0.0) /System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa (compatibility version 1.0.0, current version 22.0.0) /System/Library/Frameworks/QuartzCore.framework/Versions/A/QuartzCore (compatibility version 1.2.0, current version 1.11.0) /System/Library/Frameworks/AudioToolbox.framework/Versions/A/AudioToolbox (compatibility version 1.0.0, current version 492.0.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.50.4) /System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL (compatibility version 1.0.0, current version 1.0.0) /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.11) /System/Library/Frameworks/Security.framework/Versions/A/Security (compatibility version 1.0.0, current version 58286.51.6) /usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0) /Users/igorkorot/wxWidgets/buildC11/lib/libwx_baseu-3.2.0.0.0.dylib (compatibility version 1.0.0, current version 1.0.0) /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 400.9.0) /System/Library/Frameworks/CFNetwork.framework/Versions/A/CFNetwork (compatibility version 1.0.0, current version 897.15.0) /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1452.23.0) /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 1452.23.0) /usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0) Igors-MacBook-Air:Frameworks igorkorot$
As you can see nothing changed.
The library is still links to the original place, where it was build.
What am I missing?
Thank you for any info.
Hi, ALL,
I have a weird problem.
I'm successfully building my software (C++) on my Mac with Xcode.
I did create a post-build script to copy all needed libraries over to the Bundle and call "install_name_tool -change" for all of them.
I can successfully run "open my_app.app" from the directory it is located.
However, trying to run it from inside Xcode, does not work. It stops somewhere in the OSX CRT even before trying to open the main frame.
What would be the best way to achieve running the program from both Xcode and the Terminal?
Thank you.
Hi, ALL,
My understanding is that NSFontPanel is like a font dialog, meaning you have something like this:
(pseudo-code in C++):
[code]
FontDialog dlg();
int result = dlg.ShowModal();
if( result == ID_OK )
{
dlg.GetSelectedFont();
}
[/code]
My question is - is there a way to embed the font panel inside the Window? Or maybe there is a control exist that let me (user) select a font inside something like a notebook.
My issue is - I need to let the user configure some stuff with the different settings and I have 3 different fonts to let user select.
The way I see it is to present a notebook which lets the user go thru the tabs and select all different properties, then click OK.
Or there is a different way to do that in Objective-C/Cocoa?
Any suggestions?
Thank you.
Hi, ALL,
The Xcode project is a folder which contains multiple files/folders.
One of those is myproj.xcodeproj/xcuserdata/igorkorot.xcuserdatad/xcschemes/myproj.xcscheme
Does this file (and any other for that matter) should be under the source control?
It looks like the one referenced is constantly changing with every file being opened, so I guess it should be excluded.
What about anything else in the myproj.xcodeproj?
Thank you.
Hi, ALL,
This is continuation of the post at https://developer.apple.com/forums/thread/691010?login=true.
Apparently Claude31 didn't see my reply and was not notified about it.
Basically my question is - I created a project on Mac 10.8 with its latest Xcode, and then transferred it to the Mac with 10.13 with Xcode 9.
After the transfer I can't debug/run the project from Xcode 9, but I'm able to do so from the Terminal. lldb works, and just doing "open <my_prog.app" works as well.
I can supply any and all additional info.
The directory structure is exactly the same - I have a one binary and couple of dylib sub-projects. When I hit "Run" or try to debug from Xcode, it stops somewhere in the dylib loading assembly code.
Can someone please help solve it? It just not convenient to jump back and force from Terminal to Xcode and back.
Hi, ALL,
I have a big project created in the old Mac with 10.8 and latest Xcode.
I can build and run the project as well as Debug it.
About a year ago, I bought a newer Mac with 10.13 and I put Xcode 9 on it. I cloned my project and while I can build it, I can't run/debug it, because for some reason newer Xcode is searching for dylibs that I am also developing as part of the project, but they are not there.
I'm able to debug/run the project from the Terminal without any issues, but I much prefer to work under the beauty of an IDE.
Couild someone please help me find out where the new Xcode expects to find the dylib files in order to start the execution?
TIA!
Hi, ALL,
Is there an API in Cocoa Objective-C that will allow restore file(s) from Trash? And possibly get the list of files inside the Trash...
Thank you.
Hi,
I have a project made in the Xcode 5 and OSX 10.8. Everything was/is working there.
Then I got a new laptop with OSX 10.13. I installed Xcode 9, grabbed the project code, successfully compiled it, but when trying to run I get an exception about the dylib not being found.
I can't run it and I can't debug it since it stop somewhere in assembly during the startup of the code.
I have couple of dylib's in the project and I made them to be copied inside the Application Bundle in order to execute the project from the Terminal and debug it with lldb.
But I really like to do that from inside the Xcode.
Could someone please help me understand where do I put those dylib's in order to being able to debug from Xcode.
Thank you.
P.S.: Unfortunately Apple dropped the live notification for the posting on the thread, so if you reply - could you please keep the thread open and keep refreshing it from time to time in order to see my reply to your comment. I'm sorry for the Apple forum inconvenience.
Also - I'm sorry for choosing a (possibly) wrong tag. There is no available tag to mark my question with. If anyone know a place where I can ask this question and get a solution - I would be really glad.
Thank you.
Hi, ALL,
First I want to apologize for a long post. I need to explain everything in order to get a best possible answer.
I am a developer who started working on Mac + Xcode on the OSX 10.8.
I made a project which contains a binary and couple of dylib's. On that Mac everything was working correctly. I was able to run the binaries and debug them from within Xcode.
Relatively recently I bought myself a newer Mac with the version 10.13. I installed Xcode, grab the project from the GitHub, recompiled and tried to run it.
Unfortunately it didn't run. It didn't even started. It failed somewhere in the assembly code before trying to access the very first C++ code I wrote..
I went back to the old Mac and everything is still works correctly there.
I kind of concluded that somehow during the old Xcode project transitioning to the new Xcode, it changed the placement of the dylib binaries and when I try to run it it can't load dylib's and fails to start.
WHat I also found is that I can open the Terminal, go to the build directory for the project and issue:
[code]
open my_project.app
[/code]
and it runs.
But trying to debug an application from lldb inside the Terminal is very unpleasant job comparing to doing so from the Xcode.
Is there anyway to fix that, other than re-create the project from scratch on the new machine?
Is my conclusion even correct and this is the actual reason for the failure? Or there is soething else happening that prevents me from running the program from the Xcode correctly?
Any and all help will be greatly appreciated.
Thank you.
Hi, ALL,
Is there a way to create a masked edit control, for example, to enter IP address or a phone number?
Let's say I have a mask and want to create a fully functional text control to follow that mask.
I'm also curious why Apple does not provide such a useful control. But that's just rhetorical.
Thank you.