matt-42 / lithium

Easy to use C++17 HTTP Server with no compromise on performances. https://matt-42.github.io/lithium
https://matt-42.github.io/lithium
MIT License
1.26k stars 91 forks source link

[BUG] Try install lithium with cmake - Missing Mysql Lib #80

Open marioidival opened 3 years ago

marioidival commented 3 years ago

When I going to install lithium locally, I got an error on cmake command.

-- The C compiler identification is GNU 8.3.0
-- The CXX compiler identification is GNU 8.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
X86 detected
CMake Error at /usr/share/cmake-3.13/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
  Could NOT find MYSQL (missing: MYSQL_LIBRARY MYSQL_INCLUDE_DIR)
Call Stack (most recent call first):
  /usr/share/cmake-3.13/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
  cmake/FindMYSQL.cmake:96 (find_package_handle_standard_args)
  CMakeLists.txt:12 (find_package)

-- Configuring incomplete, errors occurred!
Burnett01 commented 3 years ago

Hello @marioidival, please make sure you are using the mariadb dev packages. apt-get install libmariadb-dev mariadb-server

See: https://github.com/matt-42/lithium/issues/29#issuecomment-658058241

marioidival commented 3 years ago

@Burnett01 thank you, I pass this error, but now I got this: I have curl already installed but I don't know what package is boost.

X86 detected
MYSQL_INCLUDE_DIRS/usr/include/mariadb
/usr/lib/x86_64-linux-gnu/libmariadbclient.so
CMake Error at /usr/share/cmake-3.13/Modules/FindBoost.cmake:2100 (message):
  Unable to find the requested Boost libraries.

  Unable to find the Boost header files.  Please set BOOST_ROOT to the root
  directory containing Boost or BOOST_INCLUDEDIR to the directory containing
  Boost's headers.
Call Stack (most recent call first):
  CMakeLists.txt:13 (find_package)

CMake Error at /usr/share/cmake-3.13/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
  Could NOT find CURL (missing: CURL_LIBRARY CURL_INCLUDE_DIR)
Call Stack (most recent call first):
  /usr/share/cmake-3.13/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
  /usr/share/cmake-3.13/Modules/FindCURL.cmake:74 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  CMakeLists.txt:15 (find_package)

-- Configuring incomplete, errors occurred!
See also "/home/kakarotto/codes/lithium/CMakeFiles/CMakeOutput.log".
marioidival commented 3 years ago

What's from POSTGRESQL I need install?

X86 detected
MYSQL_INCLUDE_DIRS/usr/include/mariadb
/usr/lib/x86_64-linux-gnu/libmariadbclient.so
-- Boost version: 1.67.0
-- Found the following Boost libraries:
--   context
--   thread
--   chrono
--   system
--   date_time
--   atomic
CMake Error at /usr/share/cmake-3.13/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
  Could NOT find PostgreSQL (missing: PostgreSQL_TYPE_INCLUDE_DIR) (found
  version "11.12 (Debian 11.12-0+deb10u1)")
Call Stack (most recent call first):
  /usr/share/cmake-3.13/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
  /usr/share/cmake-3.13/Modules/FindPostgreSQL.cmake:175 (find_package_handle_standard_args)
  CMakeLists.txt:16 (find_package)

-- Configuring incomplete, errors occurred!
See also "/home/kakarotto/codes/lithium/CMakeFiles/CMakeOutput.log".
See also "/home/kakarotto/codes/lithium/CMakeFiles/CMakeError.log".
Burnett01 commented 3 years ago

Hello @marioidival,

you can install the curl and boost packages with

apt-get install libboost-all-dev libcurl4-openssl-dev

and the postgresql packages with

apt-get install postgresql-server-dev-all libpq-dev

Also your compiler version GCC 8.3.x ist not supported. Please upgrade to G++ 9.3.x or a more recent version as described here https://github.com/matt-42/lithium/issues/62#issuecomment-804092751

Greetings, Steve

Sources: #15 and #62

marioidival commented 3 years ago

strange, anyway, thank you for information!

☁  ~  cc --version                         
clang version 12.0.0
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
marioidival commented 3 years ago
make install -j 4

:face_with_head_bandage:

/usr/bin/ld: CMakeFiles/li_symbol_generator.dir/symbol/symbol_generator.cc.o: in function `std::filesystem::__cxx11::path::path<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::filesystem::__cxx11::path>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::filesystem::__cxx11::path::format)':
symbol_generator.cc:(.text._ZNSt10filesystem7__cxx114pathC2INSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES1_EERKT_NS1_6formatE[_ZNSt10filesystem7__cxx114pathC2INSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES1_EERKT_NS1_6formatE]+0x5b): undefined reference to `std::filesystem::__cxx11::path::_M_split_cmpts()'
clang-12: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [libraries/symbol/CMakeFiles/li_symbol_generator.dir/build.make:87: libraries/symbol/li_symbol_generator] Error 1
make[2]: Leaving directory '/home/kakarotto/codes/lithium'
make[1]: *** [CMakeFiles/Makefile2:893: libraries/symbol/CMakeFiles/li_symbol_generator.dir/all] Error 2
make[1]: Leaving directory '/home/kakarotto/codes/lithium'
make: *** [Makefile:144: all] Error 2
Burnett01 commented 3 years ago

Hmm quite hard to tell what's causing the issue. I have been using Clang 9.0 hence I don't know if Clang 12 behaves differently. The linker error message points to missing support for std::filesystem hence it indicates that maybe C++17 (std) is not supported in your dev environment?

marioidival commented 3 years ago

@Burnett01 I already create c++17 code there :( It's strange

matt-42 commented 3 years ago

I never had this error but never tried clang 12. Did you try this ? target_link_libraries(your_program stdc++fs)

Found this here: https://stackoverflow.com/questions/33149878/experimentalfilesystem-linker-error