dlopen failed for DYLIB - Slice is not page aligned - xcode

With binaries built using XCode 13.1 and executing on Monterey 12.0.1
When i load a dylib I get following error:
dlopen failed for DYLIB: (/Library/Application Support/Test/cor.dylib) Error:(dlopen(/Library/Application Support/Test/cor.dylib, 0x0006): tried: '/Library/Application Support/Test/cor.dylib' (slice is not page aligned, fat file, but missing compatible architecture (have 'x86_64,arm64', need 'x86_64h'))).
This is seen when I sign the binary. Same binary which is unsgined works properly.
Both the loader binary and the dylib are built using Standard Architecture (universal). So i am clueleses what might be the error.

Related

#IBDesignable preview in IB again broken under XCode 14.2 on M2?

I receive the error:
.../Base.lproj/MainMenu.xib Failed to render instance of : dlopen(....app, 0x0001): tried: '/...' (no such file), '....app' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS....app' (no such file), '....app' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64'))`
when loading my .xib. Where <MyView> stands for the name of my derivated NSView and the ... for my application name.
There are quite a number of reports with this or a similar issues when the 1st M1 processors were on the market as:
(Xcode 12 Apple M1 arm64 - Designable error: "wrong architecture") or
(IBDesignable Build Failed) and more. Most of them add some pathes to the LD_RUNPATH_SEARCH_PATHS under "Linking".
None of the solutions given there were helpful for me, but I found a link where you could change the arch under which the Terminal should run.
see
Partly solved:
Now after opening my .proj file and when I receive this error, I open the Terminal.app, switch it to Intel and then back to Arm (leaving the terminal window open) and voila the IB preview displays correctly. See result here
Concerning XCode this is a regression, since under Intel Xcode 11 this always was working correctly.
Anybody knows, what is happening or how to avoid this inconvenience?
the formatting now is not ok. The error message ends with
.../Base.lproj/MainMenu.xib Failed to render instance of :
dlopen(....app, 0x0001): tried: '/...' (no such file), '....app'
(mach-o file, but is an incompatible architecture (have 'x86_64', need
'arm64')), '/System/Volumes/Preboot/Cryptexes/OS....app' (no such
file), '....app' (mach-o file, but is an incompatible architecture
(have 'x86_64', need 'arm64'))

macOS cmake based project backward compatibility

I've got a CMake based project that that compiles in MacOS Monterey and produces an application and its dependency dynamic library (dylib file)
When trying to run it macOS bigSur I get the following error :
dyld: Symbol not found: __ZTTNSt3__119basic_ostringstreamIcNS_11char_traitsIcEENS_9allocatorIcEEEE
Referenced from: /Applications/myapp.app/Contents/MacOS/../Frameworks/libMylib.dylib
Expected in: /usr/lib/libc++.1.dylib
in /Applications/myapp.app/Contents/MacOS/../Frameworks/libMylib.dylib
Abort trap: 6
even tough I specifically used the following settings when building the library
set(CMAKE_OSX_DEPLOYMENT_TARGET "11.0" CACHE STRING "Minimum OS X deployment version" FORCE)
Perhaps anybody encountered similar behavior ? the only thing that's works for my is to build the target in BigSur machine.

XCode 8.3 OpenGL linker error: Library not loaded

The GLFW library runs fine in an older project (created in XCode 7.x). I used the same method to add library directory and includes files, but this time it prompts a run time error, the error message is:
dyld: Library not loaded: lib/libglfw.3.dylib
Referenced from: /Users/BlacKay/Documents/Projects/OpenGL Tutorials/OpenGL_tutorial_anton/build/Debug/Learn_OpenGL
Reason: image not found
Program ended with exit code: 9
If someone can point what the potential problem is, that'd be great. Thanks~

Having a issue accessing/loading QJSon dylib at runtime on Mac OS X

I compiled the QJSon code from the command line and it generated a dylib (libqjson.0.7.1.dylib) I then added this file as an external dependency to one of the libraries in my app. (using Xcode 4.3 as the IDE) everything seems to compile correctly. When i go to run the app i get the following error:
dyld: Library not loaded: /Users/shawneckley/Mac_Dev/Development/build/thirdparty/qjson/src/lib/libqjson.0.dylib
Referenced from: /Users/shawneckley/Mac_Dev/Development/Build/bin/Debug/libstonewedgeaccountandclient.dylib
Reason: image not found
(lldb)
any idea why this could be happening?

Xcode linker error- armv7 slice architecture

Having archive error when want to compile into .ipa
I am using:
Mac OS X Leopard 10.6.7
Xcode 4.3 stable.
Clean and Build in simulator no error.
But
Archive for Adhoc under Latest iOS SDK (iOS 4.3) fail.
Error is as below:
Apple Mach-O Linker Error
setenv IPHONEOS_DEPLOYMENT_TARGET 4.3
..
ld: in /Users/bird/Desktop/IPHONE/test/Classes/Libraries/FlurryLib/libFlurry.a, file is universal but does not contain a(n) armv7 slice for architecture armv7
Command /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc-4.2 failed with exist code 1
Wondering way to solve it.
It looks like libFlurry does not support armv7s.
click on the Project, go to Build Settings -> find "valid architectures" and remove "armv7s" from the list.

Resources