[MacPorts] #61588: p5.28-wx: Build error on MacPorts 2.6.4 on Big Sur

MacPorts noreply at macports.org
Fri Aug 20 01:53:51 UTC 2021


#61588: p5.28-wx: Build error on MacPorts 2.6.4 on Big Sur
-----------------------------+----------------------
  Reporter:  NozomuIshiguro  |      Owner:  mojca
      Type:  defect          |     Status:  assigned
  Priority:  Normal          |  Milestone:
 Component:  ports           |    Version:  2.6.4
Resolution:                  |   Keywords:  bigsur
      Port:  p5-wx           |
-----------------------------+----------------------

Comment (by jptbtpj):

 Hi,

 I've been trying to trace this issue [and as I did not know anything about
 the internals of MacPorts or MakeMaker, it's been interesting! ;-)], and
 the problem does indeed occur due to the XS generated C++ files being
 compiled by CLANG in C mode. Basically the setup (perl Makefile.PL) is run
 fine, and after that stage, the Makefile contains this line:

 {{{
 CC = /usr/bin/clang++ -UWX_PRECOMP
 }}}

 Then it looks like the post-configure step in the perl5 group script
 [macports-ports/_resources/port1.0/group/perl5-1.0.tcl] is run according
 to the log:

 {{{
 :debug:configure Executing proc-post-org.macports.configure-configure-0
 :info:configure Fixing flags in Makefile
 [...]
 :info:configure --->  Patching Makefile: s|^(CC *=).*|\1 /usr/bin/clang|
 :debug:configure Executing reinplace: /usr/bin/sed -E {s|^(CC *=).*|\1
 /usr/bin/clang|}
 </opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_perl_p5-wx/p5.28-wx/work/Wx-0.9932/Makefile
 >@file20
 :debug:configure euid/egid changed to: 0/0
 :debug:configure chowned
 /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_perl_p5-wx/p5.28-wx/work/Wx-0.9932/Makefile
 to macports
 :debug:configure euid/egid changed to: 503/501
 :debug:configure euid/egid changed to: 0/0
 :debug:configure setting attributes on
 /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_perl_p5-wx/p5.28-wx/work/Wx-0.9932/Makefile
 :debug:configure euid/egid changed to: 503/501
 }}}

 which causes the C++ compiler to be replaced by the C compiler. The
 Makefile ends up with the replaced definition:

 {{{
   CC = /usr/bin/clang
 }}}

 When the script then proceeds to the 'make' stage, it naturally fails, as
 the Makefile clearly needs CC to be a C++ compiler for Wx (all the
 implicit patterns for .c/.cpp/.cxx/.cc/.C use $(CCCMD), which again uses
 $(CC)).

 If you try a manual configuration and build of the exact same source code,
 it builds fine (and uses C++).

 The root cause seems to be commit
 {{{7080039472288d673d7b7cbd261095768bdc458f}}} of
 {{{_resources/port1.0/group/perl5-1.0.tcl}}} by Joshua Root
 <jmr at macports.org> on the 30th of Jan, 2020, which inserted this line in
 the Perl5 port group's post-configure:

 {{{
  reinplace -locale C -q -E "s|^(CC *=).*|\\1 ${configure.cc}|" ${file}
 }}}

 It is possible to fix the problem locally, by adding code to the
 Makefile.PLs - it works around the global replacement by adding a XCC make
 variable, and generally looks like this:

 {{{
 package MY;
   sub const_config {
     my $inherited = shift->SUPER::const_config(@ARG);
     my ($cc) = $inherited =~ m/\nCC\s*=\s*([^\n]*)/;
     $inherited .= "\nXCC = $cc";
     $inherited;
   }
   sub const_cccmd {
     my $inherited = shift->SUPER::const_cccmd(@ARG);
     $inherited =~ s/\$\(CC\)/\$(XCC)/;
     $inherited;
   }
 }}}

 Most of the Makefile.PLs need to be patched, see the proposed patch file
 {{{patch-C-Compiler-Used-For-C++.diff}}}. It can be activated by adding
 this line to the Portfile:

 {{{
     patchfiles      patch-C-Compiler-Used-For-C++.diff
 }}}

 This fix does disable the effect of the earlier reinplace fix, whatever
 issue that was intended to address, so it might cause failures in some
 configurations; however, compiling C++ with a C compiler will always fail
 anyway...

 I hope you can use this suggestion...

-- 
Ticket URL: <https://trac.macports.org/ticket/61588#comment:4>
MacPorts <https://www.macports.org/>
Ports system for macOS


More information about the macports-tickets mailing list