Building druntime on MAC OS X

Andrew Edwards ridimz at yahoo.com
Sat Nov 16 07:39:02 PST 2013


On 11/16/13, 4:57 AM, Jacob Carlborg wrote:
> On 2013-11-16 04:19, Andrew Edwards wrote:
>> I am having little problem building druntime on Mac OS X 10.9
>> (Mavericks) and am wondering if anyone has experienced with this and
>> some guidance on how to fix it.
>>
>> Here is my command:
>> make -f posix.mak install DMD=../install/bin/dmd
>>
>> And here is the resulting error:
>> ../install/bin/dmd -ofgenerated/osx/default/rdmd rdmd.d
>> ld: unknown option: --export-dynamic
>> clang: error: linker command failed with exit code 1 (use -v to see
>> invocation)
>> --- errorlevel 1
>> make: *** [generated/osx/default/rdmd] Error 1
>
> --export-dynamic doesn't come from the makefile but most likely from
> dmd.conf. It's used on Linux and FreeBSD but not on Mac OS X, please
> remove it.
>
> BTW where did you get the dmd.conf file from?
>

You nailed it. It is in the dmd.conf file. Its content is this:

      [Environment]
      DFLAGS=-L--export-dynamic -I%@P%/../import -L-L%@P%/../lib -L-lrt

It is generated automatically from src/dmd.conf.default while building 
dmd as such:

      make -f posix.mak install

Here is the explanation from man ld of the Mac OS X equivalent:

    -export_dynamic
            Preserves all global symbols in main executables during LTO.
            Without this option, Link Time Optimization is allowed to
            inline and remove global functions. This option is used when
            a main executable may load a plug-in which requires certain
            symbols from the main executable.

Not sure what -lrt is thought. It is not defined in the man pages, does 
not affect building of the libraries (druntime or phobos) but bombs out 
while building the tools.

Regards,

--------------------
http://www.akeron.co
auto getAddress() {
     string location = "@", period = ".";
     return ("info" ~ location ~ "afidem" ~ period ~ "org");
}


More information about the Digitalmars-d mailing list