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: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: Defining the invocation of a shell command in a gpr project file Date: Fri, 14 Feb 2014 17:46:41 +0000 Organization: A noiseless patient Spider Message-ID: References: <783ad521-d54a-4c28-8c76-9afb84f4a396@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx05.eternal-september.org; posting-host="f3a204fd0da52c1307d65ca023946f38"; logging-data="6631"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19RFCl1KJQIBcRRHby0vLfuC6RRofAraWA=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (darwin) Cancel-Lock: sha1:+Q+g/bb8Gqe8tf7Nmc1wManZzvI= sha1:RvMi07b+LuU9iVKOrghvPTnJBC4= Xref: news.eternal-september.org comp.lang.ada:18564 Date: 2014-02-14T17:46:41+00:00 List-Id: Simon Wright writes: > David Pereira writes: >> So, my question is this: is it possible to invoke a shell command when >> using gnatmake or gprbuild? I am implementing a binding to C library >> and, since I am in Mac Os, I have to call the command >> install_name_tool to change the path point to where the library I am >> using is available, after the binary is compiled and linked. > > I think you can get away with using -rpath; see the last few paras of > the dyld(1) man page, online at [1], as pointed out to me in a comment > on [2]. > > You could try > > package Linker is > for Linker_Options use > ("-L/path/to/c/lib", > "-lclib", > "-rpath", > "/path/to/c/lib"); > end Linker; Turns out there's more to it than that. I've written up my investigations at [1]; the key was that the C dylib needs to have an @rpath in its name too. Well, it works for me. Hope it helps you. [1] http://forward-in-code.blogspot.co.uk/2014/02/c-libraries-and-runpath.html