* Defining the invocation of a shell command in a gpr project file
@ 2014-02-12 14:10 David Pereira
2014-02-12 20:30 ` Simon Wright
0 siblings, 1 reply; 5+ messages in thread
From: David Pereira @ 2014-02-12 14:10 UTC (permalink / raw)
Hi all,
I believe this is a naive question, but still I was not able to find the answer by the google method :-)
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.
Thanks in advance.
Cheers,
David
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Defining the invocation of a shell command in a gpr project file
2014-02-12 14:10 Defining the invocation of a shell command in a gpr project file David Pereira
@ 2014-02-12 20:30 ` Simon Wright
2014-02-13 12:47 ` David Pereira
2014-02-14 17:46 ` Simon Wright
0 siblings, 2 replies; 5+ messages in thread
From: Simon Wright @ 2014-02-12 20:30 UTC (permalink / raw)
David Pereira <dmrpereira@gmail.com> writes:
> I believe this is a naive question, but still I was not able to find
> the answer by the google method :-)
This aspect of Mac OS X is one of its black mysteries ..
> 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;
[1]
https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/dyld.1.html
[2] http://stackoverflow.com/a/21348716/40851
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Defining the invocation of a shell command in a gpr project file
2014-02-12 20:30 ` Simon Wright
@ 2014-02-13 12:47 ` David Pereira
2014-02-14 17:46 ` Simon Wright
1 sibling, 0 replies; 5+ messages in thread
From: David Pereira @ 2014-02-13 12:47 UTC (permalink / raw)
Hi Simon,
Unfortunately it does not work. I have tried it already before posting here (maybe I should have mentioned it), and thus the reason to try to understand if there is some GPR black-magic that allows me to explicitly call the install_name_tool from a gpr file.
Thanks anyways for the information you provided.
Cheers,
David
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Defining the invocation of a shell command in a gpr project file
2014-02-12 20:30 ` Simon Wright
2014-02-13 12:47 ` David Pereira
@ 2014-02-14 17:46 ` Simon Wright
2014-03-06 14:03 ` David Pereira
1 sibling, 1 reply; 5+ messages in thread
From: Simon Wright @ 2014-02-14 17:46 UTC (permalink / raw)
Simon Wright <simon@pushface.org> writes:
> David Pereira <dmrpereira@gmail.com> 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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Defining the invocation of a shell command in a gpr project file
2014-02-14 17:46 ` Simon Wright
@ 2014-03-06 14:03 ` David Pereira
0 siblings, 0 replies; 5+ messages in thread
From: David Pereira @ 2014-03-06 14:03 UTC (permalink / raw)
Great post man! :-)
Thanks a lot!
Cheers,
David
Sexta-feira, 14 de Fevereiro de 2014 17:46:41 UTC, Simon Wright escreveu:
> Simon Wright <simon@pushface.org> writes:
>
>
>
> > David Pereira <dmrpereira@gmail.com> 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
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-03-06 14:03 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-12 14:10 Defining the invocation of a shell command in a gpr project file David Pereira
2014-02-12 20:30 ` Simon Wright
2014-02-13 12:47 ` David Pereira
2014-02-14 17:46 ` Simon Wright
2014-03-06 14:03 ` David Pereira
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox