Hi.
For a native linker, the contents of the environment variable LDLIBRARYPATH. The default directories, normally `/lib' and `/usr/lib'. If the required shared library is not found, the linker will issue a warning and continue with the link.shared-Bshareable Create a shared library. This is currently only supported on ELF, XCOFF and SunOS. If we print all the environment variable, 'DYLDLIBRARYPATH' is not on the list. So if we add the path into 'DYLDLIBRARYPATH', actually it means we just create a variable named 'DYLDLIBRARYPATH' in current terminal, but 'DYLDLIBRARYPATH' is not a system environment variable.
Ld Library Path
I'm trying to build some software written in C on a Mac (a Mac Mini to be specific) such that the software can be used with iOS running on an ARM chip. The Mac is running OS X v10.10.5, and it has Xcode v7.2.1 installed.
Mac Ld Library Not Found For Lcrypto
Building the software as static libraries seems to work fine. But when the build tried to build dynamic libraries, I saw this error:
ld: library not found for -ldylib1.10.5.o
clang: error: linker command failed with exit code 1 (use -v to see invocation)
The build is specifying an -isysroot qualifier with this as the value:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk
There is a file named dylib1.10.5.o in this directory:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/lib
But there is no such file in what I guess would be the corresponding directory for the iPhone:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/lib
In both directories there is a file named simply dylib1.o. In the first directory above this dylib1.o file is the same size as the dylib1.10.5.o file. In the iPhone directory I copied dylib1.o to dylib1.10.5.o, and this seems to have gotten me past the error (and on to the next one).
I then ran into a similar error saying 'library not found -lgcc_s.10.5'. In this case I copied the file libgcc_s.1.tbd to libgccs_10.5.tbd in the iPhone directory.
These two copies seem to have gotten me past the 'library not found' errors. Although I'm not certain if those two file copies that I did are advisable.
But now I'm getting this:
ld: building for OSX, but linking in object file built for iOS, file '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/lib/dylib1.10.5.o' for architecture armv7
The problem is I don't want to build for OS X; I want to build for iOS.
Here's the invocation of the command to link the dynamic library (slightly redacted):
/usr/bin/gcc -arch armv7 -mthumb -dynamiclib -fPIC -fno-common -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk -o ../lib/lib<name>.dylib ./<obj 1>.o ./<obj 2>.o ./<obj 3>.o -L../lib -lm -lpthread
If I look at the .o files with the 'file' command, it reports that they're ARM files, which is what I want. But apparently they're built for OS X on ARM instead of iOS on ARM.
Ld Library Not Found For Mac Os
Ld Library Not Found For Mac Catalina
What am I missing? Is the problem that I'm invoking /usr/bin/gcc instead of a different tool chain? There doesn't seem to be an alternative in Xcode iPhoeOS hierarchy. How can I obtain the correct gcc?