Opened 2 days ago

Last modified 43 hours ago

#71294 new defect

p5.34-ffi-platypus @2.90.0 tests using perl5.34 @5.34.3_1 with /usr/bin/cc – shouldn't it use the same tools as MacPorts does?

Reported by: ballapete (Peter "Pete" Dyballa) Owned by:
Priority: Normal Milestone:
Component: ports Version: 2.10.2
Keywords: highsierra Cc: dbevans (David B. Evans)
Port: p5.34-ffi-platypus

Description

The test goes like this:

--->  Computing dependencies for p5.34-ffi-platypus.
--->  Testing p5.34-ffi-platypus
Executing:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_perl_p5-ffi-platypus/p5.34-ffi-platypus/work/FFI-Platypus-2.09" && /usr/bin/make test 
"/opt/local/bin/perl5.34" -MExtUtils::Command::MM -e 'cp_nonempty' -- lib/FFI/Platypus.bs blib/arch/auto/FFI/Platypus/Platypus.bs 644
CC t/ffi/align.c
CC t/ffi/align_array.c
CC t/ffi/align_fixed.c
CC t/ffi/align_string.c
CC t/ffi/basic.c
CC t/ffi/closure.c
CC t/ffi/color.c
CC t/ffi/complex_double.c
CC t/ffi/complex_float.c
CC t/ffi/double.c
CC t/ffi/float.c
CC t/ffi/gh117.c
CC t/ffi/gh174.c
CC t/ffi/longdouble.c
CC t/ffi/memcmp4.c
CC t/ffi/meta.c
CC t/ffi/pointer.c
CC t/ffi/record.c
CC t/ffi/sint16.c
CC t/ffi/sint32.c
CC t/ffi/sint64.c
CC t/ffi/sint8.c
CC t/ffi/string.c
CC t/ffi/string_array.c
CC t/ffi/uint16.c
CC t/ffi/uint32.c
CC t/ffi/uint64.c
CC t/ffi/uint8.c
CC t/ffi/variadic.c
LD t/ffi/libtest.dylib
PERL_DL_NONLAZY=1 "/opt/local/bin/perl5.34" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
# 
# 
# 
# HARNESS_ACTIVE=1
# HARNESS_VERSION=3.50
# LANG=en_US.UTF-8
# PERL5LIB=/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_perl_p5-ffi-platypus/p5.34-ffi-platypus/work/FFI-Platypus-2.09/blib/lib:/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_perl_p5-ffi-platypus/p5.34-ffi-platypus/work/FFI-Platypus-2.09/blib/arch
# PERL_DL_NONLAZY=1
# PERL_USE_UNSAFE_INC=1
# 
# 
# 
# PERL5LIB path
# /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_perl_p5-ffi-platypus/p5.34-ffi-platypus/work/FFI-Platypus-2.09/blib/lib
# /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_perl_p5-ffi-platypus/p5.34-ffi-platypus/work/FFI-Platypus-2.09/blib/arch
# 
# 
# 
# perl                  5.034003 darwin darwin-thread-multi-2level
# Alien::Base           2.83
# Alien::FFI            0.27
# Capture::Tiny         0.48
# Devel::Hide           0.0015
# ExtUtils::CBuilder    0.280236
# ExtUtils::MakeMaker   7.70
# ExtUtils::ParseXS     3.43
# FFI::CheckLib         0.31
# File::Spec::Functions 3.75
# IPC::Cmd              1.04
# JSON::PP              4.16
# List::Util            1.68
# Math::LongDouble      0.25
# PkgConfig             0.25026
# Test2::API            1.302204
# Test2::V0             1.302204
# autodie               2.37
# constant              1.33
# forks                 0.36
# parent                0.242
# 
# 
# 
# mode : already-installed
# Alien::FFI->VERSION      = 0.27
# Alien::FFI->install_type = system
# Alien::FFI->cflags       =  
# Alien::FFI->libs         = -L/opt/local/lib -lffi 
# Alien::FFI->version      = 3.4.6
# 
# 
# 
# ffi.platypus.memory.strdup_impl =libc
# ffi.platypus.memory.strndup_impl=libc
# 
# 
# 
# Types:
#   complex_double : double complex
#   complex_float : float complex
#   complex_longdouble : long double complex
#   double   : double
#   float    : float
#   longdouble : long double
#   sint16   : int16_t, short, signed short
#   sint32   : blksize_t, dev_t, int, int32_t, senum, signed int, wchar_t, wint_t
#   sint64   : blkcnt_t, int64_t, intmax_t, intptr_t, long, long long, off_t, ptrdiff_t, signed long, signed long long, ssize_t, time_t
#   sint8    : char, int8_t, signed char
#   uint16   : mode_t, nlink_t, uint16_t, unsigned short, ushort
#   uint32   : enum, gid_t, uid_t, uint, uint32_t, unsigned int
#   uint64   : ino_t, size_t, uint64_t, uintmax_t, uintptr_t, ulong, unsigned long, unsigned long long
#   uint8    : bool, uchar, uint8_t, unsigned char
# 
# 
# 
# ABIs:
#   default_abi          2
#   efi64                3
#   gnuw64               4
#   unix64               2
#   win64                3
# 
# 
# 
# Probes:
#   alloca               1
#   abi                  1
#   recordvalue          1
#   strnlen              1
#   bigendian64          0
#   longdouble           1
#   complex              1
#   variadic             1
#   bigendian            0
# 
# 
# 
# [PLATFORM]
# osname            : darwin
# cc                : /usr/bin/cc
# cxx               : c++
# cxxld             : /usr/bin/cc
# for               : gfortran
# ld                : /usr/bin/cc
# ccflags           : -fno-common -DPERL_DARWIN -pipe -Os -fno-strict-aliasing -fstack-protector-strong -I/opt/local/include -DPERL_USE_SAFE_PUTENV -O3 -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_perl_p5-ffi-platypus/p5.34-ffi-platypus/work/FFI-Platypus-2.09/blib/lib/auto/share/dist/FFI-Platypus/include
# ldflags           : -dynamiclib -undefined dynamic_lookup -L/opt/local/lib -Wl,-headerpad_max_install_names -fstack-protector-strong
# object suffix     : .o
# library prefix    : lib
# library suffix    : .dylib,.bundle
# cc mm works       : -MM
# 
# 
# 
t/00_diag.t .............................. ok
t/ffi_build.t ............................ ok
t/ffi_build_file_base.t .................. ok
t/ffi_build_file_c.t ..................... ok
t/ffi_build_file_cxx.t ................... ok
t/ffi_build_file_library.t ............... ok
t/ffi_build_file_object.t ................ ok
t/ffi_build_mm.t ......................... ok
t/ffi_build_platform.t ................... ok
t/ffi_build_plugin.t ..................... ok
t/ffi_build_plugindata.t ................. ok
t/ffi_platypus.t ......................... ok
t/ffi_platypus_api.t ..................... ok
t/ffi_platypus_buffer.t .................. ok
t/ffi_platypus_bundle.t .................. ok
t/ffi_platypus_closure.t ................. ok
t/ffi_platypus_constant.t ................ ok
t/ffi_platypus_dl.t ...................... ok
t/ffi_platypus_function.t ................ ok
t/ffi_platypus_function_wrapper.t ........ ok
t/ffi_platypus_internal.t ................ ok
t/ffi_platypus_lang.t .................... ok
t/ffi_platypus_lang_asm.t ................ ok
t/ffi_platypus_lang_c.t .................. ok
t/ffi_platypus_lang_win32.t .............. ok
t/ffi_platypus_legacy.t .................. ok
t/ffi_platypus_memory.t .................. ok
t/ffi_platypus_record.t .................. ok
t/ffi_platypus_record_meta.t ............. ok
t/ffi_platypus_record_tiearray.t ......... ok
t/ffi_platypus_shareconfig.t ............. ok
t/ffi_platypus_type.t .................... ok
t/ffi_platypus_type_pointersizebuffer.t .. ok
t/ffi_platypus_type_stringarray.t ........ ok
t/ffi_platypus_type_stringpointer.t ...... ok
t/ffi_platypus_type_widestring.t ......... ok
t/ffi_platypus_typeparser.t .............. ok
t/ffi_platypus_typeparser_version0.t ..... ok
t/ffi_platypus_typeparser_version1.t ..... ok
t/ffi_platypus_typeparser_version2.t ..... ok
t/ffi_probe.t ............................ ok
t/ffi_probe_runner.t ..................... ok
t/ffi_probe_runner_builder.t ............. ok
t/ffi_probe_runner_result.t .............. ok
t/ffi_temp.t ............................. ok
t/forks.t ................................ ok
t/gh117.t ................................ ok
t/gh129.t ................................ ok
t/gh323.t ................................ ok
t/memory.t ............................... skipped: tested only in CI
t/threads.t .............................. ok
t/type_complex_double.t .................. ok
t/type_complex_float.t ................... ok
t/type_custom.t .......................... ok
t/type_double.t .......................... ok
t/type_float.t ........................... ok
t/type_longdouble.t ...................... ok
t/type_longdouble__array.t ............... ok
t/type_longdouble__hide.t ................ ok
t/type_longdouble__ptr.t ................. ok
t/type_opaque.t .......................... ok
t/type_record.t .......................... ok
t/type_record_value.t .................... ok
t/type_sint16.t .......................... ok
t/type_sint32.t .......................... ok
t/type_sint64.t .......................... ok
t/type_sint8.t ........................... ok
t/type_string.t .......................... ok
t/type_uint16.t .......................... ok
t/type_uint32.t .......................... ok
t/type_uint64.t .......................... ok
t/type_uint8.t ........................... ok
All tests successful.
Files=72, Tests=325, 24 wallclock secs ( 0.45 usr  0.16 sys + 18.55 cusr  3.38 csys = 22.54 CPU)
Result: PASS

Test passes, but seems to use inadequate means, the system's default C compiler, while port uses Clang to build:

  335 :debug:configure CC='/usr/bin/clang'
  341 :debug:configure CXX='/usr/bin/clang++'

There are also differences in other flags used:

  338 :debug:configure CFLAGS='-pipe -Os -arch x86_64'
  342 :debug:configure CXXFLAGS='-pipe -Os -stdlib=libc++ -arch x86_64'
  344 :debug:configure F90FLAGS='-pipe -Os -m64'
  345 :debug:configure FCFLAGS='-pipe -Os -m64'
  346 :debug:configure FFLAGS='-pipe -Os -m64'
  349 :debug:configure LDFLAGS='-L/opt/local/lib -Wl,-headerpad_max_install_names -arch x86_64'

Perl Portfile contains:

 59         if {${perl5.major} >= 5.24} {
 60             # Use a new enough compiler that perl_tsa_mutex_lock gets compiled in,
 61             # since perl modules may try to use it if they get compiled with a
 62             # newer compiler. See https://github.com/Perl/perl5/issues/18991

There are more Perl modules that a require a C compiler and use "some" flags, options, switches… (need to investigate today/tomorrow) Shouldn't all these modules use the same tools and setups/configurtions as Perl itself?

Change History (4)

comment:1 in reply to:  description ; Changed 44 hours ago by ryandesign (Ryan Carsten Schmidt)

Cc: dbevans added; devans@… removed
Type: requestdefect

perl is designed to keep track of what compiler was used when perl was compiled and to use that same compiler when compiling perl modules.

In MacPorts we consider that aspect of perl's build system to be a design flaw and we take steps to circumvent it. We want ports to be using the compiler MacPorts tells them to use, not one that one of its dependencies tells it to use.

Perl still records in its config files what compiler and flags were used when compiling perl, but code in the perl5 portgroup tells ports to use the compiler MacPorts selected instead of the one that's in the config files. And the perl5 portfile replaces the compiler paths in the config files with /usr/bin/cc and /usr/bin/c++ so that, in the unlikely event that some module build still manages to use the system compiler, it will at least find a compiler that exists, even if it is not exactly the one we wanted.

Replying to ballapete:

Test passes, but seems to use inadequate means, the system's default C compiler, while port uses Clang to build:

  335 :debug:configure CC='/usr/bin/clang'
  341 :debug:configure CXX='/usr/bin/clang++'

How do you know that it has used the system's default C compiler instead of clang? The above are the environment variables MacPorts has set, and the ones the perl5 portgroup should be shoving into the build.

With Xcode 5 and later, /usr/bin/cc is clang and /usr/bin/c++ is clang++ so even if the default compilers are inadvertently used by some module, it often works. But you are correct when you point out later that sometimes perl or modules might need to be built with a newer compiler than the system compiler so it's important that the build uses right compiler MacPorts tells it to.

CC t/ffi/align.c
CC t/ffi/align_array.c
CC t/ffi/align_fixed.c
CC t/ffi/align_string.c
CC t/ffi/basic.c
CC t/ffi/closure.c
CC t/ffi/color.c
CC t/ffi/complex_double.c
CC t/ffi/complex_float.c
CC t/ffi/double.c
CC t/ffi/float.c
CC t/ffi/gh117.c
CC t/ffi/gh174.c
CC t/ffi/longdouble.c
CC t/ffi/memcmp4.c
CC t/ffi/meta.c
CC t/ffi/pointer.c
CC t/ffi/record.c
CC t/ffi/sint16.c
CC t/ffi/sint32.c
CC t/ffi/sint64.c
CC t/ffi/sint8.c
CC t/ffi/string.c
CC t/ffi/string_array.c
CC t/ffi/uint16.c
CC t/ffi/uint32.c
CC t/ffi/uint64.c
CC t/ffi/uint8.c
CC t/ffi/variadic.c
LD t/ffi/libtest.dylib

These lines show that these files were compiled and linked but because they are "silent rules" they don't show what compiler was used. For this reason, we would like ports to use "verbose rules" when building instead. This could be something specific to this port, or it could be a general problem in the perl5 portgroup when building additional files for the test phase.

# [PLATFORM]
# osname            : darwin
# cc                : /usr/bin/cc
# cxx               : c++
# cxxld             : /usr/bin/cc
# for               : gfortran
# ld                : /usr/bin/cc
# ccflags           : -fno-common -DPERL_DARWIN -pipe -Os -fno-strict-aliasing -fstack-protector-strong -I/opt/local/include -DPERL_USE_SAFE_PUTENV -O3 -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_perl_p5-ffi-platypus/p5.34-ffi-platypus/work/FFI-Platypus-2.09/blib/lib/auto/share/dist/FFI-Platypus/include
# ldflags           : -dynamiclib -undefined dynamic_lookup -L/opt/local/lib -Wl,-headerpad_max_install_names -fstack-protector-strong

The value of cc here looks like the value from the config file that this build is printing for your information. (It doesn't necessarily mean it actually used that compiler to compile anything.) The value of cxx look wrong, not having a full path. The value of cxxld looks wrong, being a C compiler and not a C++ compiler.

There are also differences in other flags used:

  338 :debug:configure CFLAGS='-pipe -Os -arch x86_64'
  342 :debug:configure CXXFLAGS='-pipe -Os -stdlib=libc++ -arch x86_64'
  344 :debug:configure F90FLAGS='-pipe -Os -m64'
  345 :debug:configure FCFLAGS='-pipe -Os -m64'
  346 :debug:configure FFLAGS='-pipe -Os -m64'
  349 :debug:configure LDFLAGS='-L/opt/local/lib -Wl,-headerpad_max_install_names -arch x86_64'

Differences between these flags (which MacPorts sets in the environment variables and wants ports to use) and what?

There are more Perl modules that a require a C compiler and use "some" flags, options, switches… (need to investigate today/tomorrow) Shouldn't all these modules use the same tools and setups/configurtions as Perl itself?

The developers of perl say yes, while we say no. The perl5 portgroup arranges what flags should be used by module builds. It is possible that some module builds are ignoring this and getting compiler or flags from the config file; if so, that would be a bug to be fixed in those modules.

comment:2 in reply to:  1 Changed 43 hours ago by ballapete (Peter "Pete" Dyballa)

Replying to ryandesign:

Differences between these flags (which MacPorts sets in the environment variables and wants ports to use) and what?

Those set or at least reported by the Perl module.

comment:3 in reply to:  1 ; Changed 43 hours ago by ballapete (Peter "Pete" Dyballa)

Replying to ryandesign:

These lines show that these files were compiled and linked but because they are "silent rules" they don't show what compiler was used. For this reason, we would like ports to use "verbose rules" when building instead. This could be something specific to this port, or it could be a general problem in the perl5 portgroup when building additional files for the test phase.

Are these "verbose rules" something different than the port option -v? (Which I used in my example.)

comment:4 in reply to:  3 Changed 43 hours ago by ryandesign (Ryan Carsten Schmidt)

Replying to ballapete:

Are these "verbose rules" something different than the port option -v? (Which I used in my example.)

Yes. -v tells MacPorts to show you what the build system outputted into the main.log. But this build system is outputting abbreviated information. Steps need to be taken to tell the build system to output full build commands instead.

Note: See TracTickets for help on using tickets.