-
Notifications
You must be signed in to change notification settings - Fork 261
Description
I have done the following
- I have searched the existing issues
- If possible, I've reproduced the issue using the 'main' branch of this project
Steps to reproduce
- Create an Xcode project with a target that depends on Containerization
- Enable
SWIFT_TREAT_WARNINGS_AS_ERRORS = YESon the target - Build
The issue does not occur when building via SPM with .treatAllWarnings(as: .error).
To quickly reproduce this using Xcodegen:
mkdir -p /tmp/containerization-zstd-repro/Sources/MyLib
cat > /tmp/containerization-zstd-repro/Sources/MyLib/MyLib.swift << 'EOF'
import Containerization
public struct MyLib {
public init() {}
}
EOF
cat > /tmp/containerization-zstd-repro/project.yml << 'EOF'
name: ZstdRepro
options:
bundleIdPrefix: com.test
packages:
containerization:
url: https://github.com/apple/containerization
exactVersion: "0.25.1"
targets:
ZstdRepro:
type: framework
platform: macOS
deploymentTarget: "26.0"
sources:
- Sources/MyLib
dependencies:
- package: containerization
product: Containerization
settings:
SWIFT_TREAT_WARNINGS_AS_ERRORS: YES
EOF
cd /tmp/containerization-zstd-repro
xcodegen generate
xcodebuild -project ZstdRepro.xcodeproj -scheme ZstdRepro -destination 'platform=macOS' buildCurrent behavior
The build fails with errors originating from zstd's module.modulemap:
<unknown>:0: error: definition of configuration macro 'ZSTDLIB_VISIBLE' has no effect on the import of 'libzstd'; pass '-DZSTDLIB_VISIBLE=...' on the command line to configure the module
/Users/robbert/Library/Developer/Xcode/DerivedData/ZstdRepro-cmbtortrvhygntcubcdbmijtgeye/SourcePackages/checkouts/zstd/lib/zstd.h:33:13: note: macro was defined here
# define ZSTDLIB_VISIBLE __attribute__ ((visibility ("default")))
^
<unknown>:0: error: definition of configuration macro 'ZSTDLIB_HIDDEN' has no effect on the import of 'libzstd'; pass '-DZSTDLIB_HIDDEN=...' on the command line to configure the module
/Users/robbert/Library/Developer/Xcode/DerivedData/ZstdRepro-cmbtortrvhygntcubcdbmijtgeye/SourcePackages/checkouts/zstd/lib/zstd.h:41:13: note: macro was defined here
# define ZSTDLIB_HIDDEN __attribute__ ((visibility ("hidden")))
^
<unknown>:0: error: definition of configuration macro 'ZSTD_CLEVEL_DEFAULT' has no effect on the import of 'libzstd'; pass '-DZSTD_CLEVEL_DEFAULT=...' on the command line to configure the module
/Users/robbert/Library/Developer/Xcode/DerivedData/ZstdRepro-cmbtortrvhygntcubcdbmijtgeye/SourcePackages/checkouts/zstd/lib/zstd.h:134:11: note: macro was defined here
# define ZSTD_CLEVEL_DEFAULT 3
^
<unknown>:0: error: definition of configuration macro 'ZDICTLIB_VISIBLE' has no effect on the import of 'libzstd'; pass '-DZDICTLIB_VISIBLE=...' on the command line to configure the module
/Users/robbert/Library/Developer/Xcode/DerivedData/ZstdRepro-cmbtortrvhygntcubcdbmijtgeye/SourcePackages/checkouts/zstd/lib/zdict.h:28:13: note: macro was defined here
# define ZDICTLIB_VISIBLE __attribute__ ((visibility ("default")))
^
<unknown>:0: error: definition of configuration macro 'ZDICTLIB_HIDDEN' has no effect on the import of 'libzstd'; pass '-DZDICTLIB_HIDDEN=...' on the command line to configure the module
/Users/robbert/Library/Developer/Xcode/DerivedData/ZstdRepro-cmbtortrvhygntcubcdbmijtgeye/SourcePackages/checkouts/zstd/lib/zdict.h:36:13: note: macro was defined here
# define ZDICTLIB_HIDDEN __attribute__ ((visibility ("hidden")))
^
<unknown>:0: error: definition of configuration macro 'ZSTDERRORLIB_VISIBLE' has no effect on the import of 'libzstd'; pass '-DZSTDERRORLIB_VISIBLE=...' on the command line to configure the module
/Users/robbert/Library/Developer/Xcode/DerivedData/ZstdRepro-cmbtortrvhygntcubcdbmijtgeye/SourcePackages/checkouts/zstd/lib/zstd_errors.h:24:13: note: macro was defined here
# define ZSTDERRORLIB_VISIBLE __attribute__ ((visibility ("default")))
^
<unknown>:0: error: definition of configuration macro 'ZSTDERRORLIB_HIDDEN' has no effect on the import of 'libzstd'; pass '-DZSTDERRORLIB_HIDDEN=...' on the command line to configure the module
/Users/robbert/Library/Developer/Xcode/DerivedData/ZstdRepro-cmbtortrvhygntcubcdbmijtgeye/SourcePackages/checkouts/zstd/lib/zstd_errors.h:32:13: note: macro was defined here
# define ZSTDERRORLIB_HIDDEN __attribute__ ((visibility ("hidden")))
The root cause is fixed in facebook/zstd#4531, but Containerization pins zstd at exact: "1.5.7" which does not include the fix.
Expected behavior
Importing Containerization should not produce warnings, so that Xcode targets can use warnings-as-errors without issue.
Environment
- OS: macOS 26.3
- Xcode: 26.3
- Swift: 6.2Relevant log output
N/ACode of Conduct
- I agree to follow this project's Code of Conduct
Reactions are currently unavailable