Topics

Linking against libcrypto on 10.12

Sandor Szatmari
 

I am upgrading some projects to 10.12 SDK and I cannot understand the following:

If I link against libcrypto in /usr/lib Xcode tells me:
ld: library not found for -lcrypto.0.9.8

If I link against the MacPorts installed /opt/local/lib/libcrypto.dylib the linking is successful

Can anyone explain why this doesn’t work? And/or provide a method of linking to the system installed library?

This phase of the upgrade is a stopgap to update code before moving to more current libraries.

Cheers,
Sandor

Sak Wathanasin
 

I am upgrading some projects to 10.12 SDK and I cannot understand the
following:

If I link against libcrypto in /usr/lib Xcode tells me:
ld: library not found for -lcrypto.0.9.8
openssl was removed a few OS release ago - 10.11? We had to build openssl
from source and add libcrpyto etc to our app's bundle as we needed it.

Regards
Sak

Sandor Szatmari
 

Yea, I followed the whole removal, knowing I’d have to deal with it eventually.

I have the headers and the library IS still there for runtime, for applications that need it. So… I was assuming that I should be able to link against it. But I can’t for some reason. I’d like to avoid thinking of the implications of changing the crypto version while troubleshooting the affects caused by other changes. The fewest changes at one time the better.

Sandor

On Jan 14, 2020, at 09:54, Sak Wathanasin <@sakw> wrote:



I am upgrading some projects to 10.12 SDK and I cannot understand the
following:

If I link against libcrypto in /usr/lib Xcode tells me:
ld: library not found for -lcrypto.0.9.8
openssl was removed a few OS release ago - 10.11? We had to build openssl
from source and add libcrpyto etc to our app's bundle as we needed it.

Regards
Sak




 

On Jan 14, 2020, at 7:07 AM, Sandor Szatmari <admin.szatmari.net@...> wrote:

I have the headers and the library IS still there for runtime, for applications that need it. So… I was assuming that I should be able to link against it.
Nope. Remember that the Xcode toolchain’s search paths point to the headers/libs in the SDK, not the ones in the system. There’s no libcrypto.dylib in the SDK anymore.

Workaround is to explicitly link with the copy in /usr/lib.

But yes, best to stop using libcrypto (IIRC it’s been deprecated since 2005 or so.) The CommonCrypto headers have some adapter macros that make some common use cases like digests easy to port over.

—Jens

Sandor Szatmari
 

Jens,

On Jan 14, 2020, at 12:48, Jens Alfke <@snej> wrote:


On Jan 14, 2020, at 7:07 AM, Sandor Szatmari <admin.szatmari.net@...> wrote:

I have the headers and the library IS still there for runtime, for applications that need it. So… I was assuming that I should be able to link against it.
Nope. Remember that the Xcode toolchain’s search paths point to the headers/libs in the SDK, not the ones in the system. There’s no libcrypto.dylib in the SDK anymore.
Yes, I examined the linker command and I saw the $(SDK)/usr/lib in the command


Workaround is to explicitly link with the copy in /usr/lib.
I have tried /usr/lib to no avail…

I did just get it to work by linking against the version in the 10.9 SDK. Although I am not happy about having this path in my linking command, not ideal.

But yes, best to stop using libcrypto (IIRC it’s been deprecated since 2005 or so.) The CommonCrypto headers have some adapter macros that make some common use cases like digests easy to port over.
Yea, that’s part of what this exercise is all about, but I am trying to limit the number of changed variables at each stage for more controlled chaos during the process.

Thanks,
Sandor


—Jens