macOS Sierra dyld library not loaded

Completed

macOS Sierra version 10.12 CLion 2016.2.2 Build #CL-162.1967.7

dyld: Library not loaded: sobj4/igl4a304.dylib
  Referenced from: /Applications/IBM/informix/lib/cli/iclis09b.dylib
  Reason: image not found

 

Library is present

cd /Applications/IBM/informix/
ls
iclis09b.bundle    iclit09b.bundle    idmrs09a.dylib    libdmr.a    libifcli.dylib    libifdmr.dylib    libtcli.dylib    libthcli.dylib
iclis09b.dylib    iclit09b.dylib    libcli.a    libifcli.a    libifdmr.a    libixcli.dylib    libthcli.a

 

Any suggestions how to solve this issue?

 

PS. Setting up DYLD_LIBRARY_PATH and DYLD_FALLBACK_LIBRARY_PATH environment variables did not help.

0
7 comments

Hi,

If it happens to you after upgrade to macOS Sierra and you use Xcode then you should probably check Xcode version. Xcode 8 is recommended version for Sierra. Also please check that

$ xcode-select -p

 

gives valid path.

In case if it's doesn't help or not connected to macOS upgrade please try to build your project from console

 

$ mkdir bld && cd bld && cmake -G "Unix Makefiles" <path to CMakeLists.txt>

0
Avatar
Permanently deleted user

Hello, I'm building from CLion with cmake

CMakeLists.txt source

cmake_minimum_required(VERSION 3.6)
project(test15)

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Werror")

include_directories("/Applications/IBM/informix/incl/cli/")
link_directories(/Applications/IBM/informix/lib/cli/)
link_libraries(libifcli.a)

set(SOURCE_FILES main.c)
add_executable(test15 ${SOURCE_FILES})
0
Avatar
Permanently deleted user
from IBM

2. For shared library support, environment variable DYLD_LIBRARY_PATH needs to be set to include the $INFORMIXDIR/lib/cli directories where IBM INFORMIX ODBC shared libraries are installed. (for C Shell) setenv DYLD_LIBRARY_PATH $INFORMIXDIR/lib:$INFORMIXDIR/lib/cli: $INFORMIXDIR/lib/esql:$DYLD_LIBRARY_PATH (for Bourne or Korn Shell) DYLD_LIBRARY_PATH=$INFORMIXDIR/lib/cli:$INFORMIXDIR/lib/esql: $DYLD_LIBRARY_PATH export DYLD_LIBRARY_PATH

But in macOS Sierra I'm not ablle to setup in .bash_profile those variables. No effect.
0

You may try to list all paths in 

link_directories(dir1 dir2 ..)

and then try to specifically link needed libraries in 

target_link_libraries(<target> ... <item>... ...)
0
Avatar
Permanently deleted user

I think the issue is not connected with cmake configuration.

I think the issue is connected with macOS Sierra SIP feature. Where should be a way how to break through SIP and allow to load dynamic libraries not from system defined paths.

First I need to notify macOS to use custom defined dynlib path and allow to use it. But I didn't find out how to do it yet.

 

otool -L /Users/Kingfisher/Library/Caches/CLion2016.2/cmake/generated/test15-9404ba49/9404ba49/Debug/test15
/Users/Kingfisher/Library/Caches/CLion2016.2/cmake/generated/test15-9404ba49/9404ba49/Debug/test15:
    iclis09b.dylib (compatibility version 0.0.0, current version 0.0.0) (Should be  /Applications/IBM/informix/lib/cli/iclis09b.dylib)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1238.0.0

0
Avatar
Permanently deleted user

Ok. In Xcode Version 8.0 (8A218a) the problem was solved by changing in General->Linked Frameworks and Libraries section by adding the name of dylib and changing it Status field from Required to Optional. The code was complied successfully.

Does any equivalent steps have to be made in CLion?

0
Avatar
Permanently deleted user

Got the same issue after upgrading. Cannot use any of my External Tools.

In my case I get:
dyld: Library not loaded: /usr/local/opt/jpeg/lib/libjpeg.8.dylib
Referenced from: /usr/local/opt/php56/bin/php
Reason: image not found


This solution worked for me https://stackoverflow.com/questions/32703296/dyld-library-not-loaded-usr-local-lib-libjpeg-8-dylib-homebrew-php?answertab=votes#tab-top

0

Please sign in to leave a comment.