Jump to page: 1 2 3
Thread overview
Building druntime on MAC OS X
Nov 16, 2013
Andrew Edwards
Nov 16, 2013
evilrat
Nov 16, 2013
Joakim
Nov 16, 2013
Andrew Edwards
Nov 16, 2013
deadalnix
Nov 16, 2013
Orvid King
Nov 16, 2013
Joakim
Nov 16, 2013
Nathan M. Swan
Nov 16, 2013
Andrew Edwards
Nov 16, 2013
Jacob Carlborg
Nov 16, 2013
Andrew Edwards
Nov 16, 2013
Jacob Carlborg
Nov 16, 2013
Martin Nowak
Nov 16, 2013
Andrew Edwards
Nov 17, 2013
Jacob Carlborg
Nov 17, 2013
Andrew Edwards
Nov 18, 2013
Jacob Carlborg
Nov 21, 2013
Andrew Edwards
Nov 21, 2013
Andrew Edwards
Nov 21, 2013
Jacob Carlborg
Nov 21, 2013
Andrew Edwards
Nov 21, 2013
Jacob Carlborg
Nov 21, 2013
Joshua Niehus
Nov 21, 2013
Jacob Carlborg
Nov 23, 2013
Andrew Edwards
Nov 23, 2013
Jacob Carlborg
Nov 23, 2013
Jacob Carlborg
November 16, 2013
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


--
Regards
--------------------
http://www.akeron.co
auto getAddress() {
    string location = "@", period = ".";
    return ("info" ~ location ~ "afidem" ~ period ~ "org");
}
November 16, 2013
On Saturday, 16 November 2013 at 03:20:03 UTC, 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
>

i think this is related to hidden replace of gcc with clang. personally i don't do much c++ on osx, but people suggests use "-export-dynamic"(note single minus). hope it helps.
November 16, 2013
On 11/15/13 6:19 PM, 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
>
>
> --
> Regards
> --------------------
> http://www.akeron.co
> auto getAddress() {
>      string location = "@", period = ".";
>      return ("info" ~ location ~ "afidem" ~ period ~ "org");
> }

Have you tried using this?

https://github.com/carlor/dlang-workspace

Sorry for the shameless plug.

NMS
November 16, 2013
On Saturday, 16 November 2013 at 03:50:25 UTC, evilrat wrote:
> On Saturday, 16 November 2013 at 03:20:03 UTC, 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
>>
>
> i think this is related to hidden replace of gcc with clang. personally i don't do much c++ on osx, but people suggests use "-export-dynamic"(note single minus). hope it helps.

The recent switch to clang on 10.9 as the reason seemed to make sense, as I've run into a similar issue with clang before.  But after googling a little bit and looking at the error, maybe the problem is a new linker in OS X 10.9?  Assuming we've always been passing --export-dynamic to the linker, I don't see why it would start failing now, unless the GNU ld from binutils has been swapped out.

I suggest you look at where this --export-dynamic flag is being added in the build scripts and try changing the number of dashes or removing the flag, after looking at the docs for the OS X linker to see what flags it takes.
November 16, 2013
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?

-- 
/Jacob Carlborg
November 16, 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");
}
November 16, 2013
On 11/16/13, 1:47 AM, Joakim wrote:
> I suggest you look at where this --export-dynamic flag is being added in
> the build scripts and try changing the number of dashes or removing the
> flag, after looking at the docs for the OS X linker to see what flags it
> takes.

The correct flag is -export_dynamic. Thanks for the suggestion.
November 16, 2013
On 11/15/13, 11:14 PM, Nathan M. Swan wrote:
> Have you tried using this?
>
> https://github.com/carlor/dlang-workspace
>
> Sorry for the shameless plug.
>
> NMS

I have not.
November 16, 2013
On 2013-11-16 16:39, Andrew Edwards wrote:

> 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

I see. I have never used "install" for DMD before. dmd.conf shipping in the zip does not have -L--export-dynamic.

> 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.

It's liking with the "rt" library. That is, librt.dylib or librt.a. This is neither used on Mac OS X. I'm guessing "make -f posix.mak install" will generate a dmd.conf file for Linux.

-- 
/Jacob Carlborg
November 16, 2013
On 11/16/2013 04:39 PM, Andrew Edwards wrote:
> It is generated automatically from src/dmd.conf.default while building
> dmd as such:
>
>       make -f posix.mak install
>
The install target is work in progress. We want to use this to build releases, but it's not ready yet.

> 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.
This is currently used for backtrace support.
>
> 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.

The -lrt links in the Realtime Extensions library (librt) which is needed for some functions used by druntime (sched_*, sem_*).
« First   ‹ Prev
1 2 3