1

我正在尝试在我的 macOS Mojave 版本 10.14.6 中安装 perl 包 DBD::Pg。但是我收到未知选项 -platform_version 的错误,并且不允许 make 命令继续。我将如何解决这个问题?谢谢!

以下是我观察到的错误

ld: unknown option: -platform_version
clang-10: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [blib/arch/auto/DBD/Pg/Pg.bundle] Error 1

ld版本

ld -v
@(#)PROGRAM:ld  PROJECT:ld64-450.3
BUILD 18:16:53 Apr  5 2019
configured to support archs: armv6 armv7 armv7s arm64 arm64e arm64_32 i386 x86_64 x86_64h armv6m armv7k armv7m armv7em
LTO support using: LLVM version 10.0.1, (clang-1001.0.46.4) (static support for 22, runtime is 22)
TAPI support using: Apple TAPI version 10.0.1 (tapi-1001.0.4.1)

铿锵版

clang -v
clang version 10.0.0 
Target: x86_64-apple-darwin18.7.0
Thread model: posix
InstalledDir: /Users/macuser/miniconda3/bin
4

2 回答 2

1

我更新了我的 Xcode 并获得了 clang 版本 11.0.3 然后我在“make install”命令中遇到了问题。我可以使用帖子https://github.com/bucardo/dbdpg/issues/69 @briandfoy 发布的建议来解决这个问题。非常感谢你!

于 2020-06-29T02:30:28.403 回答
0

我在 macOS 10.15.5、perlbrew perl 5.30.1 上试过这个。

  • 首先,我从https://www.enterprisedb.com/downloads/postgres-postgresql-downloads安装了 PostgreSQL 12.3 版

  • 下载了 perl 模块 DBD::Pg tarball https://cpan.metacpan.org/authors/id/T/TU/TURNSTEP/DBD-Pg-3.13.0.tar.gz

  • 安装包:

    $ POSTGRES_HOME=/Library/PostgreSQL/12 perl Makefile.PL
    Configuring DBD::Pg 3.13.0
    PostgreSQL version: 120003 (default port: 5432)
    POSTGRES_HOME: /Library/PostgreSQL/12
    POSTGRES_INCLUDE: /Library/PostgreSQL/12/include
    POSTGRES_LIB: /Library/PostgreSQL/12/lib
    OS: darwin
    Checking if your kit is complete...
    Looks good
    Using DBI 1.643 (for perl 5.030001 on darwin-2level) installed in /Users/hakonhaegland/perl5/perlbrew/perls/perl-5.30.1/lib/site_perl/5.30.1/darwin-2level/auto/DBI/
    Generating a Unix-style Makefile
    Writing Makefile for DBD::Pg
    Writing MYMETA.yml and MYMETA.json
    
    $ make
    cp Pg.pm blib/lib/DBD/Pg.pm
    cp lib/Bundle/DBD/Pg.pm blib/lib/Bundle/DBD/Pg.pm
    Running Mkbootstrap for Pg ()
    chmod 644 "Pg.bs"
    "/Users/hakonhaegland/perl5/perlbrew/perls/perl-5.30.1/bin/perl" -MExtUtils::Command::MM -e 'cp_nonempty' -- Pg.bs blib/arch/auto/DBD/Pg/Pg.bs 644
    "/Users/hakonhaegland/perl5/perlbrew/perls/perl-5.30.1/bin/perl" -p -e "s/~DRIVER~/Pg/g; s/^do\(/dontdo\(/" /Users/hakonhaegland/perl5/perlbrew/perls/perl-5.30.1/lib/site_perl/5.30.1/darwin-2level/auto/DBI/Driver.xst > Pg.xsi
    "/Users/hakonhaegland/perl5/perlbrew/perls/perl-5.30.1/bin/perl" "/Users/hakonhaegland/perl5/perlbrew/perls/perl-5.30.1/lib/5.30.1/ExtUtils/xsubpp"  -typemap '/Users/hakonhaegland/perl5/perlbrew/perls/perl-5.30.1/lib/5.30.1/ExtUtils/typemap'  Pg.xs > Pg.xsc
    mv Pg.xsc Pg.c
    cc -c  -I/Library/PostgreSQL/12/include -I/Users/hakonhaegland/perl5/perlbrew/perls/perl-5.30.1/lib/site_perl/5.30.1/darwin-2level/auto/DBI -fno-common -DPERL_DARWIN -mmacosx-version-min=10.15 -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -DPERL_USE_SAFE_PUTENV -DPGLIBVERSION=120003 -DPGDEFPORT=5432 -O3  -DPERL_EXTMALLOC_DEF -Dmalloc=Perl_malloc -Dfree=Perl_mfree -Drealloc=Perl_realloc -Dcalloc=Perl_calloc -DVERSION=\"3.13.0\" -DXS_VERSION=\"3.13.0\"  "-I/Users/hakonhaegland/perl5/perlbrew/perls/perl-5.30.1/lib/5.30.1/darwin-2level/CORE"   Pg.c
    cc -c  -I/Library/PostgreSQL/12/include -I/Users/hakonhaegland/perl5/perlbrew/perls/perl-5.30.1/lib/site_perl/5.30.1/darwin-2level/auto/DBI -fno-common -DPERL_DARWIN -mmacosx-version-min=10.15 -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -DPERL_USE_SAFE_PUTENV -DPGLIBVERSION=120003 -DPGDEFPORT=5432 -O3  -DPERL_EXTMALLOC_DEF -Dmalloc=Perl_malloc -Dfree=Perl_mfree -Drealloc=Perl_realloc -Dcalloc=Perl_calloc -DVERSION=\"3.13.0\" -DXS_VERSION=\"3.13.0\"  "-I/Users/hakonhaegland/perl5/perlbrew/perls/perl-5.30.1/lib/5.30.1/darwin-2level/CORE"   dbdimp.c
    cc -c  -I/Library/PostgreSQL/12/include -I/Users/hakonhaegland/perl5/perlbrew/perls/perl-5.30.1/lib/site_perl/5.30.1/darwin-2level/auto/DBI -fno-common -DPERL_DARWIN -mmacosx-version-min=10.15 -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -DPERL_USE_SAFE_PUTENV -DPGLIBVERSION=120003 -DPGDEFPORT=5432 -O3  -DPERL_EXTMALLOC_DEF -Dmalloc=Perl_malloc -Dfree=Perl_mfree -Drealloc=Perl_realloc -Dcalloc=Perl_calloc -DVERSION=\"3.13.0\" -DXS_VERSION=\"3.13.0\"  "-I/Users/hakonhaegland/perl5/perlbrew/perls/perl-5.30.1/lib/5.30.1/darwin-2level/CORE"   quote.c
    cc -c  -I/Library/PostgreSQL/12/include -I/Users/hakonhaegland/perl5/perlbrew/perls/perl-5.30.1/lib/site_perl/5.30.1/darwin-2level/auto/DBI -fno-common -DPERL_DARWIN -mmacosx-version-min=10.15 -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -DPERL_USE_SAFE_PUTENV -DPGLIBVERSION=120003 -DPGDEFPORT=5432 -O3  -DPERL_EXTMALLOC_DEF -Dmalloc=Perl_malloc -Dfree=Perl_mfree -Drealloc=Perl_realloc -Dcalloc=Perl_calloc -DVERSION=\"3.13.0\" -DXS_VERSION=\"3.13.0\"  "-I/Users/hakonhaegland/perl5/perlbrew/perls/perl-5.30.1/lib/5.30.1/darwin-2level/CORE"   types.c
    rm -f blib/arch/auto/DBD/Pg/Pg.bundle
    LD_RUN_PATH="/Library/PostgreSQL/12/lib" cc  -mmacosx-version-min=10.15 -bundle -undefined dynamic_lookup -L/usr/local/lib -fstack-protector-strong  Pg.o dbdimp.o quote.o types.o  -o blib/arch/auto/DBD/Pg/Pg.bundle  \
         -L/Library/PostgreSQL/12/lib -lpq -lm   \
    
    chmod 755 blib/arch/auto/DBD/Pg/Pg.bundle
    Manifying 2 pod documents
    
    $ make test
    
    "/Users/hakonhaegland/perl5/perlbrew/perls/perl-5.30.1/bin/perl" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
    t/00_signature.t ....... skipped: Set the environment variable TEST_SIGNATURE to enable this test
    t/00basic.t ............ ok
    t/01connect.t .......... Please wait, creating new database (version 12.3) for testing
    t/01connect.t .......... 1/15 #
    # DBI                         Version 1.643
    # DBD::Pg                     Version 3.13.0
    # Perl                        Version 5.30.1
    # OS                          darwin
    # PostgreSQL (compiled)       120003
    # PostgreSQL (target)         120300
    # PostgreSQL (reported)       PostgreSQL 12.3 on x86_64-apple-darwin, compiled by Apple LLVM version 6.0 (clang-600.0.54) (based on LLVM 3.5svn), 64-bit
    # Default port                5432
    # DBI_DSN                     dbi:Pg:db="postgres";port=5440;host=<pwd>/dbdpg_test_database/data/socket
    # DBI_USER                    hakonhaegland
    # Test schema                 dbd_pg_testschema
    # LANG                        C
    # Adjusted:                   initdb
    t/01connect.t .......... ok
    t/01constants.t ........ ok
    t/02attribs.t .......... ok
    t/03dbmethod.t ......... ok
    t/03smethod.t .......... ok
    t/04misc.t ............. ok
    t/06bytea.t ............ ok
    t/07copy.t ............. ok
    t/08async.t ............ ok
    t/09arrays.t ........... ok
    t/10_pg_error_field.t .. ok
    t/12placeholders.t ..... ok
    t/20savepoints.t ....... ok
    t/30unicode.t .......... ok
    t/99cleanup.t .......... ok
    All tests successful.
    Files=17, Tests=2908, 31 wallclock secs ( 0.55 usr  0.11 sys +  5.99 cusr  2.38 csys =  9.03 CPU)
    Result: PASS
    
    $ make install
    "/Users/hakonhaegland/perl5/perlbrew/perls/perl-5.30.1/bin/perl" -MExtUtils::Command::MM -e 'cp_nonempty' -- Pg.bs blib/arch/auto/DBD/Pg/Pg.bs 644
    Manifying 2 pod documents
    Files found in blib/arch: installing files in blib/lib into architecture dependent library tree
    Installing /Users/hakonhaegland/perl5/perlbrew/perls/perl-5.30.1/lib/site_perl/5.30.1/darwin-2level/auto/DBD/Pg/Pg.bundle
    Installing /Users/hakonhaegland/perl5/perlbrew/perls/perl-5.30.1/lib/site_perl/5.30.1/darwin-2level/Bundle/DBD/Pg.pm
    Installing /Users/hakonhaegland/perl5/perlbrew/perls/perl-5.30.1/lib/site_perl/5.30.1/darwin-2level/DBD/Pg.pm
    Installing /Users/hakonhaegland/perl5/perlbrew/perls/perl-5.30.1/man/man3/Bundle::DBD::Pg.3
    Installing /Users/hakonhaegland/perl5/perlbrew/perls/perl-5.30.1/man/man3/DBD::Pg.3
    Appending installation info to /Users/hakonhaegland/perl5/perlbrew/perls/perl-5.30.1/lib/5.30.1/darwin-2level/perllocal.pod
    

我的编译器版本是:

$ cc --version
Apple clang version 11.0.0 (clang-1100.0.33.17)
Target: x86_64-apple-darwin19.5.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
于 2020-06-28T09:15:44.853 回答