gpt4 book ai didi

perl - 为 OS X 构建 Perl - 架构特定的编译选项

转载 作者:行者123 更新时间:2023-12-04 14:42:58 25 4
gpt4 key购买 nike

感谢 Chas. Owens 的建议, 我玩得很开心Perlbrew在我的主目录中有各种 Perl 版本。然而,我的问题更普遍地是关于在 OS X 下构建更新的 Perl。

我在最近的 MacBook Pro 上运行 OS X 10.6.4 Snow Leopard。经过small diversion在 Snow Leopard 下正确设置 gcc,我已经使用默认选项在我的主目录中构建并运行了 Perl 5.12.1。它通过了 Perl 测试工具。

Perlbrew 允许使用特定于操作系统和平台的标志来构建 Perl。这些是 Perl 配置脚本的 -D -U -A 选项。 perlmacosx自述文件已 4 年未更新,因此不再有用。

我很想模仿 Apple 在系统 Perl v 5.10.0 中使用的开关(您可以通过键入 [path_to_specific_perl]/perl -V 来查看您的特定 Perl/usr/bin/perl 在大多数情况下用于系统......)除了 -Dprefix=/usr 对于新的 Perl 构建的不同根目录会有所不同,还有什么我应该使用吗?

(目测)以下是 Apple 编译选项和默认选项之间的主要区别:

config_args:
Apple: -ds -e
Default: -de

-D: =======================
Apple: useithreads=define, usemultiplicity=define
Default: useithreads=undef, usemultiplicity=undef

Compiler: =================
Apple: optimize='-Os'
Default: optimize='-O3'

Apple: -arch x86_64 -arch i386 -arch ppc
Default: none specified

Apple: -g -pipe
Default these optimizations are not set

Apple not set
Default -no-cpp-precomp

Linker: ================
Apple: useshrplib=true, libperl=libperl.dylib
Default: useshrplib=false, libperl=libperl.a

Characteristics of libperl: =============
Apple MULTIPLICITY PERL_IMPLICIT_CONTEXT USE_ITHREADS USE_REENTRANT_API
Default PERL_MALLOC_WRAP USE_PERL_ATOF

另一个区别是 Apple Perl libperl 是一个动态加载器,默认构建是静态链接的。

所以,问题:

  1. 我应该使用哪个 -D -U -A 开关在 OS X 10.6+ 上构建 Perl 的本地副本?我不认为我需要像 Apple 版本那样的胖二进制文件,而且我不知道我是否应该做一个 dynaloader 版本。主要是我在寻找建议的优化开关和生成的 libperl 的建议特征。
  2. 我应该做一个 dynaloader 版本吗? (即,在 OS X 意义上的 Dynamic Libraries ...)
  3. Perl 系统是/usr/bin/perl,我不想更改它。我是否将脚本中的 sheebang 更改为指向 Perl 的 Perlbrew 版本?这意味着我的 sheebang 将是“/Users/andrew/perl5/perl”。我要改变我的路径指向那里吗?其他人在这方面做了什么?什么是“最佳实践”?
  4. 当我运行 Perlbrew 时,我收到警告 v-string in use/require non-portable at ./perlbrew line 818。 Perlbrew 中的第 818 行是 use 5.8.0; 该行不应该是 use 5.008_000 吗?

编辑

感谢 Jonathan Leffler,我至少有一些 Perls 可以看。我没有深入研究它,而是在大多数情况下采用默认设置,添加线程,它似乎工作正常。现在我已经安装了 Perlbrew 和几个 Perl,并且我将系统 Perl 保留在 5.10。我在 sheebang 上使用 /usr/bin/env perl 来获得面向 future 的代码。

最佳答案

我能提供的最好的是“perl -V”的输出,用于我的每个 5.1x 版本 Perl 的自制程序集合 - 一些 32 位,一些 64 位。我省略了 PowerPC 构建(从我拥有 Intel Mac 之前的日子开始)。

drwxr-xr-x  8 jleffler  staff       272 Aug  1  2009 v5.10.0
drwxr-xr-x 8 jleffler staff 272 Nov 8 2009 v5.10.1
drwxr-xr-x 6 jleffler staff 204 Oct 26 2009 v5.10.1-64
drwxr-xr-x 6 jleffler staff 204 Jun 23 09:36 v5.12.1
drwxr-xr-x 5 jleffler staff 170 Jun 17 21:14 v5.12.1-32bit
drwxr-xr-x 5 jleffler staff 170 Aug 30 15:02 v5.13.4

我不使用线程或多重性进行构建。我确实使用动态加载进行构建;我使用 dlopen 版本 - 这是默认建议的。机器根据连接到网络的位置获得不同的名称;这显示在构建机器名称中。

5.10.0

Summary of my perl5 (revision 5 version 10 subversion 0) configuration:
Platform:
osname=darwin, osvers=9.7.0, archname=darwin-64int-2level
uname='darwin osiris.sanjose.ibm.com 9.7.0 darwin kernel version 9.7.0: tue mar 31 22:52:17 pdt 2009; root:xnu-1228.12.14~1release_i386 i386 '
config_args='-Duse64bitint'
hint=recommended, useposix=true, d_sigaction=define
useithreads=undef, usemultiplicity=undef
useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
use64bitint=define, use64bitall=undef, uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='cc', ccflags ='-fno-common -DPERL_DARWIN -no-cpp-precomp -fno-strict-aliasing -pipe -I/usr/local/include -I/usr/gnu/include -I/usr/GNU/include',
optimize='-O3',
cppflags='-no-cpp-precomp -fno-common -DPERL_DARWIN -no-cpp-precomp -fno-strict-aliasing -pipe -I/usr/local/include -I/usr/gnu/include -I/usr/GNU/include'
ccversion='', gccversion='4.0.1 (Apple Inc. build 5493)', gccosandvers=''
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=12345678
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
ivtype='long long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
alignbytes=8, prototype=define
Linker and Libraries:
ld='env MACOSX_DEPLOYMENT_TARGET=10.3 cc', ldflags =' -L/usr/local/lib -L/usr/gnu/lib -L/usr/GNU/lib'
libpth=/usr/local/lib /usr/gnu/lib /usr/GNU/lib /usr/lib
libs=-ldbm -ldl -lm -lutil -lc
perllibs=-ldl -lm -lutil -lc
libc=/usr/lib/libc.dylib, so=dylib, useshrplib=false, libperl=libperl.a
gnulibc_version=''
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' '
cccdlflags=' ', lddlflags=' -bundle -undefined dynamic_lookup -L/usr/local/lib -L/usr/gnu/lib -L/usr/GNU/lib'


Characteristics of this binary (from libperl):
Compile-time options: PERL_DONT_CREATE_GVSV PERL_MALLOC_WRAP USE_64_BIT_INT
USE_LARGE_FILES USE_PERLIO
Built under darwin
Compiled at Jul 14 2009 10:09:56
@INC:
/Users/jleffler/perl/v5.10.0/lib/5.10.0/darwin-64int-2level
/Users/jleffler/perl/v5.10.0/lib/5.10.0
/Users/jleffler/perl/v5.10.0/lib/site_perl/5.10.0/darwin-64int-2level
/Users/jleffler/perl/v5.10.0/lib/site_perl/5.10.0
.

5.10.1(32 位)

Summary of my perl5 (revision 5 version 10 subversion 1) configuration:

Platform:
osname=darwin, osvers=9.8.0, archname=darwin-2level
uname='darwin osiris.local 9.8.0 darwin kernel version 9.8.0: wed jul 15 16:55:01 pdt 2009; root:xnu-1228.15.4~1release_i386 i386 '
config_args=''
hint=recommended, useposix=true, d_sigaction=define
useithreads=undef, usemultiplicity=undef
useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
use64bitint=undef, use64bitall=undef, uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='cc -m32', ccflags ='-fno-common -DPERL_DARWIN -no-cpp-precomp -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -I/usr/gnu/include',
optimize='-O3',
cppflags='-no-cpp-precomp -fno-common -DPERL_DARWIN -no-cpp-precomp -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -I/usr/gnu/include'
ccversion='', gccversion='4.0.1 (Apple Inc. build 5493)', gccosandvers=''
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
alignbytes=8, prototype=define
Linker and Libraries:
ld='env MACOSX_DEPLOYMENT_TARGET=10.3 cc -m32', ldflags =' -fstack-protector -L/usr/local/lib -L/usr/gnu/lib'
libpth=/usr/local/lib /usr/gnu/lib /usr/lib
libs=-ldbm -ldl -lm -lutil -lc
perllibs=-ldl -lm -lutil -lc
libc=/usr/lib/libc.dylib, so=dylib, useshrplib=false, libperl=libperl.a
gnulibc_version=''
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' '
cccdlflags=' ', lddlflags=' -bundle -undefined dynamic_lookup -L/usr/local/lib -L/usr/gnu/lib -fstack-protector'


Characteristics of this binary (from libperl):
Compile-time options: PERL_DONT_CREATE_GVSV PERL_MALLOC_WRAP
USE_LARGE_FILES USE_PERLIO
Built under darwin
Compiled at Sep 3 2009 07:26:44
@INC:
/Users/jleffler/perl/v5.10.1/lib/5.10.1/darwin-2level
/Users/jleffler/perl/v5.10.1/lib/5.10.1
/Users/jleffler/perl/v5.10.1/lib/site_perl/5.10.1/darwin-2level
/Users/jleffler/perl/v5.10.1/lib/site_perl/5.10.1
.

5.10.1 64 位

Summary of my perl5 (revision 5 version 10 subversion 1) configuration:

Platform:
osname=darwin, osvers=9.8.0, archname=darwin-2level
uname='darwin osiris.sanjose.ibm.com 9.8.0 darwin kernel version 9.8.0: wed jul 15 16:55:01 pdt 2009; root:xnu-1228.15.4~1release_i386 i386 '
config_args=''
hint=recommended, useposix=true, d_sigaction=define
useithreads=undef, usemultiplicity=undef
useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
use64bitint=define, use64bitall=define, uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='cc -m64', ccflags ='-fno-common -DPERL_DARWIN -no-cpp-precomp -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -I/usr/gnu/include',
optimize='-O3',
cppflags='-no-cpp-precomp -fno-common -DPERL_DARWIN -no-cpp-precomp -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -I/usr/gnu/include'
ccversion='', gccversion='4.0.1 (Apple Inc. build 5493)', 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='env MACOSX_DEPLOYMENT_TARGET=10.3 cc -m64', ldflags =' -fstack-protector -L/usr/local/lib -L/usr/gnu/lib'
libpth=/usr/local/lib /usr/gnu/lib /usr/lib
libs=-ldbm -ldl -lm -lutil -lc
perllibs=-ldl -lm -lutil -lc
libc=/usr/lib/libc.dylib, so=dylib, useshrplib=false, libperl=libperl.a
gnulibc_version=''
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' '
cccdlflags=' ', lddlflags=' -bundle -undefined dynamic_lookup -L/usr/local/lib -L/usr/gnu/lib -fstack-protector'


Characteristics of this binary (from libperl):
Compile-time options: PERL_DONT_CREATE_GVSV PERL_MALLOC_WRAP USE_64_BIT_ALL
USE_64_BIT_INT USE_LARGE_FILES USE_PERLIO
Built under darwin
Compiled at Sep 3 2009 10:12:54
@INC:
/Users/jleffler/perl/v5.10.1-64/lib/5.10.1/darwin-2level
/Users/jleffler/perl/v5.10.1-64/lib/5.10.1
/Users/jleffler/perl/v5.10.1-64/lib/site_perl/5.10.1/darwin-2level
/Users/jleffler/perl/v5.10.1-64/lib/site_perl/5.10.1
.

5.12.1 64 位

Summary of my perl5 (revision 5 version 12 subversion 1) configuration:

Platform:
osname=darwin, osvers=10.3.0, archname=darwin-2level
uname='darwin dyn744040.sanjose.ibm.com 10.3.0 darwin kernel version 10.3.0: fri feb 26 11:58:09 pst 2010; root:xnu-1504.3.12~1release_i386 i386 '
config_args=''
hint=recommended, useposix=true, d_sigaction=define
useithreads=undef, usemultiplicity=undef
useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
use64bitint=define, use64bitall=define, uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='cc', ccflags ='-fno-common -DPERL_DARWIN -no-cpp-precomp -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -I/usr/gnu/include -I/usr/GNU/include',
optimize='-O3',
cppflags='-no-cpp-precomp -fno-common -DPERL_DARWIN -no-cpp-precomp -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -I/usr/gnu/include -I/usr/GNU/include'
ccversion='', gccversion='4.2.1 (Apple Inc. build 5659)', 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='env MACOSX_DEPLOYMENT_TARGET=10.3 cc', ldflags =' -fstack-protector -L/usr/local/lib -L/usr/gnu/lib'
libpth=/usr/local/lib /usr/gnu/lib /usr/lib
libs=-ldbm -ldb -ldl -lm -lutil -lc
perllibs=-ldl -lm -lutil -lc
libc=/usr/lib/libc.dylib, so=dylib, useshrplib=false, libperl=libperl.a
gnulibc_version=''
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' '
cccdlflags=' ', lddlflags=' -bundle -undefined dynamic_lookup -L/usr/local/lib -L/usr/gnu/lib -fstack-protector'


Characteristics of this binary (from libperl):
Compile-time options: PERL_DONT_CREATE_GVSV PERL_MALLOC_WRAP USE_64_BIT_ALL
USE_64_BIT_INT USE_LARGE_FILES USE_PERLIO
USE_PERL_ATOF
Built under darwin
Compiled at Jun 8 2010 15:36:47
@INC:
/Users/jleffler/Perl/v5.12.1/lib/perl5/site_perl/5.12.1/darwin-2level
/Users/jleffler/Perl/v5.12.1/lib/perl5/site_perl/5.12.1
/Users/jleffler/Perl/v5.12.1/lib/perl5/5.12.1/darwin-2level
/Users/jleffler/Perl/v5.12.1/lib/perl5/5.12.1
.

5.12.1 32 位

Summary of my perl5 (revision 5 version 12 subversion 1) configuration:

Platform:
osname=darwin, osvers=10.4.0, archname=darwin-2level
uname='darwin osiris-2.local 10.4.0 darwin kernel version 10.4.0: fri apr 23 18:28:53 pdt 2010; root:xnu-1504.7.4~1release_i386 i386 '
config_args=''
hint=recommended, useposix=true, d_sigaction=define
useithreads=undef, usemultiplicity=undef
useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
use64bitint=undef, use64bitall=undef, uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='cc -m32', ccflags ='-fno-common -DPERL_DARWIN -no-cpp-precomp -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -I/usr/gnu/include -I/usr/GNU/include',
optimize='-O3',
cppflags='-no-cpp-precomp -fno-common -DPERL_DARWIN -no-cpp-precomp -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -I/usr/gnu/include -I/usr/GNU/include'
ccversion='', gccversion='4.2.1 (Apple Inc. build 5659)', gccosandvers=''
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
alignbytes=8, prototype=define
Linker and Libraries:
ld='env MACOSX_DEPLOYMENT_TARGET=10.3 cc -m32', ldflags =' -fstack-protector -L/usr/local/lib -L/usr/gnu/lib -L/usr/GNU/lib'
libpth=/usr/local/lib /usr/gnu/lib /usr/GNU/lib /usr/lib
libs=-ldbm -ldl -lm -lutil -lc
perllibs=-ldl -lm -lutil -lc
libc=/usr/lib/libc.dylib, so=dylib, useshrplib=false, libperl=libperl.a
gnulibc_version=''
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' '
cccdlflags=' ', lddlflags=' -bundle -undefined dynamic_lookup -L/usr/local/lib -L/usr/gnu/lib -L/usr/GNU/lib -fstack-protector'


Characteristics of this binary (from libperl):
Compile-time options: PERL_DONT_CREATE_GVSV PERL_MALLOC_WRAP
USE_LARGE_FILES USE_PERLIO USE_PERL_ATOF
Built under darwin
Compiled at Jun 17 2010 20:48:50
@INC:
/Users/jleffler/Perl/v5.12.1-32bit/lib/perl5/site_perl/5.12.1/darwin-2level
/Users/jleffler/Perl/v5.12.1-32bit/lib/perl5/site_perl/5.12.1
/Users/jleffler/Perl/v5.12.1-32bit/lib/perl5/5.12.1/darwin-2level
/Users/jleffler/Perl/v5.12.1-32bit/lib/perl5/5.12.1
.

5.13.4 64 位

Summary of my perl5 (revision 5 version 13 subversion 4) configuration:

Platform:
osname=darwin, osvers=10.4.0, archname=darwin-2level
uname='darwin dyn9043040112.sanjose.ibm.com 10.4.0 darwin kernel version 10.4.0: fri apr 23 18:28:53 pdt 2010; root:xnu-1504.7.4~1release_i386 i386 '
config_args=''
hint=recommended, useposix=true, d_sigaction=define
useithreads=undef, usemultiplicity=undef
useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
use64bitint=define, use64bitall=define, uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='gcc -m64', ccflags ='-fno-common -DPERL_DARWIN -no-cpp-precomp -fno-strict-aliasing -pipe -fstack-protector -I/usr/gnu64/include -I/usr/local/include',
optimize='-O3',
cppflags='-no-cpp-precomp -fno-common -DPERL_DARWIN -no-cpp-precomp -fno-strict-aliasing -pipe -fstack-protector -I/usr/gnu64/include -I/usr/local/include'
ccversion='', gccversion='4.2.1 (Apple Inc. build 5664)', 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='env MACOSX_DEPLOYMENT_TARGET=10.3 cc', ldflags ='-fstack-protector -L/usr/gnu64/lib -L/usr/local/lib'
libpth=/usr/gnu64/lib /usr/lib /usr/local/lib
libs=-ldbm -ldb -ldl -lm -lutil -lc
perllibs=-ldl -lm -lutil -lc
libc=/usr/lib/libc.dylib, so=dylib, useshrplib=false, libperl=libperl.a
gnulibc_version=''
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' '
cccdlflags=' ', lddlflags=' -bundle -undefined dynamic_lookup -L/usr/gnu64/lib -L/usr/local/lib -fstack-protector'


Characteristics of this binary (from libperl):
Compile-time options: PERL_DONT_CREATE_GVSV PERL_MALLOC_WRAP USE_64_BIT_ALL
USE_64_BIT_INT USE_LARGE_FILES USE_PERLIO
USE_PERL_ATOF
Built under darwin
Compiled at Aug 30 2010 14:36:39
@INC:
/Users/jleffler/perl/v5.13.4/lib/site_perl/5.13.4/darwin-2level
/Users/jleffler/perl/v5.13.4/lib/site_perl/5.13.4
/Users/jleffler/perl/v5.13.4/lib/5.13.4/darwin-2level
/Users/jleffler/perl/v5.13.4/lib/5.13.4
.

关于perl - 为 OS X 构建 Perl - 架构特定的编译选项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3662804/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com