-
Notifications
You must be signed in to change notification settings - Fork 249
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
CMake Error at flutter/ephemeral/.plugin_symlinks/amplify_db_common/windows/CMakeLists.txt:54 (add_library): add_library cannot create target "sqlite3" because an imported target with the same name already exists. #5477
Comments
Hi @richard457, can you give specific reproduction steps? What are you doing to produce this error? |
Create a simple flutter project, add amplify_storage_s3: ^2.4.1 and powersync: ^1.8.2 or any other plugin that uses sqlite3 the compile the app for windows, I think I checking in amplify_db_common and realized that we are using sqlite3 as name which will conflict with other sqlite3 packages out there # The Flutter tooling requires that developers have a version of Visual Studio
# installed that includes CMake 3.14 or later. You should not increase this
# version, as doing so will cause the plugin to fail to compile for some
# customers of the plugin.
cmake_minimum_required(VERSION 3.14)
# Project-level configuration.
set(PROJECT_NAME "amplify_db_common")
project(${PROJECT_NAME} LANGUAGES C CXX)
# This value is used when generating builds using this plugin, so it must
# not be changed
set(PLUGIN_NAME "amplify_db_common_plugin")
add_library(${PLUGIN_NAME} SHARED
"amplify_db_common_plugin.cpp"
)
###
# Below here, keep in sync with: https://github.com/simolus3/sqlite3.dart/blob/main/sqlite3_flutter_libs/windows/CMakeLists.txt
###
# Essentially, the idea of this build script is to compile a sqlite3.dll
# and make Fluter bundle that with the final app.
# It looks like we can't avoid building a sqlite3_flutter_libs.dll too,
# but that's not on me.
apply_standard_settings(${PLUGIN_NAME})
set_target_properties(${PLUGIN_NAME} PROPERTIES
CXX_VISIBILITY_PRESET hidden)
target_compile_definitions(${PLUGIN_NAME} PRIVATE FLUTTER_PLUGIN_IMPL)
target_include_directories(${PLUGIN_NAME} INTERFACE
"${CMAKE_CURRENT_SOURCE_DIR}/include")
target_link_libraries(${PLUGIN_NAME} PRIVATE flutter flutter_wrapper_plugin)
include(FetchContent)
if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.24.0")
# cmake 3.24.0 added the `DOWNLOAD_EXTRACT_TIMESTAMP` and prints an ugly warning when
# the default is used, so override it to the recommended behavior.
# We can't really ask users to use a cmake that recent, so there's this if here.
FetchContent_Declare(
sqlite3
URL https://sqlite.org/2023/sqlite-autoconf-3430000.tar.gz
DOWNLOAD_EXTRACT_TIMESTAMP NEW
)
else()
FetchContent_Declare(
sqlite3
URL https://sqlite.org/2023/sqlite-autoconf-3430000.tar.gz
)
endif()
FetchContent_MakeAvailable(sqlite3)
# add_library(sqlite3 SHARED "sqlite3_flutter.c")
target_include_directories(sqlite3 PRIVATE "${sqlite3_SOURCE_DIR}")
target_compile_options(sqlite3 PRIVATE "$<$<NOT:$<CONFIG:Debug>>:-O2>" "/w")
# Note: Keep in sync with https://github.com/simolus3/sqlite-native-libraries/blob/master/sqlite3-native-library/cpp/CMakeLists.txt
target_compile_definitions(sqlite3 PRIVATE
SQLITE_ENABLE_FTS5
SQLITE_ENABLE_RTREE
SQLITE_DQS=0
SQLITE_DEFAULT_MEMSTATUS=0
SQLITE_TEMP_STORE=2
SQLITE_MAX_EXPR_DEPTH=0
SQLITE_OMIT_AUTHORIZATION
SQLITE_OMIT_DECLTYPE
SQLITE_OMIT_DEPRECATED
SQLITE_OMIT_GET_TABLE
SQLITE_OMIT_LOAD_EXTENSION
SQLITE_OMIT_PROGRESS_CALLBACK
SQLITE_OMIT_SHARED_CACHE
SQLITE_OMIT_TCL_VARIABLE
SQLITE_OMIT_TRACE
SQLITE_USE_ALLOCA
SQLITE_UNTESTABLE
SQLITE_HAVE_ISNAN
SQLITE_HAVE_LOCALTIME_R
SQLITE_HAVE_LOCALTIME_S
)
# Ensure sqlite3 actually gets build
add_dependencies(${PLUGIN_NAME} sqlite3)
# List of absolute paths to libraries that should be bundled with the plugin
set(amplify_db_common_bundled_libraries
"$<TARGET_FILE:sqlite3>"
PARENT_SCOPE
) |
@richard457 Thanks for sharing. We'll investigate and let you know what we find. |
@Equartey any update? |
@richard457 I've been able to reproduce the error. Currently investigating a solution. I'll you know when more progress has been made. |
Thank you for update @Equartey We really appreciate your support, we are patiently waiting. |
Hi @richard457, apologies for the delay. A fix for this has been merged. We will notify you when it has been released! |
I installed the update but the error still persists
https://github.com/yegobox/flipper/actions/runs/11630194715/job/32388623308 cc @Equartey |
Hi @richard457, our sincere apologies that you are still facing this issue. For clarification, you upgraded to the latest version 2.5.0 of amplify-flutter, yet nothing changed?. |
That's correct - I have upgraded to amplify-flutter 2.5.0 and still get the same compile error on Windows, too. 🥺😢 |
Thank you, @ekjotmultani - we sincerely appreciate your assistance with this. 🙏🏽 |
Yes I upgraded to 2.5.0 and it is still the same. |
Hi @richard457, sorry for the delay. I was reviewing the build log you provided and noticed you have had subsequent clean builds. Can you confirm if you are still facing this issue or resolved it another way? |
The issue continues to be a problem that needs urgent attention. |
@richard457, I have a potential fix. Can you verify it works before we release it? You can do this by adding a dependency_overrides:
amplify_db_common:
git:
url: https://github.com/aws-amplify/amplify-flutter.git
ref: fix/windows-cmake-namespace
path: packages/common/amplify_db_common
fetch: fix/windows-cmake-namespace |
Dreams really do come true! 😃 I just tried your fix and I can confirm that YES I can finally compile one again for Windows. 👍🏽 Thanks so very much resolving this, @Equartey @ekjotmultani ! Most sincerely appreciated. 🙏🏽 |
@veganguy awesome! I'm still working on fixing the failing tests. You're welcome to continue to use the override I supplied. Changes I make to fix tests might cause unexpected breakage. In such a case, consider changing the override dependency_overrides:
amplify_db_common:
git:
url: https://github.com/aws-amplify/amplify-flutter.git
ref: 9010ff4e2470e086d469af1ad1ecb61f9054e6b7
path: packages/common/amplify_db_common
fetch: 9010ff4e2470e086d469af1ad1ecb61f9054e6b7 Thanks again for your patience. Once the fix gets released we will notify yall here. |
Thanks for that! And thank you, @Equartey, once again for your most-appreciated assistance. |
Hi @richard457 @veganguy, this has been fixed in Locate your
Please let me know if you have any issues. |
@Equartey Tested both set(USE_CUSTOM_SQLITE3 ON) and override, the project can now compile, question do I need both override and set(USE_CUSTOM_SQLITE3 ON) ? |
@richard457 Awesome! You no longer need the pubspec override if you are consuming I'm going to close this issue as resolved. If you have any more questions don't hesitate to reach out. |
This issue is now closed. Comments on closed issues are hard for our team to see. |
Description
CMake Error at flutter/ephemeral/.plugin_symlinks/amplify_db_common/windows/CMakeLists.txt:54 (add_library):
add_library cannot create target "sqlite3" because an imported target with
the same name already exists.
Categories
Steps to Reproduce
CMake Error at flutter/ephemeral/.plugin_symlinks/amplify_db_common/windows/CMakeLists.txt:54 (add_library):
add_library cannot create target "sqlite3" because an imported target with
the same name already exists.
Screenshots
No response
Platforms
Flutter Version
3.24
Amplify Flutter Version
2.0
Deployment Method
Amplify Gen 2
Schema
No response
The text was updated successfully, but these errors were encountered: