* Gprbuild - Setting the earliest version of MacOS X that an executable will run on.
@ 2017-03-26 15:10 ahlan.marriott
2017-03-26 18:01 ` Simon Wright
0 siblings, 1 reply; 5+ messages in thread
From: ahlan.marriott @ 2017-03-26 15:10 UTC (permalink / raw)
My OSX application built using GNAT GPL 2015 runs just fine if started from finder or from a terminal but not when part of a bundle. When started from a bundle, irrespective of the setting of LSMinimumSystemVersion in Info.plist, Sierra complains "You have macOS 10.12.3. The application requires macOS 10.12.4 or later"
Googling (as one does) I found http://stackoverflow.com/a/25362535 that suggests that you should call the GCC with the switch --macosx-version-min to explicitly set the minimum version within the executable.
If not explicitly defined, the GCC will use the value of the environment variable MACOSX_DEPLOYMENT_TARGET.
It is unclear what value will be used if neither is set.
Has anyone else come across this problem?
I assume I could solve the problem by passing the --macosx-version-min switch to GCC - if I knew how.
Can anyone tell me how I should alter my GprBuild .gpr file to do this?
Would this be a Builder switch or a Linker switch or a Compiler switch that is passed to the linker?
Best wishes,
Ahlan
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Gprbuild - Setting the earliest version of MacOS X that an executable will run on.
2017-03-26 15:10 Gprbuild - Setting the earliest version of MacOS X that an executable will run on ahlan.marriott
@ 2017-03-26 18:01 ` Simon Wright
2017-03-26 21:03 ` Simon Wright
0 siblings, 1 reply; 5+ messages in thread
From: Simon Wright @ 2017-03-26 18:01 UTC (permalink / raw)
Looking at a .ali file compiled with GCC 6.1.0 on macOS Sierra 10.12.3,
I see in the list of switches near the beginning
A -mmacosx-version-min=10.12.4
You can also see it by compiling with -v (gprbuild -cargs -v).
Also with GCC 5.2.0.
Also with GNAT GPL 2016.
Also with a C source file.
Also with GCC 7.0.1 20170302.
Also while linking (a C source) - but then the flag is just
-macosx_version_min 10.12.4
I guess you'd include the right version in your GPR Compiler package (a
quick check using "-cargs -v -mmacosx-version-min=10.12.3" indicates it
should work).
If you use apple's gcc to build a C executable, it uses
-macosx_version_min 10.12.0
but only at the link stage; so perhaps you could get away with
introducing the switch in your GPR Linker package.
Or maybe both.
Looks like a GCC bug to me; nothing in Bugzilla.
On the other hand, if I try on El Capitan (GNAT GPL 2016 only) *I get
the right value*!!!!! (10.11.6, actually).
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Gprbuild - Setting the earliest version of MacOS X that an executable will run on.
2017-03-26 18:01 ` Simon Wright
@ 2017-03-26 21:03 ` Simon Wright
2017-03-27 6:58 ` ahlan.marriott
0 siblings, 1 reply; 5+ messages in thread
From: Simon Wright @ 2017-03-26 21:03 UTC (permalink / raw)
Simon Wright <simon@pushface.org> writes:
> Looks like a GCC bug to me; nothing in Bugzilla.
There is now! https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80204
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Gprbuild - Setting the earliest version of MacOS X that an executable will run on.
2017-03-26 21:03 ` Simon Wright
@ 2017-03-27 6:58 ` ahlan.marriott
2017-03-27 7:26 ` Simon Wright
0 siblings, 1 reply; 5+ messages in thread
From: ahlan.marriott @ 2017-03-27 6:58 UTC (permalink / raw)
On Sunday, 26 March 2017 23:02:54 UTC+2, Simon Wright wrote:
> Simon Wright <simon@pushface.org> writes:
>
> > Looks like a GCC bug to me; nothing in Bugzilla.
>
> There is now! https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80204
Dear Simon,
Thanks for the investigation and Bugzilla report.
However I don't understand you proposed workaround to the linker.
"-Wl,-macosx_version_min,'sw_vers -productVersion'"
When I try this Gnat says
-macosx_version_min value malformed: 'sw_vers -productVersion'
if I use
"-Wl,-macosx_version_min,10.12.3"
All is well - at least for Sierra.
Was sw_vers -productVersion san attempt to get the minimum version automatically or did I misunderstand this?
Or did I mistype?
MfG
Ahlan
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Gprbuild - Setting the earliest version of MacOS X that an executable will run on.
2017-03-27 6:58 ` ahlan.marriott
@ 2017-03-27 7:26 ` Simon Wright
0 siblings, 0 replies; 5+ messages in thread
From: Simon Wright @ 2017-03-27 7:26 UTC (permalink / raw)
ahlan.marriott@gmail.com writes:
> However I don't understand you proposed workaround to the linker.
> "-Wl,-macosx_version_min,'sw_vers -productVersion'"
> When I try this Gnat says
> -macosx_version_min value malformed: 'sw_vers -productVersion'
Those were *backticks*, and the workround would need to be applied on
the command line (since gprbuild can't execute arbitrary shell commands
internally).
If you say
gprbuild -P foo -largs -Wl,-macosx_version_min,`sw_vers -productVersion`
under a Unix-type sh-like shell (e.g. bash), the shell will execute the
part in backticks and substitute the result (in this case, 10.12.3) in
the command line actually passed to gprbuild.
I suppose you could set up an environment variable
export OS_VER=`sw_vers -productVersion`
and use 'case' magic inside your GPR.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-03-27 7:26 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-26 15:10 Gprbuild - Setting the earliest version of MacOS X that an executable will run on ahlan.marriott
2017-03-26 18:01 ` Simon Wright
2017-03-26 21:03 ` Simon Wright
2017-03-27 6:58 ` ahlan.marriott
2017-03-27 7:26 ` Simon Wright
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox