smartlink and C++ name mangling on OS X

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

smartlink and C++ name mangling on OS X

H. William Welliver III-2
I tracked down a problem compiling a c++ module on OS X 10.12. Everything compiles properly but I get lots of symbol not found errors during linking. It seems that the mangled symbol names being generated for the module were a lot shorter than the ones in the library. For example:

__ZN6Xapian11QueryParser11parse_queryERKSsjS2_

versus:

__ZN6Xapian11QueryParser11parse_queryERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEjS9_

After a good bit of messing around (I assumed it was due to some command line option passed to clang/ld) I discovered that there’s a line in smartlink that sets:

MACOSX_DEPLOYMENT_TARGET=10.3

And this setting alters a number of behaviors in the compiler/linker including the style of name mangling used.

It looks like the minimum version required for modern libraries to work is 10.9.

Is there any chance we can bring that forward? Perhaps 10.9 for versions 10.9 and up, and whatever previous version makes most sense... I still compile for 10.6 as a courtesy for some folks but don’t know anyone running anything earlier.

Any thoughts?

Bill
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: smartlink and C++ name mangling on OS X

Peter Bortas-2
On Thu, Dec 22, 2016 at 5:09 PM, H. William Welliver III
<[hidden email]> wrote:

> I tracked down a problem compiling a c++ module on OS X 10.12. Everything compiles properly but I get lots of symbol not found errors during linking. It seems that the mangled symbol names being generated for the module were a lot shorter than the ones in the library. For example:
>
> __ZN6Xapian11QueryParser11parse_queryERKSsjS2_
>
> versus:
>
> __ZN6Xapian11QueryParser11parse_queryERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEjS9_
>
> After a good bit of messing around (I assumed it was due to some command line option passed to clang/ld) I discovered that there’s a line in smartlink that sets:
>
> MACOSX_DEPLOYMENT_TARGET=10.3
>
> And this setting alters a number of behaviors in the compiler/linker including the style of name mangling used.
>
> It looks like the minimum version required for modern libraries to work is 10.9.
>
> Is there any chance we can bring that forward? Perhaps 10.9 for versions 10.9 and up, and whatever previous version makes most sense... I still compile for 10.6 as a courtesy for some folks but don’t know anyone running anything earlier.
>
> Any thoughts?

I don't mind dropping backwards compatibility. The build machine is an
old Mac Mini with 10.11.4, so 10.9 sounds OK. If someone needs to run
anything earlier I can compiling two versions for the releases too as
long as it's easily configurable.

Regards,
--
Peter Bortas
Loading...