dyld: Library not loaded: #rpath/… Reason: image not found when code signed - macos

I have an app bundle containing a cli tool and a dylib. For testing I am calling the cli tool in Terminal (iTerm2):
DYLD_INSERT_LIBRARIES=./libwebsockets.14.dylib THNUCLNT_SVC="private" ./thnuclnt -v
dyld: Library not loaded: #rpath/libwebsockets.14.dylib
Referenced from: /Users/rwelz/Downloads/ezeep Connector.app/Contents/Resources/thnuclnt/thnuclnt/x86_64-darwin/./thnuclnt
Reason: image not found
Abort trap: 6
When I remove the signature from cli tool, everything works fine:
codesign --remove-signature thnuclnt
DYLD_INSERT_LIBRARIES=./libwebsockets.14.dylib THNUCLNT_SVC="private" ./thnuclnt -v
ThinPrint Client Mac Version 7.6.10.1, (c) 2007-2019 ThinPrint GmbH
removing signature from libwebsockets.14.dylib has no effect at all.
I know that the cli tool is using dlopen to load the dylib. But I have no code for the cli tool nor for the libwebsockets.dylib since these are programmed by a colleague of mine. I am only responsible for putting everything together in the app bundle. But everything is build on our build server - so everything uses the same certificate for code signing.
I expect my cli tool to load libwebsockets.dylib and execute and output the same as if it had no signature.
What is changing on the cli tool when codesign is applied? What is going on here?
Many thanks for your valuable help
regards,
Robert
PS.:
libwebsockets.14.dylib and tnuclnt reside in the same directory inside the resource folder of the app:
~/Downloads/my_supersecret.app/Contents/Resources/thnuclnt/thnuclnt/x86_64-darwin/] $ ls -l
total 3368
-rwxr-xr-x 1 rwelz staff 268K Sep 25 11:35 libwebsockets.14.dylib
-rwxr-xr-x 1 rwelz staff 321K Sep 25 11:35 thnuclnt

Related

dyld: Library not loaded running command

I downloaded some binaries for my mac from https://github.com/rcedgar/muscle/releases/tag/v5.0.1428
I moved it to a folder, ran
chmod +x /Users/schuylersloman/Documents/CODE/BIO_LAB/SENIOR_YEAR/muscle_v5.0.1428_osx
and then when I tried running
./muscle_v5.0.1428_osx muscle -align ny_ct.fasta -output alignment.fasta
I Get the error
dyld: Library not loaded: /usr/local/opt/gcc/lib/gcc/11/libgomp.1.dylib
Referenced from: /Users/schuylersloman/Documents/CODE/BIO_LAB/SENIOR_YEAR/./muscle_v5.0.1428_osx
Reason: image not found
Abort trap: 6
Any help on how to fix this or what is going on?
I am the author of muscle. Try rebuilding using the new build system described in the github wiki, which at the time of writing (8th Dec 2022) is in the rce-dev branch. I only saw this stackoverflow post by chance; I am more likely to be able to help if you post an issue on github or email me directly.

Problem while trying to install Awesome-VM in Alpine Linux

I'm trying to install the Awesome VM in Alpine Linux following this tutorial.
I have passed the following commands:
$ sudo apk add awesome feh lxterminal
$ sudo apk add lua
$ setup-xorg-base
Then and all the commands in the "Start Your Desktop" section ...
... but when I pass this command :
$ startx
I got the following errors:
hostname: dev-box: Host not found
xauth: unable to link authority file /home/babonet13/.Xauthority, use /home/babonet13/.Xauthority-n
xauth: unable to link authority file /home/babonet13/.Xauthority, use /home/babonet13/.Xauthority-n
X.Org X Server 1.20.1
X Protocol Version 11, Revision 0
Build Operating System: Linux 4.14.39-0-vanilla x86_64 Alpine Linux
Current Operating System: Linux dev-box 4.14.69-0-vanilla #1-Alpine SMP Mon Sep 10 19:33:23 UTC 2018 x86_64
Kernel command line: BOOT_IMAGE=vmlinuz-vanilla root=UUID=26f38daa-766f-49f1-abb3-a0f7e8fc9d15 modules=sd-mod,usb-storage,ext4 nomodeset quiet rootfstype=ext4 initrd=initramfs-vanilla
Build Date: 30 August 2018 02:57:08PM
Current version of pixman: 0.34.0
Before reporting problems, check http://wiki.x.org
to make sure that you have the latest version.
Markers: (--) probed, (**) from config file, (==) default setting,
(++) from command line, (!!) notice, (II) informational,
(WW) warning, (EE) error, (NI) not implemented, (??) unknown.
(==) Log file: "/var/log/Xorg.0.log", Time: Fri Oct 5 13:33:54 2018
(==) Using config directory: "/etc/X11/xorg.conf.d"
(==) Using system config directory "/usr/share/X11/xorg.conf.d"
(EE)
Fatal server error:
(EE) no screens found(EE)
(EE)
Please consult the The X.Org Foundation support
at http://wiki.x.org
for help.
(EE) Please also check the log file at "/var/log/Xorg.0.log" for additional information.
(EE)
(EE) Server terminated with error (1). Closing log file.
xinit: giving up
xinit: unable to connect to X server: Connection refused
xinit: server error
deallocvt: can't open console
Can could help me to start debugging it in the right way?
This is a problem installing X.org on Alpine Linux, you have not yet reached the point where Awesome is involved. I suggest you edit your post title and tags to reflect this. Also, stackoverflow is for programming question. If you have further installation issues, it is preferred to use SuperUser
Nevertheless:
(EE) no screens found(EE)
This is the error. It usually means you didn't install the video drivers or your kernel doesn't have the right modules or you use a static X.org build and it doesn't have the right compile options or you have a custum xorg.conf[.in] file that isn't representative of your setup.
/var/log/Xorg.0.log may have more information, but from my past experience with this kind of issue, wont provide more relevant details.
Also, it is AwesomeWM, not Awesome-VM.

Issues with gdb code signature on OS X

Unable to find Mach task port for process-id 2546: (os/kern) failure
(0x5).\n (please check gdb is codesigned - see taskgated(8))
What's wrong with my ggdb debugger tool (gdb installed by MacPorts), It was working perfectly for months till now!
The whole problem starts just after running the following command to install some avr tools and libraries:
port install avrdude avarice avr-binutils avr-gcc avr-libc avr-gdb simulavr uisp git gcc5 gcc6
It's not a How-to-sign question, it's already signed months ago, however I'll really appreciate any help suggestions.
You may need to have a look at those:
which ggdb
/opt/local/bin/ggdb
security find-identity -p codesigning
Policy: Code Signing
Matching identities
1) 4627C4FCFACC41114B956E7DAB83E83C014641BC "gdb-cert"
1 identities found
Valid identities only
1) 4627C4FCFACC41114B956E7DAB83E83C014641BC "gdb-cert"
1 valid identities found
find / -name gdb
I'm not using this.
/Applications/Android Studio.app/Contents/bin/lldb/shared/stl_printers/gdb
/Applications/Arduino.app/Contents/Java/hardware/tools/avr/include/gdb
/Applications/CLion.app/Contents/bin/gdb
/Applications/CLion.app/Contents/bin/gdb/bin/gdb
/Applications/CLion.app/Contents/bin/gdb/share/gdb
/Applications/CLion.app/Contents/bin/gdb/share/gdb/python/gdb
/opt/local/include/gdb
/opt/local/libexec/gnubin/gdb
/opt/local/share/gdb
/opt/local/share/gdb/python/gdb
/opt/local/share/glib-2.0/gdb
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_cross_i386-mingw32-binutils/i386-mingw32-binutils/work/binutils-2.21/include/gdb
/opt/local/var/macports/software/gdb
/opt/local/var/macports/sources/rsync.macports.org/release/tarballs/ports/devel/gdb
find / -name ggdb
I'm using this.
/opt/local/bin/ggdb
uname -a
Darwin Ghoneim.local 15.4.0 Darwin Kernel Version 15.4.0: Fri Feb 26 22:08:05 PST 2016; root:xnu-3248.40.184~3/RELEASE_X86_64 x86_64
Thanks for advance for helping me figuring it out..

File not found error for .app file when running logical unit tests in Cocoa Touch

I'm get the following error when attempting to run my newly created logical unit tests for cocoa touch (with newly created target for said unit tests):
ld: file not found: /Users/mtford/Library/Developer/Xcode/DerivedData/MyApp-fggwogwgifttccffwerwbfhoklcf/Build/Products/Debug-iphonesimulator/MyApp.app/MyApp
clang: error: linker command failed with exit code 1 (use -v to see invocation)
However this location does exist in my file system:
Michaels-MacBook-Air:~ mtford$ ls -l /Users/mtford/Library/Developer/Xcode/DerivedData/MyApp-fggwogwgifttccffwerwbfhoklcf/Build/Products/Debug-iphonesimulator/MyApp.app/MyApp
-rwxr-xr-x 1 mtford staff 3160412 Jun 25 19:10 /Users/mtford/Library/Developer/Xcode/DerivedData/MyApp-fggwogwgifttccffwerwbfhoklcf/Build/Products/Debug-iphonesimulator/MyApp.app/MyApp
I'm at my wits end trying to solve this...
Update
I found out why Xcode is throwing an error: its looking for:
" /Users/mtford/Library/Developer/Xcode/DerivedData/Mosayc-fggwogwgifttccffwerwbfhoklcf/Build/Products/Debug-iphonesimulator/Mosayc.app/Mosayc"
when running the Ld command. Notice the space at the front? This causes an error in bash. Any ideas where this space could be coming from?
In my target settings under Bundle loader I had "$(BUILT_PRODUCTS_DIR)/MyApp.app/MyApp" (notice the space). I removed the space and still didn't work. I removed the quotes as well and then it worked fine!

java 6 on mac os x 10.7.5

On my Mac, I deleted java locally, just deleted the folder with java (/System/Library/Frameworks/JavaVM.framework/Versions/).
When I install java 6 again, I was installed into: /Library/Java/JavaVirtualMachines/
Then after installation new one, I have this error when trying to invoke './java' from the console:
Here I put java into my home directory. But, even if use standard one I've got the same exception:
dyld: Library not loaded: /System/Library/Frameworks/JavaVM.framework/Versions/A/JavaVM
Referenced from: /Users/myuser/java/1.6.0.jdk/Contents/Home/bin/./java
Reason: image not found
Trace/BPT trap: 5
Is there any way to fix it?
---2---
Here I just copied working Java 6 from different machine and put to proper/default location, then go to .../bin and type ./java:
$ pwd
/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin
$ ./java -version
dyld: Library not loaded: #rpath/libjli.jnilib
Referenced from: /Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/./java
Reason: image not found
Trace/BPT trap: 5
But if install Java 7, it works perfectly.
--3--
If install JavaDeveloper.pkg package (javadeveloper_for_os_x_2012006__11m3909.dmg) with jdk6 in it - from Apple site
dyld: Library not loaded: /System/Library/Frameworks/JavaVM.framework/Versions/A/JavaVM
Referenced from: /Library/Java/JavaVirtualMachines/1.6.0_37-b06-434.jdk/Contents/Home/bin/./java
Reason: image not found
Trace/BPT trap: 5
--4--
If try to install java 6 (open jdk) from mac ports
$ sudo port install openjdk6
info:build Exiting because of the above error(s). \n
:info:build make: *** [post-sanity] Error 1
:info:build Command failed: cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_java_openjdk6/openjdk6/work/." && /usr/bin/make ARCH_DATA_MODEL="64" ALT_BOOTDIR="/opt/local/share/java/openjdk6_bootstrap" ALT_JDK_IMPORT_PATH="/opt/local/share/java/openjdk6_bootstrap" ALT_BINARY_PLUGS_PATH="/opt/local/share/java/icedtea6-plugs/jre/lib/rt-closed.jar" ALT_DROPS_DIR="/opt/local/var/macports/distfiles/openjdk6" ANT_HOME="/opt/local/share/java/apache-ant" ALT_FREETYPE_HEADERS_PATH="/opt/local/include" ALT_FREETYPE_LIB_PATH="/opt/local/lib" ALT_CUPS_HEADERS_PATH="/usr/include" ALT_MOTIF_DIR="/opt/local" ALT_X11_PATH="/opt/local" ALT_DEVTOOLS_PATH=/usr ALT_CACERTS_FILE=/System/Library/Frameworks/JavaVM.framework/Home/lib/security/cacerts NO_DOCS=true LANG="C" BUILD_NUMBER="b20" MILESTONE=fcs HOTSPOT_BUILD_JOBS="2"
**:info:build Exit code: 2
:error:build org.macports.build for port openjdk6 returned: command execution failed
:debug:build Error code: CHILDSTATUS 7773 2
:debug:build Backtrace: command execution failed**
Ok. I fixed it.
The problem was that there are two places that Java is located.
/System/Library/Frameworks/JavaVM.framework (were real jdk 6 is located)
/Library/Java/JavaVirtualMachines/ (were may java6 is now, it has only links)
And if put JDK to source 1, it will try refers to source 2 (by symlinks) using specific version of java (in my case it is 1.6.0) and it could not find proper object/file to link to.
As soon as I fixed it started working.
So, I just restored all contents, getting it from another working machine. Bu the idea is that Mac OS uses two locations to store java related files.

Resources