yandex / ozo

OZO is a C++17 Boost.Asio based header-only library for asyncronous communication with PostgreSQL DBMS.
PostgreSQL License
227 stars 46 forks source link

Build errors.. #309

Open cyboy22 opened 1 year ago

cyboy22 commented 1 year ago

Hi,

I have just downloaded the code and tried to build it using the instructions. However, I get:

CMake Error at /usr/local/Cellar/cmake/3.26.3/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:230 (message): Could NOT find PostgreSQL (missing: PostgreSQL_LIBRARY PostgreSQL_INCLUDE_DIR PostgreSQL_TYPE_INCLUDE_DIR) Call Stack (most recent call first): /usr/local/Cellar/cmake/3.26.3/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE) cmake/modules/FindPostgreSQL.cmake:225 (find_package_handle_standard_args) CMakeLists.txt:11 (find_package)

I work on Mac and did the following:

export PostgreSQL_LIBRARY=/Library/PostgreSQL/13/lib/libpq.dylib export PostgreSQL_INCLUDE_DIR=/Library/PostgreSQL/13/include export PostgreSQL_TYPE_INCLUDE_DIR=/Library/PostgreSQL/13/include

but got the same message. Could you suggest where I am going wrong?

Finallly, I attempted to include <ozo/connection_pool.h> but get the following message needing another include which I cannot find on my system:

Screenshot 2023-06-02 at 00 02 01

JonasProgrammer commented 1 year ago

Hi,

not an 'official' author of the library, but I have done some stuff regarding packaging and CMake.

export PostgreSQL_LIBRARY=/Library/PostgreSQL/13/lib/libpq.dylib export PostgreSQL_INCLUDE_DIR=/Library/PostgreSQL/13/include export PostgreSQL_TYPE_INCLUDE_DIR=/Library/PostgreSQL/13/include

but got the same message. Could you suggest where I am going wrong?

Due to some changes in how PostgreSQL targets are provided by the package config, while still trying to support old CMake versions, the project is using a vendored FindPostgreSQL.cmake, that may not automatically recognize PG 13 installations (ll. 89-90). Manually specifying the library paths should work, but you'd need to declare them as CMake variables -- i.e. pass them via -DPostgreSQL_LIBRARY etc. during configuration. Providing an environment variable PostgreSQL_ROOT pointing to the installation base directory may also work.

Finallly, I attempted to include <ozo/connection_pool.h> but get the following message needing another include which I cannot find on my system:

Screenshot 2023-06-02 at 00 02 01

Did you perform a proper recursive clone? elsid/resource_pool should be checked out in contrib then and be picked up automatically.

cyboy22 commented 1 year ago

Hi - thanks it works now and my apologies for not following your documentation carefully. The linker is still giving issues but that is not really a problem right now.