1

While compiling an application from linux, the flutter_secure_storage package gives an error.

error Image

Error:-

Launching lib/main.dart on Linux in debug mode...
main.dart:1
CMake Error at /snap/flutter/130/usr/share/cmake-3.16/Modules/FindPkgConfig.cmake:463 (message):
  A required package was not found
Call Stack (most recent call first):
  /snap/flutter/130/usr/share/cmake-3.16/Modules/FindPkgConfig.cmake:643 (_pkg_check_modules_internal)
  flutter/ephemeral/.plugin_symlinks/flutter_secure_storage_linux/linux/CMakeLists.txt:14 (pkg_check_modules)


Exception: Unable to generate build files
Exited (sigterm)

I tried the following commands.

flutter clean && flutter pub get

sudo apt install libsecret-1-dev libsecret-tools libsecret-1-0
vimuth
  • 5,064
  • 33
  • 79
  • 116
  • Which version of libsecret do you have? It has a constaint. Also, it appears to need jsoncpp. `pkg_check_modules(LIBSECRET REQUIRED IMPORTED_TARGET libsecret-1>=0.18.4) pkg_check_modules(JSONCPP REQUIRED IMPORTED_TARGET jsoncpp)` – Richard Heap Mar 26 '23 at 12:33
  • @RichardHeap please tell me how i can install libsecret 0.18.4 version – karan duggal Mar 27 '23 at 14:28
  • same way you do anything. First check what version you have. Try looking in /usr/share/doc - do you see libsecret? Mine says 0.18.5 which would presumably satisfy that criterion. Then check how to install jsoncpp for your distro. – Richard Heap Mar 27 '23 at 14:59
  • i have libsecret-1, libsecret-1-0, libsecret-dev, libsecret-tools version of libsecret. i am using ubuntu 22.04 i try to install libsecret-0.18.4 by ``` sudo apt install libsecret-0.18.4 ``` i get ``` – karan duggal Mar 27 '23 at 15:27
  • The current version on Ubuntu of libsecret-1 appears to be 0.20.x which should satisfy >=0.18.4. Have you also installed jsoncpp? – Richard Heap Mar 27 '23 at 15:59

1 Answers1

1

i just found a solution to this problem what work for me is the following: change "pkg_check_modules(LIBSECRET REQUIRED IMPORTED_TARGET libsecret>=0.18.4)" to "pkg_check_modules(LIBSECRET REQUIRED IMPORTED_TARGET libsecret-1>=0.18.4)" in "your_app/linux/flutter/ephemeral/.plugin_symlink/flutter_secure_storage_linux/linux/CMakeLists.txt"

u can also install jsoncpp-dev

then run $flutter clean $flutter run -d linux

Karim-azem
  • 11
  • 2