@QuinnTheEskimo,
[quote]
There are lots of potential explanations for that. When you run an app from Terminal it inherits an environment that’s very different from the one it gets from Xcode. And that, in turn, in somewhat different from the one it gets when you double click it in the Finder.
As to which one applies, it’s hard to say without more debugging.
[/quote]
What do I need to do in terms of debugging?
Only one library should be loaded and its from the Bundle.
From the post-install script:
#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"
install_name_tool -id '@rpath/Frameworks/libwx_baseu-3.2.dylib' "$TARGET_BUILD_DIR/$TARGET_NAME.app/Contents/Frameworks/libwx_baseu-3.2.dylib"
# Copy and relink network library
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 -id '@rpath/Frameworks/libwx_baseu_net-3.2.dylib' "$TARGET_BUILD_DIR/$TARGET_NAME.app/Contents/Frameworks/libwx_baseu_net-3.2.dylib"
install_name_tool -change '/Users/igorkorot/wxWidgets/buildC11/lib/libwx_baseu-3.2.0.0.0.dylib' '@executable_path/../Frameworks/libwx_baseu-3.2.dylib' "$TARGET_BUILD_DIR/$TARGET_NAME.app/Contents/Frameworks/libwx_baseu_net-3.2.dylib"
# Copy and relink XML library
echo “Copy and relink wxWidgets XML library”
cp -f ~/wxWidgets/buildC11/lib/libwx_baseu_xml-3.2.dylib "$TARGET_BUILD_DIR/$TARGET_NAME.app/Contents/Frameworks/libwx_baseu_xml-3.2.dylib"
install_name_tool -id '@rpath/Frameworks/libwx_baseu_xml-3.2.dylib' "$TARGET_BUILD_DIR/$TARGET_NAME.app/Contents/Frameworks/libwx_baseu_xml-3.2.dylib"
install_name_tool -change "/Users/igorkorot/wxWidgets/buildC11/lib/libwx_baseu-3.2.0.0.0.dylib" @executable_path/../Frameworks/libwx_baseu-3.2.dylib "$TARGET_BUILD_DIR/$TARGET_NAME.app/Contents/Frameworks/libwx_baseu_xml-3.2.dylib"
# Copy the core library
echo "Copy core library"
cp -f ~/wxWidgets/buildC11/lib/libwx_osx_cocoau_core-3.2.dylib "$TARGET_BUILD_DIR/$TARGET_NAME.app/Contents/Frameworks/libwx_osx_cocoau_core-3.2.dylib"
install_name_tool -id '@rpath/Frameworks/libwx_osx_cocoau_core-3.2.dylib' "$TARGET_BUILD_DIR/$TARGET_NAME.app/Contents/Frameworks/libwx_osx_cocoau_core-3.2.dylib"
install_name_tool -change "/Users/igorkorot/wxWidgets/buildC11/lib/libwx_baseu-3.2.0.0.0.dylib" @executable_path/../Frameworks/libwx_baseu-3.2.dylib "$TARGET_BUILD_DIR/$TARGET_NAME.app/Contents/Frameworks/libwx_osx_cocoau_core-3.2.dylib"
# Relink the main binary
echo "Relinking the application"
install_name_tool -change "/Users/igorkorot/wxWidgets/buildC11/lib/libwx_baseu-3.2.0.0.0.dylib" @executable_path/../Frameworks/libwx_baseu-3.2.dylib "$TARGET_BUILD_DIR/$TARGET_NAME.app/Contents/MacOS/dbhandler"
install_name_tool -change "/Users/igorkorot/wxWidgets/buildC11/lib/libwx_baseu_net-3.2.0.0.0.dylib" @executable_path/../Frameworks/libwx_baseu_net-3.2.dylib "$TARGET_BUILD_DIR/$TARGET_NAME.app/Contents/MacOS/dbhandler"
install_name_tool -change "/Users/igorkorot/wxWidgets/buildC11/lib/libwx_baseu_xml-3.2.0.0.0.dylib" @executable_path/../Frameworks/libwx_baseu_xml-3.2.dylib "$TARGET_BUILD_DIR/$TARGET_NAME.app/Contents/MacOS/dbhandler"
install_name_tool -change "/Users/igorkorot/wxWidgets/buildC11/lib/libwx_osx_cocoau_core-3.2.0.0.0.dylib" @executable_path/../Frameworks/libwx_osx_cocoau_core-3.2.dylib "$TARGET_BUILD_DIR/$TARGET_NAME.app/Contents/MacOS/dbhandler"
This is what I am doing in terms of finalizing the build.
Do you see anything wrong with this?
Now, in the Xcode project I did add those libraries in the "Build Settings -> Other Linker Flag -> Debug" as follows:
-L/Users/igorkorot/wxWidgets/buildC11/lib -framework IOKit -framework Carbon -framework Cocoa -framework AudioToolbox -framework System -framework OpenGL -lwx_osx_cocoau_xrc-3.2 -lwx_osx_cocoau_html-3.2 -lwx_osx_cocoau_qa-3.2 -lwx_osx_cocoau_adv-3.2 -lwx_osx_cocoau_core-3.2 -lwx_baseu_xml-3.2 -lwx_baseu_net-3.2 -lwx_baseu-3.2 -L/Users/igorkorot/dbhandler/dbhandler/Build/Products/Debug
So the linking happens from the place the libraries are built, but then post-install script changes it and relink the code appropriately.
This is from my external GUI library.
If you can help me resolve the library loading double, it would be great.
Thank you.
P.S.: If its too hard - I can give you a link to the GitHub repo to look at the Xcode project.
Let me know.
Post
Replies
Boosts
Views
Activity
I have another question in regards to this.
From the Xcode Debug Console:
dyld: loaded: /Users/igorkorot/dbhandler/dbhandler/Build/Products/Debug/dbhandler.app/Contents/MacOS/dbhandler
dyld: loaded: /Applications/Xcode.app/Contents/Developer/usr/lib/libBacktraceRecording.dylib
dyld: loaded: /Applications/Xcode.app/Contents/Developer/usr/lib/libMainThreadChecker.dylib
dyld: loaded: /Applications/Xcode.app/Contents/SharedFrameworks/../Developer/Platforms/MacOSX.platform/Developer/Library/Debugger/libViewDebuggerSupport.dylib
dyld: loaded: /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit
dyld: loaded: /System/Library/Frameworks/Carbon.framework/Versions/A/Carbon
dyld: loaded: /System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa
dyld: loaded: /System/Library/Frameworks/AudioToolbox.framework/Versions/A/AudioToolbox
dyld: loaded: /usr/lib/libSystem.B.dylib
dyld: loaded: /System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL
dyld: loaded: /Users/igorkorot/dbhandler/dbhandler/Build/Products/Debug/dbhandler.app/Contents/MacOS/../Frameworks/libwx_osx_cocoau_xrc-3.2.dylib
dyld: loaded: /Users/igorkorot/dbhandler/dbhandler/Build/Products/Debug/dbhandler.app/Contents/MacOS/../Frameworks/libwx_osx_cocoau_html-3.2.dylib
dyld: loaded: /Users/igorkorot/dbhandler/dbhandler/Build/Products/Debug/dbhandler.app/Contents/MacOS/../Frameworks/libwx_osx_cocoau_qa-3.2.dylib
dyld: loaded: /Users/igorkorot/dbhandler/dbhandler/Build/Products/Debug/dbhandler.app/Contents/MacOS/../Frameworks/libwx_osx_cocoau_adv-3.2.dylib
dyld: loaded: /Users/igorkorot/wxWidgets/buildC11/lib/libwx_osx_cocoau_core-3.2.0.0.0.dylib
dyld: loaded: /Users/igorkorot/wxWidgets/buildC11/lib/libwx_baseu_xml-3.2.0.0.0.dylib
dyld: loaded: /Users/igorkorot/wxWidgets/buildC11/lib/libwx_baseu_net-3.2.0.0.0.dylib
dyld: loaded: /Users/igorkorot/wxWidgets/buildC11/lib/libwx_baseu-3.2.0.0.0.dylib
dyld: loaded: /Users/igorkorot/dbhandler/dbhandler/Build/Products/Debug/liblibtabledataedit.dylib
dyld: loaded: /Users/igorkorot/dbhandler/dbhandler/Build/Products/Debug/liblibdbwindow.dylib
dyld: loaded: /Users/igorkorot/dbhandler/dbhandler/Build/Products/Debug/liblibdialogs.dylib
Is there a reason the libaries are loaded from the Bundle and from the place I build them?
Thank you.
@QuinnTheEskimo,
I understand that.
The problem is that running the application from Terminal is successful (as I wrote in the OP) - no crash like this occur.
Is there an explanation to that?
Thank you.
@QuinnTheEskimo,
I hope now I turn everything off ;-)
See the crash report as a text file...
Thank you.
crash report.txt
@QuickTheEskimo,
I turned off ASAN and re-run the program.
Attached is the crash report. Please review.
crashreport.txt
@QuinnTheEskimo,
I just did the "Detach" thing and got the attached report.
If you could take a look - it would be great.
TIA!!
crashreport.txt
What would be the easiest way to ensure only one copy of the dylib is loaded at a run-time?
When I inspect the Debug Console window I see that when I run the program from Xcode it loads the dylibs twice - once from the place I compiled the library at and second one from the AppBundle.
Is there a way to ensure only AppBundle copy is being loaded?
And of course it is not the case when I just run the program from the Terminal. Everything runs fine.
Running this in Terminal:
Igors-MacBook-Air:Frameworks igorkorot$ install_name_tool -change ~/wxWidgets/buildC11/lib/libwx_baseu-3.2.dylib ~/dbhandler/dbhandler/Build/Products/Debug/dbhandler.app/Contents/Frameworks/libwx_baseu-3.2.dylib ~/dbhandler/dbhandler/Build/Products/Debug/dbhandler.app/Contents/Frameworks/libwx_baseu_net-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$
gives the same results, as you can see.
No relinking.
I am trying it on the OSX High Sierra (10.13.6) with Xcode 9.4.1.
Thank you.
I'm trying this on macOS High Sierra 10.13.6 with Xcode 9.4.1.
@Claude31, what about other files/folders in the xcodeproj directory? Thank you
Hi,
So nobody knows what is happening? I can provide any info upon request to track down the problem and have the ability to debug inside the Xcode on the newer Mac laptop...
@KMT,
Any thoughts?
Thank you.
@KMT,
The reason for my question is as follows:
I have 2 Macs: older one with 10.8 where I started development. Everything works there - I can start debugging from Xcode and I can run the program from Terminal. No issues. (I had to create a post-build script to copy dylibs inside the Bundle).
But then I bought a newer Mac with 10.13. I installed Xcode 9, grab my code from GitHub, recompiled and... Xcode won't run it. It stops somewhere in the assembly code even before hitting the first C++ line.
Since the code is exactly the same, my guess is that Xcode 9 didn't do what Xcode 5 did when I created the project and the sub-projects for dylib - it didn't preserve copying the dylibs as appropriate.
And why I suspect the dylib positioning? Because in the beginning I didn't have that post-build script. So when I tried to run the program from the Terminal on the older Mac I got exactly the same behavior.
So now I need to replicate what Xcode 5 did for my dylib's subproects - check the box in order for them to be automatically copied on the build in order for Xcode to pick them up.
Does this make sense?
Thank you.
P.S.: I hope you will be able to see my reply. There is no notification.
@KMT,
Thank you for the reply.
Unfortunately they are talking about NSTextField and not NSTextView.
And in that case the limit is 1, which is very easy to set.
Is there something for the NSTextView?
Thank you.
P.S.: Maybe this - https://developer.apple.com/documentation/appkit/nstextview/1449532-shouldchangetextinrange?language=objc can be used to implement it?