Subject: | ld: warning: object file (test.o) was built for newer OSX version (10.13) than being linked (10.5) |
Date: | Fri, 31 Aug 2018 16:05:44 -0500 |
To: | bug-ExtUtils-MakeMaker [...] rt.cpan.org |
From: | Jeff Holt <jeff.holt [...] method-r.com> |
SUMMARY
It looks like ExtUtils::MakeMaker version 7.34 is not completely
interrogating the perl Config to determine all of the proper options to add
to gcc.
The resulting default make is building for the current OS version. Instead,
what it should be doing, when the compiler has the feature that allows it
to build for a particular version of the OS, then it should abide according
to how the perl was configured. In my case, my perl was compiled for macOS
10.5 compatibility.
I should be able to distribute a module built for this perl on any macOS
system that is 10.5 or newer and with which the perl can be installed.
If I were to bundle my built module with the perl and give it to someone on
10.9, then they could (will?) have a problem.
Specifically, what should be happening is that the following option should
be given to all the gcc commands executed in the make:
-mmacosx-version-min=10.5'
but the ld command is the only command that gets that option.
DETAILS
Below is the output of the following script, with some whitespace added
between command executions.
perl -MExtUtils::MakeMaker -e 'print $ExtUtils::MakeMaker::VERSION';
cat Makefile.PL
cat test.xs
perl Makefile.PL
make
perl -v
uname -a
gcc --version
perl -V
$ perl -MExtUtils::MakeMaker -e 'print $ExtUtils::MakeMaker::VERSION';
7.34
$ cat Makefile.PL
use ExtUtils::MakeMaker;
WriteMakefile(NAME=>'test', VERSION=>'0.15');
$ cat test.xs
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
MODULE = test PACKAGE = test
void
testf()
PROTOTYPE: DISABLE
PREINIT:
int something = 0;
CODE:
something = 1;
$ perl Makefile.PL
Generating a Unix-style Makefile
Writing Makefile for test
Writing MYMETA.yml and MYMETA.json
$ make
Running Mkbootstrap for test ()
chmod 644 "test.bs"
"/usr/local/ActivePerl-5.20/bin/perl-dynamic" -MExtUtils::Command::MM -e
'cp_nonempty' -- test.bs blib/arch/auto/test/test.bs 644
"/usr/local/ActivePerl-5.20/bin/perl-dynamic"
"/usr/local/ActivePerl-5.20/lib/ExtUtils/xsubpp" -typemap
'/usr/local/ActivePerl-5.20/lib/ExtUtils/typemap' test.xs > test.xsc
mv test.xsc test.c
/Applications/Xcode.app/Contents/Developer/usr/bin/gcc -c -fno-common
-DPERL_DARWIN -no-cpp-precomp -arch x86_64 -DUSE_SITECUSTOMIZE
-DPERL_RELOCATABLE_INCPUSH -fno-strict-aliasing -pipe -fstack-protector
-O3 -DVERSION=\"0.15\" -DXS_VERSION=\"0.15\"
"-I/usr/local/ActivePerl-5.20/lib/CORE" test.c
In file included from test.xs:2:
In file included from /usr/local/ActivePerl-5.20/lib/CORE/perl.h:5199:
/usr/local/ActivePerl-5.20/lib/CORE/inline.h:311:9: warning: nonnull
parameter 'pv' will evaluate to 'true' on first encounter
[-Wpointer-bool-conversion]
if (pv && len > 1) {
^~ ~~
/usr/local/ActivePerl-5.20/lib/CORE/proto.h:1792:4: note: declared
'nonnull' here
__attribute__nonnull__(pTHX_1)
^
/usr/local/ActivePerl-5.20/lib/CORE/perl.h:3100:60: note: expanded from
macro '__attribute__nonnull__'
# define __attribute__nonnull__(a) __attribute__((nonnull(a)))
^
1 warning generated.
rm -f blib/arch/auto/test/test.bundle
gcc -mmacosx-version-min=10.5 -bundle -undefined dynamic_lookup
-Wl,-search_paths_first -arch x86_64 -fstack-protector test.o -o
blib/arch/auto/test/test.bundle \
\
ld: warning: object file (test.o) was built for newer OSX version (10.13)
than being linked (10.5)
chmod 755 blib/arch/auto/test/test.bundle
$ perl -v
This is perl 5, version 20, subversion 2 (v5.20.2) built for
darwin-thread-multi-2level
(with 1 registered patch, see perl -V for more detail)
Copyright 1987-2015, Larry Wall
Binary build 2001 [298913] provided by ActiveState
http://www.ActiveState.com
Built Mar 19 2015 15:36:06
Perl may be copied only under the terms of either the Artistic License or
the
GNU General Public License, which may be found in the Perl 5 source kit.
Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl". If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.
$ uname -a
Darwin MacBook-Pro 17.7.0 Darwin Kernel Version 17.7.0: Fri Jul 6 19:54:51
PDT 2018; root:xnu-4570.71.3~2/RELEASE_X86_64 x86_64
$ gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr
--with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 9.1.0 (clang-902.0.39.2)
Target: x86_64-apple-darwin17.7.0
Thread model: posix
InstalledDir:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
$ perl -V
Summary of my perl5 (revision 5 version 20 subversion 2) configuration:
Platform:
osname=darwin, osvers=10.8.0, archname=darwin-thread-multi-2level
uname='darwin neko 10.8.0 darwin kernel version 10.8.0: tue jun 7
16:33:36 pdt 2011; root:xnu-1504.15.3~1release_i386 i386 '
config_args='-ders -Dcc=gcc -Dusethreads -Duseithreads
-Uinstallusrbinperl -Ulocincpth= -Uloclibpth= -Duse64bitint -Ud_poll
-Ui_poll -Ui_libutil -Aldflags=-Wl,-search_paths_first
-Alddlflags=-Wl,-search_paths_first -Accflags=-arch x86_64 -Aldflags=-arch
x86_64 -Alddlflags=-arch x86_64 -Accflags=-DUSE_SITECUSTOMIZE
-Duselargefiles -Accflags=-DPERL_RELOCATABLE_INCPUSH
-Accflags=-fno-merge-constants -Dprefix=/usr/local/ActivePerl-5.20
-Dprivlib=/usr/local/ActivePerl-5.20/lib
-Darchlib=/usr/local/ActivePerl-5.20/lib
-Dsiteprefix=/usr/local/ActivePerl-5.20/site
-Dsitelib=/usr/local/ActivePerl-5.20/site/lib
-Dsitearch=/usr/local/ActivePerl-5.20/site/lib -Dsed=/usr/bin/sed
-Duseshrplib -Dcf_by=ActiveState -Dcf_email=support@ActiveState.com'
hint=recommended, useposix=true, d_sigaction=define
useithreads=define, usemultiplicity=define
use64bitint=define, use64bitall=define, uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='/Applications/Xcode.app/Contents/Developer/usr/bin/gcc', ccflags
='-fno-common -DPERL_DARWIN -no-cpp-precomp -arch x86_64
-DUSE_SITECUSTOMIZE -DPERL_RELOCATABLE_INCPUSH -fno-strict-aliasing -pipe
-fstack-protector',
optimize='-O3',
cppflags='-no-cpp-precomp -fno-common -DPERL_DARWIN -no-cpp-precomp
-arch x86_64 -DUSE_SITECUSTOMIZE -DPERL_RELOCATABLE_INCPUSH
-fno-merge-constants -fno-strict-aliasing -pipe -fstack-protector'
ccversion='', gccversion='Apple LLVM version 9.1.0 (clang-902.0.39.2)',
gccosandvers=''
intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=8
alignbytes=8, prototype=define
Linker and Libraries:
ld='gcc -mmacosx-version-min=10.5', ldflags =' -Wl,-search_paths_first
-arch x86_64 -fstack-protector'
libpth=/usr/lib
libs=-ldbm -ldl -lm -lutil -lc
perllibs=-ldl -lm -lutil -lc
libc=, so=dylib, useshrplib=true, libperl=libperl.dylib
gnulibc_version=''
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' '
cccdlflags=' ', lddlflags=' -bundle -undefined dynamic_lookup
-Wl,-search_paths_first -arch x86_64 -fstack-protector'
Characteristics of this binary (from libperl):
Compile-time options: HAS_TIMES MULTIPLICITY PERLIO_LAYERS
PERL_DONT_CREATE_GVSV
PERL_HASH_FUNC_ONE_AT_A_TIME_HARD
PERL_IMPLICIT_CONTEXT PERL_MALLOC_WRAP
PERL_NEW_COPY_ON_WRITE PERL_PRESERVE_IVUV
PERL_RELOCATABLE_INCPUSH USE_64_BIT_ALL
USE_64_BIT_INT USE_ITHREADS USE_LARGE_FILES
USE_LOCALE USE_LOCALE_COLLATE USE_LOCALE_CTYPE
USE_LOCALE_NUMERIC USE_PERLIO USE_PERL_ATOF
USE_REENTRANT_API USE_SITECUSTOMIZE
Locally applied patches:
ActivePerl Build 2001 [298913]
Built under darwin
Compiled at Mar 19 2015 15:36:06
%ENV:
PERL5LIB="/Users/jholt/Source/mrprof/src/perlmods:/Users/jholt/Source/mrprof/src"
PERL_HOME="/usr/local/ActivePerl-5.20"
@INC:
/Users/jholt/Source/mrprof/src/perlmods
/Users/jholt/Source/mrprof/src
/Users/jholt/Library/ActivePerl-5.20/lib
/usr/local/ActivePerl-5.20/site/lib
/usr/local/ActivePerl-5.20/lib
.
Message body is not shown because it is too large.