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 X-Received: by 10.224.86.200 with SMTP id t8mr34303923qal.0.1374429717073; Sun, 21 Jul 2013 11:01:57 -0700 (PDT) X-Received: by 10.50.18.40 with SMTP id t8mr2184642igd.3.1374429717025; Sun, 21 Jul 2013 11:01:57 -0700 (PDT) Path: border1.nntp.dca3.giganews.com!border2.nntp.dca3.giganews.com!border4.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!f1no313681qae.0!news-out.google.com!dk8ni1022qab.0!nntp.google.com!f1no313674qae.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sun, 21 Jul 2013 11:01:56 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=108.68.98.119; posting-account=1YPeQwoAAACAk-xhKPD32B0GIDdsFFtk NNTP-Posting-Host: 108.68.98.119 References: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <052a4796-d6ce-4765-9c44-22e0ae559d77@googlegroups.com> Subject: Re: GCC 4.8.1 for Mac OS X From: Michael Rohan Injection-Date: Sun, 21 Jul 2013 18:01:57 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Original-Bytes: 5065 Xref: number.nntp.dca.giganews.com comp.lang.ada:182614 Date: 2013-07-21T11:01:56-07:00 List-Id: On Sunday, July 21, 2013 4:55:05 AM UTC-7, Simon Wright wrote: > Michael Rohan writes: >=20 >=20 >=20 > > Not sure if this is simply a setup issue on my MacBook (this is the fir= st Mac >=20 > > system I've worked on) but when I try to build an application I run >=20 > > into a linker issue: >=20 > > >=20 > > $ make >=20 > > gnatmake -p -XOS=3Dunix -XTYPE=3Dstatic -XBUILD=3DDebug -aP../../lib/gn= at >=20 > > -aP../../src -P zbmcompile >=20 > > gnatbind -x /Users/mrohan/zb/zanyblue/src/obj/zbmcompile-main.ali >=20 > > gnatlink /Users/mrohan/zb/zanyblue/src/obj/zbmcompile-main.ali -g >=20 > > /Users/mrohan/zb/zanyblue/lib/zanyblue/libzanyblue.a >=20 > > -Wl,-rpath,/opt/gcc-4.8.1/lib/gcc/x86_64-apple-darwin12/4.8.1/adalib/ >=20 > > -o /Users/mrohan/zb/zanyblue/bin/zbmcompile >=20 > > ld: unknown option: -R >=20 > > collect2: error: ld returned 1 exit status >=20 > > gnatlink: error when calling /opt/gcc-4.8.1/bin/gcc >=20 > > gnatmake: *** link failed. >=20 > > make: *** [all] Error 4 >=20 > > >=20 > > I assume I need GNU ld, it seems I don't currently have it: >=20 > > >=20 > > $ ld -v >=20 > > @(#)PROGRAM:ld PROJECT:ld64-136 >=20 > > configured to support archs: armv6 armv7 armv7s i386 x86_64 >=20 > > LTO support using: LLVM version 3.2svn, from Apple Clang 4.2 (build 425= .0.28) >=20 > > >=20 > > Apologies if this is a basic question. >=20 >=20 >=20 > Not at all! >=20 >=20 >=20 > I tried your gnatmake command above with zanyblue-1.1.0b (after having >=20 > run make from src/), first with -largs -Wl,-v to show the actual command >=20 > passed to ld (which showd the -R) and then with -largs -v to give a full >=20 > report of the gnatlink command; which gave, near the end, >=20 >=20 >=20 > ...-Wl,-R,$ORIGIN/../lib... >=20 >=20 >=20 > so I grepped for ORIGIN from src/, which gave (along with some files in >=20 > src/obj/) >=20 >=20 >=20 > ./mkfile/conf.mk:# ld.so runtime path "$ORIGIN/../lib", i.e., load shar= ed libraries from >=20 >=20 >=20 > ./os/unix/zanyblue-os-ld_run_path.ads: pragma Linker_Options ("-Wl,-R= ,$ORIGIN/../lib"); >=20 >=20 >=20 > Just looking at the last, it says >=20 >=20 >=20 > package ZanyBlue.OS.Ld_Run_Path is >=20 >=20 >=20 > pragma Warnings (Off, ZanyBlue.OS.Ld_Run_Path); >=20 > pragma Linker_Options ("-Wl,-R,$ORIGIN/../lib"); >=20 > -- Embed the ls.do runtime shared library path "../lib" relative t= o the >=20 > -- executable. >=20 >=20 >=20 > end ZanyBlue.OS.Ld_Run_Path; >=20 >=20 >=20 > (I think that comment should say ld.so, not ls.do!) -- and the thing is, >=20 > that's not how you embed .dylib runtime paths in the executable on Mac >=20 > OS X. >=20 >=20 >=20 > (a) build your .dylibs using gprbuild, not gnatmake, because gnatmake >=20 > doesn't know how to embed runtime paths in .dylibs; >=20 >=20 >=20 > (b) install your .dylibs to the proper place; >=20 >=20 >=20 > (c) link against them. >=20 >=20 >=20 > (I should say, I can't give you the full reasoning behind this, but it >=20 > works!) Hi, Awesome, it's my error. I can rework that area for Mac. Thanks for diggin= g into this. BTW, it's really neat that the GNAT are simply available with this distribu= tion: AUnit, XML Ada. Apart from my explicit step outside the language via my pragma Linker_Optio= ns, everything just built and passed my tests (850 + 1229) on a new platfor= m for me. I've worked in other languages and there's always something that= needs to be handled but as a random, isolated, data point, it does look go= od for Ada. Take care, and thank you, Michael.