Can't debug in omnetpp ide 6.0, on apple silicon - omnet++

I have not installed xcode application, but I have installed xcode developer tools. When I try to debug in ide, it prompts :
Could not determine GDB version using command: lldbmi2 --version
dyld[12479]: Library not loaded: '#rpath/LLDB.framework/LLDB'
Referenced from: '/Users/ram/Developer/omnetpp-6.0/tools/macos.x86_64/bin/lldbmi2'
Reason: tried: '/Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/LLDB' (no such file), '/Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/LLDB' (no such file), '/Library/Frameworks/LLDB.framework/LLDB' (no such file), '/System/Library/Frameworks/LLDB.framework/LLDB' (no such file)
What I did to resolve ?
Tried to create the below path, and copied lldb from /usr/bin/lldb so that it can be found
/Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/LLDB
But then also I got error, can't link against a main executable, which I am not familiar with.
Reason: tried:
'/Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/LLDB'
(cannot link against a main executable
'/Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/LLDB'),
'/Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/LLDB'
(cannot link against a main executable '/
So finally I thought this was issue of lldbmi2, so I downloaded latest 1.1.0 version, complied and replaced with prev in bin folder of omnet, but it started to look for gdb which is not on system.
So, I am not sure how to get the debugger to work on this machine, I am fine with lldb or gdb either. But I suppose ide wants to use lldb.

Related

runtime error ‘symbol not found in flat namespace’ on macOS 12 but not macOS 10.15, with both Xcode and CMake builds

I have problems building an executable file for a simple disease-transmission model implemented in C++, using cmake under macOS Monterey (v12.6.1). When I build the executable file, I obtain the following error when I try running it:
dyld[5281]: symbol not found in flat namespace (_cblas_caxpy) Abort trap: 6
The problem persists when I try to use XCode (v14.0.1) instead, resulting in the same error message.
Interestingly, my friend is able to build (& run) the executable file under macOS v10.15.7 without any problems.
Does anybody know what is going on here and how this issue can be resolved? The C++ project is publicly available on GitHub: https://github.com/AnnaMariaL/DengueSim
Any help would be very much appreciated.
Thanks!
Anna
tried: build an executable file with cmake, and Xcode under MacOS v12.16.1
expected: executable file
the program runs fine when launched under Xcode itself, but if I try to run the built executable from Xcode on the command line, that fails with the same error as for the CMake executable. So Xcode itself is, somehow, magically able to get this linker issue to resolve.
Your title/post is very confusing, however the issue isn't with cmake. It's with your cblas library and/or your linker. Look at the bug closely:
dyld[5281]: symbol not found in flat namespace (_cblas_caxpy) Abort trap: 6
Your linker is telling you that it can't find a function (symbol) in the given namespace. This is either due to the fact that your linker doesn't know where to find the correct library or you are linking against a wrong version of the library that doesn't have the symbols. The other issues might be related to how the library was built and with what it was built (architecture, compiler, etc...). This we can't answer because we don't have enough information to know for sure.

Tesseract .net on macos, how to reference libdl.dylib on macOS12?

I'm running a .net application that requires a reference to libdl.so
System.DllNotFoundException : Unable to load shared library 'libdl.so' or one of its dependencies. In order to help diagnose loading problems, consider setting the DYLD_PRINT_LIBRARIES environment variable: dlopen(liblibdl.so, 0x0001): tried: 'liblibdl.so' (no such file), '/usr/local/lib/liblibdl.so' (no such file), '/usr/lib/liblibdl.so' (no such file), '/Users/Amplicity/Documents/liblibdl.so' (no such file)
After some light reading, i found that libdl.so is the linux equivalent of libdl.dylib, I then tried to find libdl.dylib on my machine.
➜ lib locate libdl.dylib
/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/tvOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libdl.dylib
/Applications/Xcode.app/Contents/Developer/Platforms/WatchOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/watchOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libdl.dylib
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libdl.dylib
There are only tvos, watchos, and ios signed libdl.dylib's available. Some more light reading reveals that somewhere around xcode 7, .dylib files were replaced with .tbd, which is a text file that references dylibs elsewhere.
➜ lib locate libdl.tbd
/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/usr/lib/libdl.tbd
/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk/usr/lib/libdl.tbd
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib/libdl.tbd
/Applications/Xcode.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/usr/lib/libdl.tbd
/Applications/Xcode.app/Contents/Developer/Platforms/WatchSimulator.platform/Developer/SDKs/WatchSimulator.sdk/usr/lib/libdl.tbd
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/lib/libdl.tbd
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/lib/libdl.tbd
/Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/lib/libdl.tbd
/Library/Developer/CommandLineTools/SDKs/MacOSX12.0.sdk/usr/lib/libdl.tbd
/Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk/usr/lib/libdl.tbd
/Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk/usr/lib/libdl.tbd
I attempted to symlink the .tbd to the .so that my .net application expects, but .net complained that it was net a mach-o file.
I then attempted to symlink the tvos .dylib to the .so, and got a different error stating that it needed to be signed for macos.
How can I find/conjure libdl.dylib on macOS12, so that I may directly reference it in my application?
I suppose you cannot rebuild that application, cause currently libdl.so` would not be requested as it is not deployed anymore as standalone.
Try to make symlink of libdl.so to libc.so (or whichever version is installed with your .net platform package, libc.so.x)

Qt Project Dyld Error Setting rpath

I have a Qt project and I need to include some libraries
I have this in my .pro file:
QT += webengine
I can build and run it fine on my Mac but if I try to send the .app to someone else and they run it, there is this error:
Dyld Error Message:
Library not loaded: #rpath/QtWebEngine.framework/Versions/5/QtWebEngine
Referenced from: /path/myApp.app/Contents/MacOS/myApp
Reason: image not found
I have the QtWebEngine.framework and its corresponding QtWebEngine.framework.dSYM file in my directory:
Users/myUsername/Qt/5.11.0/clang_64/lib
I also have the .framework in my directory:
Library/Frameworks
In the editor, I looked at Projects > Desktop Qt 5.11.0 clang 64bit2 > Run > Run Environment, and I found that the DYLD_FRAMEWORK_PATH points to where the .framework file is located. Same for DYLD_LIBRARY_PATH.
This is confusing me because it works on my Mac but not on others. It also seems like the paths are all in order. I have tried using other suggestions on this website but they do not seem to work for me or maybe I just did them wrong. Maybe someone could help me?
Update:
If I need to add the .pak resource files to my deployment, how can I do this?

MacRuby release app missing libmacruby.dylib

Using XCode 4.5.2 and MacRuby 0.12, my app works fine on my computer but the release version won't work on others computers :
Dyld Error Message:
Library not loaded: /Library/Frameworks/MacRuby.framework/Versions/0.12/usr/lib/libmacruby.dylib
Referenced from: /Users/USER/Desktop/PocheFactory.app/Contents/MacOS/PocheFactory
Reason: image not found
I have checked my deployment settings and they seems fine:
In the BuildPhases->"Link Binary With Libraries", I have the "MacRuby.framework" required and in the BuildSettings->Framework Search Paths, I have include "/Library/Frameworks" with recursive option.
How come this particular library is not included within the release version?
Any idea?
Rather than figuring out the right Xcode settings, it's much easier to run this:
/usr/local/bin/macruby_deploy --compile --embed
I got this info from Matt Aimonetti's MacRuby, The Definitive Guide.
(The last command argument was stripped off: it's the path to the application bundle in Derived Data that was created by Xcode.)

Deploying Qt Frameworks with Mac app and usage of otool

I have a problem deploying Qt frameworks with my Mac app, and I hope some will have a clue why I get this error, when I run the app on clean Mac, i.e. not a developer Mac.
OS: 10.7 .2 and using XCode
Error msg:
Library not loaded: #loader_path/../Frameworks/QtCore.framework/Versions/4.0/QtCore
Referenced from:/Users/someUser/Downloads/MainApp.app/Contents/Resources/Lib/Library.bundle/Contents/MacOS/../Frameworks/../Frameworks/QtXml.framework/Versions/4/QtXml
Clearly something is wrong since the QtXml is referenced from /../Frameworks/../Frameworks, which doesn’t exists.
This is the set up: I have a dylib that uses QtCore and QtXml (not by my choosing, but for now I need those two frameworks), the dylib is used in a NSBundle, which is loaded by the main app, the bundle is located in the resource folder. The dylib is moved by Copy Files Build Phase to the folder Contents/Frameworks and with otool the install_name is set to (as stated by http://doc.qt.digia.com/4.3/deployment-mac.html):
#loader_path/../Frameworks/QtCore.framework/Versions/4.0/QtCore
#loader_path/../Frameworks/QtXml.framework/Versions/4/QtXml
then the Qt frameworks are moved to Contents/Frameworks and the install_name of the is set to:
#executable_path/../Frameworks/QtCore.framework/Versions/4.0/QtCore
and for the QtXml
#executable_path/../Frameworks/QtXml.framework/Versions/4/QtXml
with reference to QtCore:
#executable_path/../Frameworks/QtCore.framework/Versions/4.0/QtCore
Now when I run the app on the developer mac it clearly works since Qt is installed, but when moved to a clean mac I get the error msg, readable in the Console app.
I’ve tried to change the executable_path to loader_path, but this didn’t work.
I have no idea what I’m doing wrong or why it won't for, and have not been able to find anything on Google, of course I could be looking at the wrong places. Any ideas how to fix this problem?
This is the entire error message:
MainApp: Error Domain=NSCocoaErrorDomain Code=3587 "The bundle
“Library” couldn’t be loaded because it is damaged or missing
necessary resources."
(dlopen_preflight(/Users/someUser/Downloads/MainApp.app/Contents/Resources/Lib/Library.bundle/
Contents/MacOS/Library): Library not loaded:
#loader_path/../Frameworks/QtCore.framework/Versions/4.0/QtCore
Referenced from: /Users/ someUser /Downloads/
MainApp.app/Contents/Resources/Lib/Library.bundle/Contents/MacOS/../Frameworks/../Frameworks/QtXml.framework/Versions/4/QtXml
Reason: image not found) UserInfo=0x107c5d5d0
{NSLocalizedFailureReason=The bundle is damaged or missing necessary
resources., NSLocalizedRecoverySuggestion=Try reinstalling the
bundle.,
NSFilePath=/Users/someUser/Downloads/MainApp.app/Contents/Resources/Lib/Library.bundle/Contents/MacOS/Library,
NSDebugDescription=dlopen_preflight(/Users/someUser
/Downloads/MainApp.app/Contents/Resources/Lib/Library.bundle/Contents/MacOS/Library):
Library not loaded:
#loader_path/../Frameworks/QtCore.framework/Versions/4.0/QtCore
Referenced from:
/Users/someUser/Downloads/MainApp.app/Contents/Resources/Lib/Library.bundle/Contents/MacOS/../Frameworks/../Frameworks/QtXml.framework/Versions/4/QtXml
Reason: image not found,
NSBundlePath=/Users/someUser/Downloads/MainApp.app/Contents/Resources/Lib/Library.bundle,
NSLocalizedDescription=The bundle “Library” couldn’t be loaded because
it is damaged or missing necessary resources.}
On the development mac everything works because the Qt libraries are installed. On any mac you ship the app to, though, this likely won't be the case. The Qt suite comes with a tool called macdeployqt to fix this. So in a terminal, after you've compiled your application, do something like:
# cd my-cool-app-Desktop
# macdeployqt my-cool-app.app
Note that it can also be used to create a .dmg file for shipping everything together:
# cd my-cool-app-Desktop
# macdeployqt my-cool-app.app -dmg
Once you've done that, the .app directory or .dmg file can be given to someone else without Qt installed to use and run as they normally would.
The one caveat is that the next time you try to run it on your developer machine, it may complain about multiple shared libraries installed. So once you've copied it else where in order to distribute it, remove the entire .app directory and let qtcreator (or whatever) rebuild it.
UPDATE
As stated compiling QT to static libs is the way to go. With the release of Mavericks (10.9) we need to codesign frameworks as well (http://furbo.org/2013/10/17/code-signing-and-mavericks/), and with QT4.8.5 there are some issues (https://bugreports.qt-project.org/browse/QTBUG-32896). Even with suggested fixes I still had some issues when running the app on a clean machine. Therefore, I ended up with compiling Qt5.2 to staticlibs, link them in the app, and codesign them.
OLD
Problem sovled, I moved the Qt-frameworks into the app bundle in Contents/Frameworks and with otool set the path to #executable_path/../Frameworks, i.e. moved it out of my library bundle. Yes the solution is simple, but I'm still not sure why the library executable couldn't find the frameworks when using #loader_path.
The best solution would probably be to use a static library and not wrap it in a bundle...you learn everyday ;)

Resources