Friday, October 29, 2021

[SOLVED] Could not find a package configuration file provided by "openssl"

Issue

I'm trying to use OpenSSL with Flutter using dart:ffi, but when i run the project on Ubuntu 20.04 the error message as below comes out. I tested the project on Windows 10 and it worked.

Project repository

CMakeLists.txt

cmake_minimum_required(VERSION 3.6)
project(flutter_openssl_crypto)

find_package(openssl REQUIRED CONFIG)

add_library(${PROJECT_NAME} SHARED empty.c)
target_link_libraries(${PROJECT_NAME} PRIVATE openssl::crypto)

Error

CMakeLists.txt:6 (find_package):
    Could not find a package configuration file provided by "openssl" with any
    of the following names:                                             
                                                                        
      opensslConfig.cmake                                               
      openssl-config.cmake                                              
                                                                        
    Add the installation prefix of "openssl" to CMAKE_PREFIX_PATH or set
    "openssl_DIR" to a directory containing one of the above files.  If 
    "openssl" provides a separate development package or SDK, be sure it has
    been installed.                                                     
                                                                        
                                                                        
* Try:                                                                  
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
                                                                        
* Get more help at https://help.gradle.org                              
                                                                        
BUILD FAILED in 4s                                                      
Running Gradle task 'assembleDebug'...                                  
Running Gradle task 'assembleDebug'... Done                         5.3s
Exception: Gradle task assembleDebug failed with exit code 1

How can i run the project on Ubuntu?


Solution

I found the problem. I had installed Android Studio and Flutter SDK for Ubuntu software, that's the problem. When I reinstalled both from the official websites, the project work's.



Answered By - Cadu Gomes