Error: "xcodebuild redefinition of 'sqlite3_xxx'" when building fresh expo project #70
-
ProblemCan't build expo app, get a bunch of errors like
Also get a warning when I run expo-doctor about this package being 'Untested on New Architecture' Steps to reproduce
|
Beta Was this translation helpful? Give feedback.
Replies: 10 comments 4 replies
-
Having this problem as well when using eas build |
Beta Was this translation helpful? Give feedback.
-
Hey @felixsebastian and @histefhere {
"expo.updates.useThirdPartySQLitePod": "true"
} For more details, you can refer to the discussion in Expo issue #30546. Let us know if this works for you. |
Beta Was this translation helpful? Give feedback.
-
I'm confused because I see the original developer list the fix as:
Is the correct syntax what you have provided @mugikhan ? My issue pertains to an error starting with ` 37 | #include <regex.h>
Platform: ios Target OS: 15.1 I reinstalled pods, changed configs, took out any db interactions I had, etc. however, I still come to the same problem. It's actually a problem with |
Beta Was this translation helpful? Give feedback.
-
@DeliveranceTechSolutions My statement is correct, I have tested it personally and it works. It also aligns with what is currently in the Expo package See here. Is there any other packages you are using that could be providing sqlite3 maybe |
Beta Was this translation helpful? Give feedback.
-
After running prebuild I added { Build failed: The "Run fastlane" step failed because of an error in the Xcode build process. We automatically detected following errors in your Xcode build logs: |
Beta Was this translation helpful? Give feedback.
-
I tested this locally and on EAS build. Adding my findings here for context. I ran the following to create a fresh app.
For me this did not give any errors. The app launched after building. Since this issue is related to multiple definitions of SQLite, I manually added I followed the steps recommended by Mugi of adding the settings to my For some background: It seems like @histefhere I'd start by verifying the |
Beta Was this translation helpful? Give feedback.
-
Here's what I had to do to get powersync working with expo 52:
{
- "ios.deploymentTarget": "15.5"
+ "ios.deploymentTarget": "15.5",
+ "expo.updates.useThirdPartySQLitePod": "true"
}
puts "config_command: #{config_command}"
+ pre_install do |installer|
+ installer.pod_targets.each do |pod|
+ next unless pod.name.eql?('react-native-quick-sqlite')
+
+ def pod.build_type
+ Pod::BuildType.static_library
+ end
+ end
+ end
+
config = use_native_modules!(config_command)
- "@journeyapps/react-native-quick-sqlite": "^1.4.0",
+ "@journeyapps/react-native-quick-sqlite": "^2.2.1", |
Beta Was this translation helpful? Give feedback.
-
I created a config plugin for this:
and then in your app.json
put it in a plugins/ directory in you app root ... Works like a dream (-: /Stephen. |
Beta Was this translation helpful? Give feedback.
-
The custom config plugin which enables Also note that #79 (released in version I'm not entirely sure about the exact circumstances when |
Beta Was this translation helpful? Give feedback.
-
for anyone who also needs the pre_install code that @G2Jose posted and doesn't want to eject /* eslint-disable */
const { withDangerousMod } = require("@expo/config-plugins");
const fs = require("fs");
const path = require("path");
/**
* Expo config plugin to configure op-sqlite as static library
* This fixes SQLite redefinition conflicts by:
* 1. Making expo-updates use third-party SQLite pod
* 2. Configuring op-sqlite as static library
* Based on G2Jose's solution: https://github.com/powersync-ja/react-native-quick-sqlite/discussions/70
*/
function withSQLiteStaticLibrary(config) {
return withDangerousMod(config, [
"ios",
async (config) => {
const podfilePath = path.join(
config.modRequest.platformProjectRoot,
"Podfile",
);
const podfilePropertiesPath = path.join(
config.modRequest.platformProjectRoot,
"Podfile.properties.json",
);
// 1. Update Podfile.properties.json to use third-party SQLite pod
if (fs.existsSync(podfilePropertiesPath)) {
let podfileProperties = JSON.parse(fs.readFileSync(podfilePropertiesPath, "utf8"));
// Add the useThirdPartySQLitePod setting
podfileProperties["expo.updates.useThirdPartySQLitePod"] = "true";
fs.writeFileSync(podfilePropertiesPath, JSON.stringify(podfileProperties, null, 2));
}
// 2. Add pre_install hook to configure op-sqlite as static library
if (fs.existsSync(podfilePath)) {
let podfileContent = fs.readFileSync(podfilePath, "utf8");
// Check if our pre_install hook is already present
if (!podfileContent.includes("Fix for SQLite conflicts")) {
// Find the target insertion point (after prepare_react_native_project!)
const insertionPoint = "prepare_react_native_project!";
const insertionIndex = podfileContent.indexOf(insertionPoint);
if (insertionIndex !== -1) {
const endOfLine = podfileContent.indexOf("\n", insertionIndex) + 1;
const preInstallHook = `
# Fix for SQLite conflicts: Configure op-sqlite as static library
pre_install do |installer|
installer.pod_targets.each do |pod|
if pod.name.eql?('op-sqlite')
def pod.build_type
Pod::BuildType.static_library
end
end
end
end
`;
podfileContent =
podfileContent.slice(0, endOfLine) +
preInstallHook +
podfileContent.slice(endOfLine);
fs.writeFileSync(podfilePath, podfileContent);
}
}
}
return config;
},
]);
}
module.exports = withSQLiteStaticLibrary; add |
Beta Was this translation helpful? Give feedback.
Here's what I had to do to get powersync working with expo 52:
Podfile.properties.json
Podfile
with apre_install
step:@journeyapps/react-native-quick-sqlite
inpackage.json