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

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

Open
2 of 14 tasks
richard457 opened this issue Sep 18, 2024 · 13 comments
Assignees
Labels
bug Something is not working; the issue has reproducible steps and has been reproduced storage Issues related to the Storage Category windows

Comments

@richard457
Copy link

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

  • Analytics
  • API (REST)
  • API (GraphQL)
  • Auth
  • Authenticator
  • DataStore
  • Notifications (Push)
  • Storage

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

  • iOS
  • Android
  • Web
  • macOS
  • Windows
  • Linux

Flutter Version

3.24

Amplify Flutter Version

2.0

Deployment Method

Amplify Gen 2

Schema

No response

@github-actions github-actions bot added pending-triage This issue is in the backlog of issues to triage pending-maintainer-response Pending response from a maintainer of this repository labels Sep 18, 2024
@Equartey
Copy link
Member

Hi @richard457, can you give specific reproduction steps? What are you doing to produce this error?

@Equartey Equartey added storage Issues related to the Storage Category windows and removed pending-maintainer-response Pending response from a maintainer of this repository labels Sep 18, 2024
@richard457
Copy link
Author

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
)

@Equartey

@github-actions github-actions bot added the pending-maintainer-response Pending response from a maintainer of this repository label Sep 18, 2024
@Equartey
Copy link
Member

@richard457 Thanks for sharing. We'll investigate and let you know what we find.

@github-actions github-actions bot removed the pending-maintainer-response Pending response from a maintainer of this repository label Sep 19, 2024
@Equartey Equartey added bug Something is not working; the issue has reproducible steps and has been reproduced and removed pending-triage This issue is in the backlog of issues to triage labels Sep 19, 2024
@Equartey Equartey self-assigned this Sep 19, 2024
@richard457
Copy link
Author

@Equartey any update?

@github-actions github-actions bot added the pending-maintainer-response Pending response from a maintainer of this repository label Sep 21, 2024
@Equartey
Copy link
Member

@richard457 I've been able to reproduce the error. Currently investigating a solution. I'll you know when more progress has been made.

@github-actions github-actions bot removed the pending-maintainer-response Pending response from a maintainer of this repository label Sep 24, 2024
@richard457
Copy link
Author

Thank you for update @Equartey We really appreciate your support, we are patiently waiting.

@github-actions github-actions bot added the pending-maintainer-response Pending response from a maintainer of this repository label Sep 26, 2024
@khatruong2009 khatruong2009 removed the pending-maintainer-response Pending response from a maintainer of this repository label Sep 26, 2024
@Equartey Equartey added the pending-release Issues that have been addressed in main but have not been released label Oct 29, 2024
@Equartey
Copy link
Member

Hi @richard457, apologies for the delay. A fix for this has been merged. We will notify you when it has been released!

@richard457
Copy link
Author

richard457 commented Nov 1, 2024

I installed the update but the error still persists

.plugin_symlinks/amplify_db_common/windows".
  See documentation for policy CMP0002 for more details.
Unable to generate build files

https://github.com/yegobox/flipper/actions/runs/11630194715/job/32388623308 cc @Equartey

@github-actions github-actions bot added the pending-maintainer-response Pending response from a maintainer of this repository label Nov 1, 2024
@ekjotmultani
Copy link
Member

ekjotmultani commented Nov 1, 2024

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?.

@github-actions github-actions bot removed the pending-maintainer-response Pending response from a maintainer of this repository label Nov 1, 2024
@veganguy
Copy link

veganguy commented Nov 1, 2024

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. 🥺😢

@github-actions github-actions bot added the pending-maintainer-response Pending response from a maintainer of this repository label Nov 1, 2024
@ekjotmultani
Copy link
Member

Thank you @veganguy for the update. We will investigate further into this issue and the fix.

@github-actions github-actions bot removed the pending-maintainer-response Pending response from a maintainer of this repository label Nov 1, 2024
@veganguy
Copy link

veganguy commented Nov 1, 2024

Thank you, @ekjotmultani - we sincerely appreciate your assistance with this. 🙏🏽

@github-actions github-actions bot added the pending-maintainer-response Pending response from a maintainer of this repository label Nov 1, 2024
@ekjotmultani ekjotmultani removed the pending-maintainer-response Pending response from a maintainer of this repository label Nov 1, 2024
@richard457
Copy link
Author

Yes I upgraded to 2.5.0 and it is still the same.

@github-actions github-actions bot added the pending-maintainer-response Pending response from a maintainer of this repository label Nov 2, 2024
@tyllark tyllark removed pending-maintainer-response Pending response from a maintainer of this repository pending-release Issues that have been addressed in main but have not been released labels Nov 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is not working; the issue has reproducible steps and has been reproduced storage Issues related to the Storage Category windows
Projects
None yet
Development

No branches or pull requests

6 participants