Linker errors on MacOS (XCode)


#1

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!


#2

Hi,

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


#3

Awesome thanks, it built successfully.


#4

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)


#5

Hi,

v3.x has three dependencies on Mac:

-framework CoreFoundation -framework SystemConfiguration -framework Security


#6

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)


#7

Hi,

Please check out following:


#8

Thanks a lot, it compiles now!