From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: border1.nntp.ams.giganews.com!nntp.giganews.com!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: GCC 4.8.1 for Mac OS X Date: Sun, 21 Jul 2013 12:55:05 +0100 Organization: A noiseless patient Spider Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx05.eternal-september.org; posting-host="d88aa8a0fafe4f7fb3eb325f8f3d97d0"; logging-data="12771"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19D9KFc4yI90lHe1+KxhQ1XBuu7pkC6L0Y=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (darwin) Cancel-Lock: sha1:FzodXElvHcok4gS3QcYn5KGMA1g= sha1:52TlPzvpEAX7rHycOI+Q5smdDZc= Xref: number.nntp.dca.giganews.com comp.lang.ada:182613 Date: 2013-07-21T12:55:05+01:00 List-Id: Michael Rohan writes: > Not sure if this is simply a setup issue on my MacBook (this is the first Mac > system I've worked on) but when I try to build an application I run > into a linker issue: > > $ make > gnatmake -p -XOS=unix -XTYPE=static -XBUILD=Debug -aP../../lib/gnat > -aP../../src -P zbmcompile > gnatbind -x /Users/mrohan/zb/zanyblue/src/obj/zbmcompile-main.ali > gnatlink /Users/mrohan/zb/zanyblue/src/obj/zbmcompile-main.ali -g > /Users/mrohan/zb/zanyblue/lib/zanyblue/libzanyblue.a > -Wl,-rpath,/opt/gcc-4.8.1/lib/gcc/x86_64-apple-darwin12/4.8.1/adalib/ > -o /Users/mrohan/zb/zanyblue/bin/zbmcompile > ld: unknown option: -R > collect2: error: ld returned 1 exit status > gnatlink: error when calling /opt/gcc-4.8.1/bin/gcc > gnatmake: *** link failed. > make: *** [all] Error 4 > > I assume I need GNU ld, it seems I don't currently have it: > > $ ld -v > @(#)PROGRAM:ld PROJECT:ld64-136 > configured to support archs: armv6 armv7 armv7s i386 x86_64 > LTO support using: LLVM version 3.2svn, from Apple Clang 4.2 (build 425.0.28) > > Apologies if this is a basic question. Not at all! I tried your gnatmake command above with zanyblue-1.1.0b (after having run make from src/), first with -largs -Wl,-v to show the actual command passed to ld (which showd the -R) and then with -largs -v to give a full report of the gnatlink command; which gave, near the end, ...-Wl,-R,$ORIGIN/../lib... so I grepped for ORIGIN from src/, which gave (along with some files in src/obj/) ./mkfile/conf.mk:# ld.so runtime path "$ORIGIN/../lib", i.e., load shared libraries from ./os/unix/zanyblue-os-ld_run_path.ads: pragma Linker_Options ("-Wl,-R,$ORIGIN/../lib"); Just looking at the last, it says package ZanyBlue.OS.Ld_Run_Path is pragma Warnings (Off, ZanyBlue.OS.Ld_Run_Path); pragma Linker_Options ("-Wl,-R,$ORIGIN/../lib"); -- Embed the ls.do runtime shared library path "../lib" relative to the -- executable. end ZanyBlue.OS.Ld_Run_Path; (I think that comment should say ld.so, not ls.do!) -- and the thing is, that's not how you embed .dylib runtime paths in the executable on Mac OS X. (a) build your .dylibs using gprbuild, not gnatmake, because gnatmake doesn't know how to embed runtime paths in .dylibs; (b) install your .dylibs to the proper place; (c) link against them. (I should say, I can't give you the full reasoning behind this, but it works!)