drogonframework / drogon

Drogon: A C++14/17/20 based HTTP web application framework running on Linux/macOS/Unix/Windows
MIT License
11.62k stars 1.12k forks source link

fix drogon with sqlite on conan #1483

Open okaerin opened 1 year ago

okaerin commented 1 year ago

Describe the bug drogon cannot be built with wit sqlite support using the official conan recipe. A PR with the fix is placed conan-center-index but awaits approval. The issue is the custom FindSQLite3.cmake which is not used in the conan case and therefore the target SQLite3_lib is not created and thus not properly linking to sqlite3.

To Reproduce Steps to reproduce the behavior:

  1. install dependencies with conan: conan install -r conancenter -pr:b default -b missing ..
  2. See error
    Show build output
In file included from ~/.conan/data/drogon/1.8.2/_/_/build/29b7a10fab013440ab3aa45962e0ad849f6963d8/src/orm_lib/src/sqlite3_impl/Sqlite3Connection.h:18,
                 from ~/.conan/data/drogon/1.8.2/_/_/build/29b7a10fab013440ab3aa45962e0ad849f6963d8/src/orm_lib/src/sqlite3_impl/Sqlite3Connection.cc:15:
~/.conan/data/drogon/1.8.2/_/_/build/29b7a10fab013440ab3aa45962e0ad849f6963d8/src/orm_lib/src/sqlite3_impl/Sqlite3ResultImpl.h:19:10: fatal error: sqlite3.h: No such file or directory
   19 | #include <sqlite3.h>
      |          ^~~~~~~~~~~
compilation terminated.
make[2]: *** [CMakeFiles/drogon.dir/build.make:692: CMakeFiles/drogon.dir/orm_lib/src/sqlite3_impl/Sqlite3Connection.cc.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [CMakeFiles/Makefile2:102: CMakeFiles/drogon.dir/all] Error 2
make: *** [Makefile:156: all] Error 2

Expected behavior A successfully built and installed package

Additional context

conan recipe ```python from conan import ConanFile class Recipe(ConanFile): settings = "os", "compiler", "build_type", "arch" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" default_options = { "drogon:with_ctl": True, "drogon:with_orm": True, "drogon:with_sqlite": True, } def layout(self): self.folders.generators = "conan" def requirements(self): self.requires("fmt/9.0.0") self.requires("drogon/1.8.2") def build_requirements(self): self.test_requires("catch2/3.0.1") def imports(self): self.copy("drogon_ctl",dst="packages/bin",src="bin", root_package="drogon") ```
okaerin commented 1 year ago

It is fixed the conan recipe for the versions 1.8.0 and 1.8.2 . In time I will try to supply a permanent fix here too, so conan recipes don't require the patches for further versions anymore

an-tao commented 1 year ago

It is fixed the conan recipe for the versions 1.8.0 and 1.8.2 . In time I will try to supply a permanent fix here too, so conan recipes don't require the patches for further versions anymore

Thanks so much.