Opened 2 years ago

Closed 23 months ago

#65908 closed defect (fixed)

lzma @22.01_0 does not use MacPorts CFLAGS/CXXFLAGS

Reported by: RobK88 Owned by: ryandesign (Ryan Carsten Schmidt)
Priority: Normal Milestone:
Component: ports Version: 2.7.2
Keywords: lion mountainlion Cc: chillin-, judaew (Vadym-Valdis Yudaiev), mascguy (Christopher Nielsen), barracuda156
Port: lzma

Description (last modified by RobK88)

I am unable to upgrade lzma due to a cxx_stdlib mismatch. In other words, lzma is using libstdc++ (this installation is configured to use libc++).

--->  Found 1 broken port, determining rebuild order
--->  Rebuilding in order
     lzma @22.01_0
--->  Computing dependencies for lzma
--->  Fetching distfiles for lzma
--->  Verifying checksums for lzma
--->  Extracting lzma
--->  Applying patches to lzma
--->  Configuring lzma
--->  Building lzma
--->  Staging lzma into destroot                         
--->  Unable to uninstall lzma @22.01_0, the following ports depend on it:
--->  	boost171 @1.71.0_5+no_single+no_static+python310
--->  	boost176 @1.76.0_5+no_single+no_static+python310
Warning: Uninstall forced.  Proceeding despite dependencies.
--->  Deactivating lzma @22.01_0
--->  Cleaning lzma
--->  Uninstalling lzma @22.01_0
--->  Cleaning lzma
--->  Computing dependencies for lzma
--->  Installing lzma @22.01_0
--->  Activating lzma @22.01_0
--->  Cleaning lzma
--->  Scanning binaries for linking errors
--->  No broken files found.                             
Error: Port lzma is still broken (cxx_stdlib mismatch) after rebuilding it more than 3 times.
Error: Please run port -d -y rev-upgrade and use the output to report a bug.
Error: rev-upgrade failed: Port lzma still broken after rebuilding 3 times
Error: Follow https://guide.macports.org/#project.tickets if you believe there is a bug.
--->  Some of the ports you installed have notes:
  lzma has the following notes:
    The LZMA SDK program is installed as "lzma_alone", to avoid conflict with LZMA Utils

See the attachment for the output of sudo port -d -y rev-upgrade.

Attachments (3)

rev-upgrade_output.txt (72.4 KB) - added by RobK88 2 years ago.
Portfile (3.4 KB) - added by judaew (Vadym-Valdis Yudaiev) 2 years ago.
lzma_Rosetta.log (67.7 KB) - added by barracuda156 2 years ago.

Download all attachments as: .zip

Change History (24)

Changed 2 years ago by RobK88

Attachment: rev-upgrade_output.txt added

comment:1 Changed 2 years ago by RobK88

Description: modified (diff)

comment:2 Changed 2 years ago by RobK88

Using a more modern compiler is the workaround until the port is fixed.

bash-3.2$ sudo port clean lzma
Password:
--->  Cleaning lzma
bash-3.2$ 
bash-3.2$ sudo port upgrade lzma configure.compiler=macports-clang-9.0
--->  Computing dependencies for lzma
--->  Fetching distfiles for lzma
--->  Verifying checksums for lzma
--->  Extracting lzma
--->  Applying patches to lzma
--->  Configuring lzma
--->  Building lzma
--->  Staging lzma into destroot                         
--->  Unable to uninstall lzma @22.01_0, the following ports depend on it:
--->  	boost171 @1.71.0_5+no_single+no_static+python310
--->  	boost176 @1.76.0_5+no_single+no_static+python310
Warning: Uninstall forced.  Proceeding despite dependencies.
--->  Deactivating lzma @22.01_0
--->  Cleaning lzma
--->  Uninstalling lzma @22.01_0
--->  Cleaning lzma
--->  Computing dependencies for lzma
--->  Installing lzma @22.01_0
--->  Activating lzma @22.01_0
--->  Cleaning lzma
--->  Scanning binaries for linking errors
--->  No broken files found.                             
--->  No broken ports found.
--->  Some of the ports you installed have notes:
  lzma has the following notes:
    The LZMA SDK program is installed as "lzma_alone", to avoid conflict with LZMA Utils
bash-3.2$ 
bash-3.2$ sudo port rev-upgrade
--->  Scanning binaries for linking errors
--->  No broken files found.                             
--->  No broken ports found.
bash-3.2$

comment:3 Changed 2 years ago by chillin-

Cc: chillin- added

comment:4 Changed 2 years ago by chillin-

I am cautiously optimistic that I have the same issue on macmini5,1 w/ OS X 10.8.5, Mountain Lion and Xcode 5.1.1. Please let me know only if this is a different issue

lzma is using libstdc++ (this installation is configured to use libc++)
Error: Port lzma is still broken (cxx_stdlib mismatch) after rebuilding it more than 3 times.
Error: Please run port -d -y rev-upgrade and use the output to report a bug.
Error: rev-upgrade failed: Port lzma still broken after rebuilding 3 times
Error: Follow https://guide.macports.org/#project.tickets if you believe there
is a bug.
--->  Some of the ports you installed have notes:
lzma has the following notes:
The LZMA SDK program is installed as "lzma_alone", to avoid conflict with
LZMA Utils

The following installed ports are outdated:
lzma22.01_0 < 22.01_0  (C++ stdlib libstdc++ != libc++)

comment:5 Changed 2 years ago by RobK88

Yes, it looks like the same issue that I was having on Lion 10.7.5.

Try building with a more modern compiler (e.g. clang-9.0). It will probably build just fine.

e.g sudo port upgrade lzma configure.compiler=macports-clang-9.0

Last edited 2 years ago by RobK88 (previous) (diff)

comment:6 Changed 2 years ago by chillin-

Thanks Rob, that worked, but I am unclear on why this install isn't building with clang9 by default. It's certainly critical that I understand, but this was new to me. Thanks again.

Version 0, edited 2 years ago by chillin- (next)

comment:7 Changed 2 years ago by RobK88

I have not had time to dig into the source code to figure out what is going on. When ports do not build on old macOS's like Lion and Mountain Lion, it is a good idea to try again using a more modern compiler. e.g. Clang-7.0 or newer. That often fixes the problem.

Unfortunately, most of the MacPorts developers do not have time (or even an old Mac running an old MacOS) to fix build problems on old Macs.

So using a newer compiler is not really a fix but a workaround to the problem.

comment:8 in reply to:  7 Changed 2 years ago by ryandesign (Ryan Carsten Schmidt)

Cc: ryandesign removed
Keywords: mountainlion added
Owner: set to ryandesign
Status: newaccepted

Replying to chillin-:

I am unclear on why this install isn't building with clang9 by default.

Because this port does not require such a new compiler.

Rather, this port's build system fails to pass some compiler flags on when it needs to. Xcode versions of clang from OS X 10.8 and earlier default to using libstdc++, whereas MacPorts switched some years ago to default to libc++ on those systems. In the absence of the required flags, the build system erroneously builds the port for libstdc++ when we want it to build for libc++.

Newer MacPorts clang versions default to using libc++ which is a workaround you can use but not something I will commit to the port because it's overkill. Instead, I'll fix the build system to pass along the flags. This will fix not only this problem but other as-yet-unreported problems as well.

Replying to RobK88:

Unfortunately, most of the MacPorts developers do not have time (or even an old Mac running an old MacOS) to fix build problems on old Macs.

It is not necessary to use an old Mac or an old OS X version to verify that the problem exists nor whether one has succeeded in fixing it; it suffices to examine the build log on any macOS version to see whether the -stdlib flags are present everywhere they need to be (on every C++ compiler and linker invocation). I can see by looking at the logs from the buildbot that the -stdlib flag hasn't been used anywhere, and neither have the optimization flags we want to use. (It has instead used -O2.)

comment:9 Changed 2 years ago by ryandesign (Ryan Carsten Schmidt)

I'll also point out that I fixed this in 2018 and then last week somebody else updated the port and removed my work.

comment:10 in reply to:  9 ; Changed 2 years ago by mascguy (Christopher Nielsen)

Cc: judaew added

Replying to ryandesign:

I'll also point out that I fixed this in 2018 and then last week somebody else updated the port and removed my work.

Adding @judaew for awareness.

comment:11 Changed 2 years ago by mascguy (Christopher Nielsen)

Cc: mascguy added

comment:12 Changed 2 years ago by mascguy (Christopher Nielsen)

Replying to RobK88:

Unfortunately, most of the MacPorts developers do not have time (or even an old Mac running an old MacOS) to fix build problems on old Macs.

There's no need to keep an old Mac around, at least for Intel-based macOS releases 10.5 and later: They all run beautifully in VMs - particularly via Parallels - and a number of us do just that.

It's more a matter of issue prioritization, as most of our users run on the latest macOS releases. But we do go back and fix such issues, it simply takes time to get to them all.

Last edited 2 years ago by mascguy (Christopher Nielsen) (previous) (diff)

comment:13 in reply to:  10 Changed 2 years ago by mascguy (Christopher Nielsen)

Replying to ryandesign:

I'll also point out that I fixed this in 2018 and then last week somebody else updated the port and removed my work.

Ryan, this is my bad, as I merged the PR. And despite testing across-the-board prior, I still managed to miss the stdlib issue. Ugh, sorry folks!

Last edited 2 years ago by mascguy (Christopher Nielsen) (previous) (diff)

comment:14 Changed 2 years ago by judaew (Vadym-Valdis Yudaiev)

Between versions 4.65 and 22.01 there have been many changes in the build.

21.07: Some minor changes and fixes.
21.06: The bug in LZMA encoding function was fixed.
21.03 beta: LZMA dicrionary up to 4 GB. Speed optimizations.
21.02 alpha: macOS and Linux support. Speed optimizations.
19.00: Encryption strength for 7z archives was increased.
18.06: Some speed optimiztions in LZMA/LZMA2 code.
18.05: Some speed optimiztions in LZMA/LZMA2 code.
18.01: Some changes in LZMA2/xz multithreading code for compressing. Some bugs were fixed.
9.35: AES code and SFXs modules were included to SDK.
9.20: New small SFX module for installers.
9.11: PPMd support.
9.04: LZMA2 and XZ support.
4.62: LZMA SDK is placed in the public domain.

In version 4.65, the project was built from the LZMA_Alone directory via makefile.gcc, which had options for CXX, CXX_C, and so on. Through these options, MacPorts used via patch. Now in version 22.01, the project is built from the LzmaCon directory and the makefile.gcc file doesn't have such options. The file is only a list of object files.

comment:15 in reply to:  14 Changed 2 years ago by judaew (Vadym-Valdis Yudaiev)

... Now in version 22.01, the project is built from the LzmaCon directory and the makefile.gcc file doesn't have such options. The file is only a list of object files.

It looks like the developer have moved all of these options into a separate files outside of the LzmaCon directory. These are cmpl_clang.mak which included var_clang.mak, warn_clang_mac.mak and Build.mak and so on. I don't know how to force the required flags to be used here.

Changed 2 years ago by judaew (Vadym-Valdis Yudaiev)

Attachment: Portfile added

comment:16 Changed 2 years ago by barracuda156

Also fails on Rosetta:

ld: warning: in _o/7zCrc.o, file was built for unsupported file format which is not the architecture being linked (ppc)
…
ld: warning: in _o/Bench.o, file was built for unsupported file format which is not the architecture being linked (ppc)
Undefined symbols:
  "_main", referenced from:
      start in crt1.10.5.o
ld: symbol(s) not found

Last edited 2 years ago by barracuda156 (previous) (diff)

Changed 2 years ago by barracuda156

Attachment: lzma_Rosetta.log added

comment:17 in reply to:  12 Changed 2 years ago by ryandesign (Ryan Carsten Schmidt)

Cc: barracuda156 added
Summary: lzma @22.01_0 - Unable to upgrade lzma - cxx_stdlib mismatchlzma @22.01_0 does not use MacPorts CFLAGS/CXXFLAGS

Has duplicate #66130.

comment:18 Changed 2 years ago by rmottola (Riccardo)

I have the same issue, I am bonking my head. First, I suggest using "-s" as port option, to actually force a build and not use the binary - which apparently is also broken.

I tried on 10.7 gcc 6, gcc 12 and I got the error. Only using clang 6 fixed it.

From what I remember and ask Ken gcc6 was fine.

comment:19 Changed 2 years ago by kencu (Ken)

clang-6 fixes it for some because I changed the stdlib default in clang-5+ to match the MacPorts cxx_stdlib setting, therefore the defaults help. gcc6 won't fix this on Intel systems set up to build for libc++.

Just have to get those build flags MacPorts' sets onto the build lines again... eg <https://github.com/macports/macports-ports/commit/536ead384df3ad8539bde8d02082a0aa5edf55be>

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

comment:21 Changed 23 months ago by kencu (Ken)

Resolution: fixed
Status: acceptedclosed

In ae7da160dec868a4b80c09a5c59c2f0965a247d6/macports-ports (master):

lzma: obey macports cc and cxx flags

fixes universal builds, amongst other things
closes: #65908

Note: See TracTickets for help on using tickets.