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

Build error with builtin iOS SQLite3 #27

Open
martinezguillaume opened this issue Jul 21, 2024 · 3 comments
Open

Build error with builtin iOS SQLite3 #27

martinezguillaume opened this issue Jul 21, 2024 · 3 comments

Comments

@martinezguillaume
Copy link

Hi ! It seems that when using this lib and using another lib that is using the SQLite3 from iOS SDK, the build produces an error:

❌  (ios/Pods/Headers/Public/sqlite3/sqlite3.h:7345:9)

  7343 |   /* The methods above are in versions 1 through 3 of the sqlite_module object.
  7344 |   ** Those below are for version 4 and greater. */
> 7345 |   int (*xIntegrity)(sqlite3_vtab *pVTab, const char *zSchema,
       |         ^ 'sqlite3_module::xIntegrity' from module 'sqlite3.sqlite3' is not present in definition of 'struct sqlite3_module' provided earlier
  7346 |                     const char *zTabName, int mFlags, char **pzErr);
  7347 | };
  7348 |

❌  (/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator17.5.sdk/usr/include/sqlite3ext.h:36:8)

  34 | ** libraries!
  35 | */
> 36 | struct sqlite3_api_routines {
     |        ^ type 'struct sqlite3_api_routines' has incompatible definitions in different translation units
  37 |   void * (*aggregate_context)(sqlite3_context*,int nBytes);
  38 |   int  (*aggregate_count)(sqlite3_context*);
  39 |   int  (*bind_blob)(sqlite3_stmt*,int,const void*,int n,void(*)(void*));

In my case, I'm using this pod called EXUpdates and this pod called AmazonChimeSDK resulting in this error.

I already fill an issue in the EXUpdates repo but maybe it belongs more to this repo I don't know. Thanks for the help 🙏

@simolus3
Copy link
Collaborator

If someone finds a proper solution for this that this pod could implement, I'd love to hear about it. As a workaround, I believe you can stop other pods from linking the system's sqlite3 like this:

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      xcconfig_path = config.base_configuration_reference.real_path
      xcconfig = File.read(xcconfig_path)
      new_xcconfig = xcconfig.sub(' -l"sqlite3"', '')
      File.open(xcconfig_path, "w") { |file| file << new_xcconfig }
    end
  end
end

I think the pods should still work since sqlite3 does end up being linked in your application thanks to the sqlite3 pod.

Other packages such as SQLite.swift come with a standalone subspec that doesn't declare sqlite3 as a library but instead depends on the pod as well. Maybe the other pods should do this as well, but it's annoying that there's no proper solution.

@martinezguillaume
Copy link
Author

martinezguillaume commented Jul 21, 2024

I'll try to see what we can do but yeah, this issue seems very common in my opinion. I'll try to investigate more

Your solution can be a great workaround but it doesn't work in my case, here is the content of the problematic pod config
Pods/Target Support Files/AmazonChimeSDK/AmazonChimeSDK.release.xcconfig

CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO
CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/AmazonChimeSDK
FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/AmazonChimeSDK" "${PODS_ROOT}/AmazonChimeSDKMedia" "${PODS_XCFRAMEWORKS_BUILD_DIR}/AmazonChimeSDK" "${PODS_XCFRAMEWORKS_BUILD_DIR}/AmazonChimeSDKMedia"
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS -import-underlying-module -Xcc -fmodule-map-file="${SRCROOT}/${MODULEMAP_FILE}"
PODS_BUILD_DIR = ${BUILD_DIR}
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE}
PODS_ROOT = ${SRCROOT}
PODS_TARGET_SRCROOT = ${PODS_ROOT}/AmazonChimeSDK
PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates
PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
SKIP_INSTALL = YES
SWIFT_INCLUDE_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/AmazonChimeSDKMedia"
USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES

there is no occurence of sqlite3 in that, not sure how this pod is functioning.
It is importing iOS system SQLite3 like this

Thanks for the help, I was so stuck in my side 🙏

@martinezguillaume
Copy link
Author

My other solution was to fork it and remove the system SQLite3 and instead using this lib. But I have so much trouble linking this forked pod dependency in my project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants