Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#62400 closed defect (fixed)

When installing Squid4 on Leopard Intel, MacPorts tries (and fails) to build libcxx

Reported by: Wowfunhappy (Jonathan) Owned by: kencu (Ken)
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc: kencu (Ken)
Port: squid4

Description (last modified by ryandesign (Ryan Carsten Schmidt))

The Squid Proxy is particularly useful on old versions of OS X, because it can be used to fix HTTPS problems. I'm trying to build it in a clean, Intel Leopard VM, with a default copy of macports.conf.

For whatever reason, MacPorts is attempting to pull in libcxx when I install squid4, and libcxx cannot be built on Leopard out of the box. As a result, the port fails to install:

:notice:build --->  Building libcxx
:debug:build Executing org.macports.build (libcxx)
:debug:build Environment: 
:debug:build CC='/usr/bin/gcc-4.2'
:debug:build CC_PRINT_OPTIONS='YES'
:debug:build CC_PRINT_OPTIONS_FILE='/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_libcxx/libcxx/work/.CC_PRINT_OPTIONS'
:debug:build CPATH='/opt/local/include'
:debug:build CXX='/usr/bin/g++-4.2'
:debug:build DEVELOPER_DIR='/Developer'
:debug:build LIBRARY_PATH='/opt/local/lib'
:debug:build MACOSX_DEPLOYMENT_TARGET='10.5'
:debug:build RC_CFLAGS='-arch i386 -arch ppc -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_libcxx/libcxx/work/libcxxabi-5.0.1.src/include -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_libcxx/libcxx/work/libcxx-5.0.1.src/include -Os'
:debug:build RC_ProjectSourceVersion='5.0.1'
:debug:build RC_XBS='1'
:debug:build TRIPLE='-apple-darwin9'
:info:build Executing:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_libcxx/libcxx/work/build" && /usr/bin/make -j4 -w all LIBCXXABI_PATH=/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_libcxx/libcxx/work/libcxxabi-5.0.1.src LIBCXX_PATH=/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_libcxx/libcxx/work/libcxx-5.0.1.src LIBCXXABI_DYLIB_PATH=/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_libcxx/libcxx/work/build/libc++abi.dylib 
:debug:build system:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_libcxx/libcxx/work/build" && /usr/bin/make -j4 -w all LIBCXXABI_PATH=/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_libcxx/libcxx/work/libcxxabi-5.0.1.src LIBCXX_PATH=/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_libcxx/libcxx/work/libcxx-5.0.1.src LIBCXXABI_DYLIB_PATH=/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_libcxx/libcxx/work/build/libc++abi.dylib 
:info:build make: Entering directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_libcxx/libcxx/work/build'
:info:build cd /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_libcxx/libcxx/work/libcxxabi-5.0.1.src/lib && ./buildit
:info:build + for FILE in '../src/*.cpp'
:info:build + /usr/bin/g++-4.2 -c -g -O3 -arch i386 -arch ppc -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_libcxx/libcxx/work/libcxxabi-5.0.1.src/include -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_libcxx/libcxx/work/libcxx-5.0.1.src/include -Os -std=c++11 -stdlib=libc++ -nostdinc++ -fstrict-aliasing -Wstrict-aliasing=2 -Wsign-conversion -Wshadow -Wconversion -Wunused-variable -Wmissing-field-initializers -Wchar-subscripts -Wmismatched-tags -Wmissing-braces -Wshorten-64-to-32 -Wsign-compare -Wstrict-aliasing=2 -Wstrict-overflow=4 -Wunused-parameter -Wnewline-eof -D_LIBCPP_BUILDING_LIBRARY -I../include ../src/abort_message.cpp
:info:build cc1plus: error: unrecognized command line option "-Wsign-conversion"
:info:build cc1plus: error: unrecognized command line option "-Wmismatched-tags"
:info:build cc1plus: error: unrecognized command line option "-std=c++11"
:info:build cc1plus: error: unrecognized command line option "-stdlib=libc++"
:info:build cc1plus: error: unrecognized command line option "-Wsign-conversion"
:info:build cc1plus: error: unrecognized command line option "-Wmismatched-tags"
:info:build cc1plus: error: unrecognized command line option "-std=c++11"
:info:build cc1plus: error: unrecognized command line option "-stdlib=libc++"
:info:build fatal error: lipo: can't figure out the architecture type of: /opt/local/var/macports/build/

This is fundamentally the same issue reported here: #57911. The question is, why is libcxx being used in the first place?

I don't believe this is actually an issue with squid, but kencu asked that I open a new ticket.

Change History (10)

comment:1 Changed 4 years ago by kencu (Ken)

squid4 sets

compiler.cxx_standard   2011

on Tiger Intel, that should lead to a call-in of gcc7/libgcc7 and set appropriate c++flags to build it right.

If it doesn't, then something is amiss in base's compiler selections.

that is quite possible, as that particular pathway in base (c++11 on Tiger Intel) is not well paved.

comment:2 Changed 4 years ago by Wowfunhappy (Jonathan)

Thanks! Just to be clear, the problem is on Leopard. I successfully built Squid on Tiger last weekend, and it never tried to install libcxx.

(Squid was not actually usable on Tiger due to very frequent crashes, which is in fact why I'm now trying Leopard. But it did build.)

Last edited 4 years ago by Wowfunhappy (Jonathan) (previous) (diff)

comment:3 Changed 4 years ago by kencu (Ken)

check, Leopard Intel. will help you investigate.

comment:4 Changed 4 years ago by kencu (Ken)

for the issue about libcxx selecting gcc-4.2 as a build compiler, you are right, that should and will be tracked in #57911.

Let's use this ticket to focus on why squid4 is not using gcc7/libgcc7 as it should.

I presume you just doing sudo port -v install squid4? Or are you specifically trying to build universal?

(Universal can presently not work as we don't have any c++11 cross-compiling compilers that can do i386 & ppc compiling available at present.)

comment:5 Changed 4 years ago by ryandesign (Ryan Carsten Schmidt)

Description: modified (diff)

Please attach the main.log.

comment:6 Changed 4 years ago by kencu (Ken)

So indeed, with generic macports.conf set to the MacPorts defaults, there is quite a difference between squid4's deps on 10.4 Intel and 10.5 Intel.

10.4:

$ port rdeps squid4
The following ports are dependencies of squid4 @4.13_0+openssl:
  xz
    apple-gcc42
      ld64
        ld64-97
          libmacho-headers
          libunwind-headers
      cctools
      gcc_select
    libiconv
      gperf
    gettext
      ncurses
  pkgconfig
  gcc7
    gmp
    isl
    zlib
    libmpc
      mpfr
    libgcc
      libgcc7
  expat
  openssl
    perl5
      perl5.28
        db48
        gdbm
          readline

10.5:

$ port rdeps squid4
Warning: All compilers are either blacklisted or unavailable; defaulting to first fallback option
The following ports are dependencies of squid4 @4.13_0+openssl:
  xz
    libiconv
      gperf
    gettext
      ncurses
  pkgconfig
  clang-7.0
    cmake
      clang-3.7
        cctools
          libunwind-headers
        clang-3.4
          llvm-3.4
            libffi
              expect
                automake
                  autoconf
                tcl
              dejagnu
            zlib
            perl5
              perl5.28
                db48
                gdbm
                  readline
            llvm_select
          python27
            bzip2
            expat
            libedit
            openssl
            sqlite3
            python_select
            python2_select
          clang_select
          ld64
            ld64-127
              libmacho-headers
              llvm-3.3
        llvm-3.7
          libcxx
      curl
        libidn2
          libtool
            xattr
              unzip
          libunistring
            texinfo
              help2man
                p5.28-locale-gettext
              perl5.30
        libpsl
          python39
            python3_select
          glib2
            libxml2
              icu
                gcc7
                  gmp
                  isl
                  libmpc
                    mpfr
                  gcc_select
                  libgcc
                    libgcc7
            pcre
        zstd
          lz4
        curl-ca-bundle
      libarchive
        lzo2
      libuv
        legacy-support
    libomp
    llvm-7.0
      xar

It seems that on 10.5, base is recommending clang-7.0 be used to build against libgcc7, whereas on 10.4, base is happy with gcc7.

10.4:

$ port -d info squid4
Warning: port definitions are more than two weeks old, consider updating them by running 'port selfupdate'.
DEBUG: Changing to port directory: /opt/toolchains/var/macports/sources/rsync.macports.org/macports/release/tarballs/ports/net/squid4
DEBUG: OS darwin/8.11.1 (macOS 10.4) arch i386
DEBUG: Compiler doesn't support universal builds, so not adding the default universal variant
DEBUG: Executing variant openssl provides openssl
DEBUG: Running callback portconfigure::add_automatic_compiler_dependencies
DEBUG: Chosen compiler macports-gcc-7 is provided by a port, adding dependency
DEBUG: Adding depends_build port:gcc7
DEBUG: Adding depends_lib path:share/doc/libgcc/README:libgcc
DEBUG: Adding depends_lib port:libgcc7
DEBUG: Adding depends_skip_archcheck gcc7
DEBUG: Finished running callback portconfigure::add_automatic_compiler_dependencies
DEBUG: Running callback portbuild::add_automatic_buildsystem_dependencies
DEBUG: Finished running callback portbuild::add_automatic_buildsystem_dependencies
DEBUG: Running callback portstartupitem::add_notes
DEBUG: Finished running callback portstartupitem::add_notes
squid4 @4.13 (net)
Variants:             gnutls, ipfw_transparent, kerberos, [+]openssl, ssl_crtd

Description:          Squid is a high-performance proxy caching server for web clients, supporting FTP, gopher, and
                      HTTP data objects. Unlike traditional caching software, Squid handles all requests in a single,
                      non-blocking, I/O-driven process. Squid keeps meta data and especially hot objects cached in
                      RAM, caches DNS lookups, supports non-blocking DNS lookups, and implements negative caching of
                      failed requests. Squid 4.x is the latest release series, and needs a C++11 compiler to build.
Homepage:             http://www.squid-cache.org/

Extract Dependencies: bin:xz:xz
Build Dependencies:   port:pkgconfig, port:gcc7
Library Dependencies: port:expat, port:zlib, port:openssl, path:share/doc/libgcc/README:libgcc, port:libgcc7
Conflicts with:       squid2, squid3
Platforms:            darwin
License:              GPL-2+
Maintainers:          Email: jmr@macports.org, GitHub: jmroot
                      Policy: openmaintainer

10.5:

$ port -d info squid4
DEBUG: Changing to port directory: /opt/local/var/macports/sources/rsync.macports.org/release/tarballs/ports/net/squid4
DEBUG: OS darwin/9.8.0 (macOS 10.5) arch i386
DEBUG: adding the default universal variant
DEBUG: Reading variant descriptions from /opt/local/var/macports/sources/rsync.macports.org/release/tarballs/ports/_resources/port1.0/variant_descriptions.conf
DEBUG: Executing variant openssl provides openssl
DEBUG: Running callback portconfigure::add_automatic_compiler_dependencies
DEBUG: Chosen compiler macports-clang-7.0 is provided by a port, adding dependency
DEBUG: Adding depends_build port:clang-7.0
DEBUG: Adding depends_lib path:lib/libgcc/libgcc_s.1.dylib:libgcc
DEBUG: Adding depends_skip_archcheck clang-7.0
DEBUG: Finished running callback portconfigure::add_automatic_compiler_dependencies
DEBUG: Running callback portbuild::add_automatic_buildsystem_dependencies
DEBUG: Finished running callback portbuild::add_automatic_buildsystem_dependencies
DEBUG: Running callback portstartupitem::add_notes
DEBUG: Finished running callback portstartupitem::add_notes
squid4 @4.13 (net)
Variants:             gnutls, ipfw_transparent, kerberos, [+]openssl, ssl_crtd, universal

Description:          Squid is a high-performance proxy caching server for web clients, supporting FTP, gopher,
                      and HTTP data objects. Unlike traditional caching software, Squid handles all requests in
                      a single, non-blocking, I/O-driven process. Squid keeps meta data and especially hot
                      objects cached in RAM, caches DNS lookups, supports non-blocking DNS lookups, and
                      implements negative caching of failed requests. Squid 4.x is the latest release series,
                      and needs a C++11 compiler to build.
Homepage:             http://www.squid-cache.org/

Extract Dependencies: bin:xz:xz
Build Dependencies:   port:pkgconfig, port:clang-7.0
Library Dependencies: port:expat, port:zlib, port:openssl, path:lib/libgcc/libgcc_s.1.dylib:libgcc
Conflicts with:       squid2, squid3
Platforms:            darwin
License:              GPL-2+
Maintainers:          Email: jmr@macports.org, GitHub: jmroot
                      Policy: openmaintainer

So the issue is probably in compiler selection in base for the c++11 compiler on 10.5 Intel.

However -- let me say this.

For pretty much any real use, you will need to have base give you clang-7.0 on 10.5 Intel as a compiler. It is 100x more compatible with the rest of the MacPorts port tree to have that.

It works perfectly fine if you change the universal archs to "i386 x86_64" on 10.5 Intel to have clang-7.0 as the compiler. And 10.5 PPC works because it's compiler selection is different.

SO

we could "fix" this by changing the compiler selection on 10.5 Intel to match 10.5 PPC, and in so doing, break a whole bunch of 10.5 Intel systems that presently work great (for no reason).

Or -- we could tell 10.5 Intel users to change their universal archs to "i386 x86_64" and then all would be well.

Everyone knows what I would suggest we do, I've been saying the same thing for several years now..

For you, for today, for squid4 on an unchanged 10.5 system with universal archs set to "i386 ppc" and you don't want to change them for some reason -- well -- force the squid compiler like this:

sudo port -v install squid4 configure.compiler=macports-gcc-7

comment:7 Changed 4 years ago by kencu (Ken)

I think I might be able to fix this whole issue in 10s by removing "ppc" from the supported archs in libcxx.

Then it will stop trying to build libcxx +universal with a ppc slice which MacPorts cannot presently do (automatically).

Last edited 4 years ago by kencu (Ken) (previous) (diff)

comment:8 Changed 4 years ago by kencu (Ken)

Actually Jonathan, because you have a relatively untouched system there, would you like to try that fix?

Just edit the libcxx Portfile, remove ppc from the supported archs, save that file, and then try your installation of squid4 again.

If we are lucky, it will just build clang-7.0 as non-universal, and libcxx as non-universal, and we might be done there.

comment:9 Changed 4 years ago by kencu (Ken)

Owner: set to kencu
Resolution: fixed
Status: newclosed

In df7162b64483ddce805c8a12bd9f16c0c714c0a4/macports-ports (master):

libcxx: fixes for Leopard

  1. disable ppc builds. These have never worked so

far other than very controlled, hand-modified setups.

Attempts to build libcxx on PPC inevitably failed and
resulted in tickets, so just disable it fully.

  1. on Intel, esp for Leopard, force universal archs of i386/x86_64.

These are the only archs that can build libcxx on
Leopard. We could disable universal completely
but libcxx builds well enough as i386/x86_64 and I know
there are users who are using libcxx on 64 bit leopard.

If one day we do enable libcxx to build on PPC, these
can be readdressed at that time.

closes: #62400
closes: #57911

comment:10 Changed 4 years ago by Wowfunhappy (Jonathan)

Wonderful, thank you! Sorry for not getting back to you with testing the first time Ken, I'd already started the VM building Squid via your first suggestion (configure.compiler=macports-gcc-7), and I'd wanted to let that finish first. But you were faster! :)

Note: See TracTickets for help on using tickets.