Linker errors on MacOS (XCode)

I’m trying to add Lex Activator to my project in XCode, using the newest static clang build for C/C++ 11. However when I add the line:

int status = SetProductFile(“Product.dat”);

I get the following errors:

Undefined symbols for architecture x86_64:
“_SCDynamicStoreCopyProxies”, referenced from:
GetSystemProxy(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >&) in libLexActivator.a(LexAbstraction.o)
“_kSCPropNetProxiesHTTPPort”, referenced from:
GetSystemProxy(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >&) in libLexActivator.a(LexAbstraction.o)
“_kSCPropNetProxiesHTTPProxy”, referenced from:
GetSystemProxy(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >&) in libLexActivator.a(LexAbstraction.o)
“_kSCPropNetProxiesHTTPSPort”, referenced from:
GetSystemProxy(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >&) in libLexActivator.a(LexAbstraction.o)
“_kSCPropNetProxiesHTTPSProxy”, referenced from:
GetSystemProxy(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >&) in libLexActivator.a(LexAbstraction.o)
“_kSCPropNetProxiesSOCKSPort”, referenced from:
GetSystemProxy(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >&) in libLexActivator.a(LexAbstraction.o)
“_kSCPropNetProxiesSOCKSProxy”, referenced from:
GetSystemProxy(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >&) in libLexActivator.a(LexAbstraction.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I’m developing with Xcode 8, on OS X 10.11, and I don’t much experience adding/working with libraries. Any help would be appreciated.

Thanks!

1 Like

Hi,

On MacOS you need to link CoreFoundation and SystemConfiguration frameworks with your project to make it work.

1 Like

Awesome thanks, it built successfully.

Does this still apply to last version 3.3.1? I am using the static library (clang) and I still get the symbol(s) not found for architecture x86_64 message after adding CoreFoundation and SystemConfiguration frameworks.

BTW, I am working on a “Installer Plugin” project ( Mac OS X -> Application Plug-ins -> Installer Plugin)

Hi,

v3.x has three dependencies on Mac:

-framework CoreFoundation -framework SystemConfiguration -framework Security

Thanks but I still have the issue after adding Security framework

I am using MacOS 10.14.2 and Xcode 10.1. I am following the sample here https://github.com/cryptlex/lexactivator-c/tree/master/examples (I copied the h files)

This is part of the stacktrace:

“___gxx_personality_v0”, referenced from:

_SetProductFile in LexActivator.a(LexActivator.o)

_SetProductData in LexActivator.a(LexActivator.o)

_SetProductId in LexActivator.a(LexActivator.o)

_SetLicenseKey in LexActivator.a(LexActivator.o)

_SetLicenseCallback in LexActivator.a(LexActivator.o)

std::__1::map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, LicenseCallback, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const, LicenseCallback> > >::operator[](std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in LexActivator.a(LexActivator.o)

_SetActivationMetadata in LexActivator.a(LexActivator.o)

ld: symbol(s) not found for architecture x86_64

clang: error: linker command failed with exit code 1 (use -v to see invocation)

Hi,

Please check out following:

1 Like

Thanks a lot, it compiles now!

This link explains how to add CoreFundation and SystemConfiguration frameworks to macOS project

Thanks for sharing the link.

Just tried upgrading to 3.19.2 and I am getting the following linker errors on the Mac
Undefined symbols for architecture x86_64
_SSLCopyALPNProtocols
_SSLSetALPNProtocols
___darwin_check_fd_set_overflow
___isPlatformVersionAtLeast

My build environment is quite old Mac OSX 10.11.6 and Xcode 7.3.1, so I am guessing I might need to upgrade the build machine, but I wondered what I should be upgrading to.

Trying to support from Mac OS X 10.9 and above.

Hi Patrick,

As per this discussion thread, it seems SSLCopyALPNProtocols() and SSLSetALPNProtocols() are defined in the Secure Transport headers, but Apple did not actually implement the functions in the Security framework until macOS 10.13.4. So you will have to upgrade to at least macOs10.13.4

Regards,
Ahmad.