go-flutter-desktop / go-flutter

Flutter on Windows, MacOS and Linux - based on Flutter Embedding, Go and GLFW.
https://hover.build/
BSD 3-Clause "New" or "Revised" License
5.87k stars 283 forks source link

sqlite3-binding.c:24328:10: fatal error: openssl/rand.h: No such file or directory #548

Closed jlcool closed 3 years ago

jlcool commented 3 years ago

Hover doctor

$ hover doctor
hover: Hover version v0.46.0 running on darwin
hover: Sharing packaging tools
hover: darwin-bundle is supported
hover: darwin-dmg is supported
hover: darwin-pkg is supported
hover: Packaging linux-appimage is not supported on darwin
hover: To still package linux-appimage on darwin you need to run hover with the `--docker` flag.
hover: Packaging linux-deb is not supported on darwin
hover: To still package linux-deb on darwin you need to run hover with the `--docker` flag.
hover: Packaging linux-pkg is not supported on darwin
hover: To still package linux-pkg on darwin you need to run hover with the `--docker` flag.
hover: Packaging linux-rpm is not supported on darwin
hover: To still package linux-rpm on darwin you need to run hover with the `--docker` flag.
hover: Packaging linux-snap is not supported on darwin
hover: To still package linux-snap on darwin you need to run hover with the `--docker` flag.
hover: Packaging windows-msi is not supported on darwin
hover: To still package windows-msi on darwin you need to run hover with the `--docker` flag.
hover: 
hover: Sharing flutter version
Flutter 1.24.0-10.2.pre • channel beta • https://github.com/flutter/flutter.git
Framework • revision 022b333a08 (4 weeks ago) • 2020-11-18 11:35:09 -0800
Engine • revision 07c1eed46b
Tools • Dart 2.12.0 (build 2.12.0-29.10.beta)
hover: Flutter engine commit: https://github.com/flutter/engine/commit/07c1eed46b9d9b58df78566e9b8b2e42e80d3380
hover: Finding out the C compiler version
Apple clang version 12.0.0 (clang-1200.0.32.27)
Target: x86_64-apple-darwin19.5.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
hover: Sharing the content of go.mod
module xx/go

go 1.13

require (
    github.com/Xuanwo/go-locale v1.0.0 // indirect
    github.com/go-flutter-desktop/go-flutter v0.42.0
    github.com/go-flutter-desktop/plugins/image_picker v0.1.5
    github.com/go-flutter-desktop/plugins/package_info v0.0.0-20200811110135-f2f27e369574
    github.com/go-flutter-desktop/plugins/path_provider v0.4.0
    github.com/go-flutter-desktop/plugins/shared_preferences v0.4.3
    github.com/go-flutter-desktop/plugins/url_launcher v0.1.2
    github.com/go-gl/glfw/v3.3/glfw v0.0.0-20201108214237-06ea97f0c265 // indirect
    github.com/jlcool/go-flutter-plugin-sqlcipher v0.0.0-20201215123740-a17d6bd8312f
    github.com/jlcool/go_flutter_alioss v0.0.0-20200509152630-c1d7e8db400b
    github.com/jlcool/go_flutter_notify v0.0.0-20200516131624-6ff8a3454d64
    github.com/jlcool/go_flutter_zip_archive v0.0.0-20200509145616-a13fdbaa7802
    github.com/miguelpruivo/flutter_file_picker/go v0.0.0-20200604215027-87ee48b7f3f6
    github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d // indirect
    github.com/pkg/errors v0.9.1
    golang.org/x/sys v0.0.0-20201119102817-f84b799fce68 // indirect
    golang.org/x/text v0.3.4 // indirect
    gopkg.in/toast.v1 v1.0.0-20180812000517-0a84660828b2 // indirect
)
hover: Sharing the content of hover.yaml
application-name: xx
executable-name: ""
package-name: com.xx1.desktop
license: ""
target: lib/main_desktop.dart
branch: ""
cache-path: ""
opengl: ""
engine-version: ""
hover: Sharing the content of go/cmd
go/cmd/main.go  go/cmd/options.go

Error output

Using hover build windows --docker to build my application, I get the following error:

docker container: github.com/xeodou/go-sqlcipher
docker container: # github.com/xeodou/go-sqlcipher
docker container: sqlite3-binding.c:24328:10: fatal error: openssl/rand.h: No such file or directory
docker container:  #include <openssl/rand.h>
docker container:           ^~~~~~~~~~~~~~~~
docker container: compilation terminated.
docker container: hover: Go build failed: exit status 2
hover: Docker run failed: exit status 1
pchampio commented 3 years ago

This issue comes from your plugin, github.com/jlcool/go-flutter-plugin-sqlcipher. The docker image used to compile your app doesn't have the dependency to include <openssl/rand.h> (read: https://github.com/xeodou/go-sqlcipher#linux to know which package to install)

Also read: https://github.com/go-flutter-desktop/go-flutter/issues/524

Download the source code of: https://github.com/go-flutter-desktop/hover Add the correct dependency to https://github.com/go-flutter-desktop/hover/blob/master/Dockerfile Run: https://github.com/go-flutter-desktop/hover/blob/master/install-with-docker-image.sh

davidmartos96 commented 3 years ago

@jlcool If you are interested in using sqlcipher in desktop you could use either sqflite_common_ffi or moor, both combined with a custom loading of the sqlcipher native library. That is what I'm doing on a go-flutter app myself.

Here is more information: With sqflite: https://github.com/davidmartos96/sqflite_sqlcipher/issues/28#issuecomment-733636725 With moor: https://github.com/simolus3/moor/issues/451#issuecomment-602062594