Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix pod install for swift libs using new arch #38121

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion packages/react-native/ReactCommon/React-Fabric.podspec
Expand Up @@ -33,7 +33,8 @@ Pod::Spec.new do |s|
s.source = source
s.source_files = "dummyFile.cpp"
s.pod_target_xcconfig = { "USE_HEADERMAP" => "YES",
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17" }
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17",
"DEFINES_MODULE" => "YES" }

if ENV['USE_FRAMEWORKS']
s.header_mappings_dir = './'
Expand Down
3 changes: 2 additions & 1 deletion packages/react-native/ReactCommon/jsi/React-jsi.podspec
Expand Up @@ -36,7 +36,8 @@ Pod::Spec.new do |s|

s.header_dir = "jsi"
s.compiler_flags = folly_compiler_flags + ' ' + boost_compiler_flags
s.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/RCT-Folly\" \"$(PODS_ROOT)/DoubleConversion\"" }
s.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/RCT-Folly\" \"$(PODS_ROOT)/DoubleConversion\"",
"DEFINES_MODULE" => "YES" }

s.dependency "boost", "1.76.0"
s.dependency "DoubleConversion"
Expand Down
Expand Up @@ -27,7 +27,8 @@ Pod::Spec.new do |s|
s.source = source
s.source_files = "**/*.{cpp,h}"
s.header_dir = "react/debug"
s.pod_target_xcconfig = { "CLANG_CXX_LANGUAGE_STANDARD" => "c++17" }
s.pod_target_xcconfig = { "CLANG_CXX_LANGUAGE_STANDARD" => "c++17",
"DEFINES_MODULE" => "YES" }

if ENV['USE_FRAMEWORKS']
s.module_name = "React_debug"
Expand Down
Expand Up @@ -45,7 +45,9 @@ Pod::Spec.new do |s|
s.exclude_files = "tests"
s.pod_target_xcconfig = {
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17",
"HEADER_SEARCH_PATHS" => header_search_paths.join(' ')}
"HEADER_SEARCH_PATHS" => header_search_paths.join(' '),
"DEFINES_MODULE" => "YES"
}

if ENV['USE_FRAMEWORKS']
s.module_name = "React_rendererdebug"
Expand Down
Expand Up @@ -49,7 +49,9 @@ Pod::Spec.new do |s|
header_search_paths = header_search_paths + ["\"$(PODS_TARGET_SRCROOT)/platform/ios\""]
end

s.pod_target_xcconfig = { "USE_HEADERMAP" => "NO", "HEADER_SEARCH_PATHS" => header_search_paths.join(" ") }
s.pod_target_xcconfig = { "USE_HEADERMAP" => "NO",
"HEADER_SEARCH_PATHS" => header_search_paths.join(" "),
"DEFINES_MODULE" => "YES" }

s.dependency "glog"
s.dependency "RCT-Folly/Fabric", folly_version
Expand Down
Expand Up @@ -42,9 +42,9 @@ Pod::Spec.new do |s|
s.compiler_flags = folly_compiler_flags
s.header_dir = "react/utils"
s.exclude_files = "tests"
s.pod_target_xcconfig = {
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17",
"HEADER_SEARCH_PATHS" => header_search_paths.join(' ')}
s.pod_target_xcconfig = { "CLANG_CXX_LANGUAGE_STANDARD" => "c++17",
"HEADER_SEARCH_PATHS" => header_search_paths.join(' '),
"DEFINES_MODULE" => "YES" }

if ENV['USE_FRAMEWORKS']
s.module_name = "React_utils"
Expand Down
2 changes: 1 addition & 1 deletion packages/react-native/scripts/react_native_pods.rb
Expand Up @@ -139,7 +139,7 @@ def use_react_native! (
pod 'Yoga', :path => "#{prefix}/ReactCommon/yoga", :modular_headers => true

pod 'DoubleConversion', :podspec => "#{prefix}/third-party-podspecs/DoubleConversion.podspec"
pod 'glog', :podspec => "#{prefix}/third-party-podspecs/glog.podspec"
pod 'glog', :podspec => "#{prefix}/third-party-podspecs/glog.podspec", :modular_headers => true
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When adding "DEFINES_MODULE" => "YES" to s.pod_target_xcconfig in packages/react-native/third-party-podspecs/glog.podspec I still get the following error:

[!] The following Swift pods cannot yet be integrated as static libraries:

The Swift pod `MyNativeView` depends upon `glog`, which does not define modules. To opt into those targets generating module maps (which is necessary to import them from Swift when building as static libraries), you may set `use_modular_headers!` globally in your Podfile, or specify `:modular_headers => true` for particular dependencies.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, glog is a different beast as it is a c++ library we don't own and that does not actually support Cocoapods. So we are doing some black magic to make it work.

pod 'boost', :podspec => "#{prefix}/third-party-podspecs/boost.podspec"
pod 'RCT-Folly', :podspec => "#{prefix}/third-party-podspecs/RCT-Folly.podspec", :modular_headers => true

Expand Down