how to build drogon framework?

I tried to build drogon, but when building it, it gave out linking errors like these:
Code:
ld: error: unable to find library -lyaml-cpp
I compiled using the default commands from documentations
Code:
mkdir build
cd build
cmake ..
make && make install
I also tried changing the compiler from clang to gcc, but it didn't help
 
You should probably figure out what dependencies the code has. Those would need to be installed before trying to build the software.

In this case it appears to be looking for devel/yaml-cpp.
 
I am trying to port this program. I didn't port a C++ program before but i'll try.

It builds fine on my FreeBSD 14.2-RELEASE system. I need to find out what additional dependencies it does need. I also need someone that know how to use this program to test it if it's working fine.

Code:
yusuf@hale ~ % dg_ctl
usage: drogon_ctl [-v | --version] [-h | --help] <command> [<args>]
commands list:
help                    display this message
version                 display version of this tool
press                   Do stress testing(Use 'drogon_ctl help press' for more information)
create                  create some source files(Use 'drogon_ctl help create' for more information)
yusuf@hale ~ % pkg info -x drogon
drogon-1.9.8
 
Strange that it didn't complain about missing include files way before the missing library in the linker command.
 
I need to find out what additional dependencies it does need.
Run ldd(1) on the executables and/or libraries it has. That would at least give you its library dependencies. It may have some additional build dependencies (i.e. tools it needs to build the code) or run dependencies (tools it needs when running the code).
 

Attachments

I did make some progress on the port, it's still work in progress but you can try it, i uploaded it as zip attachment and to github. I still don't know if i should use client part of postgresql or server path or just both.

Code:
/home/gimonchik/yusuf-ports-overlay/www/drogon/work/drogon-1.9.8/orm_lib/src/mysql_impl/MysqlConnection.cc:318:19: error: use of undeclared identifier 'MYSQL_WAIT_READ'
  318 |         status |= MYSQL_WAIT_READ;
      |                   ^
/home/gimonchik/yusuf-ports-overlay/www/drogon/work/drogon-1.9.8/orm_lib/src/mysql_impl/MysqlConnection.cc:320:19: error: use of undeclared identifier 'MYSQL_WAIT_WRITE'
  320 |         status |= MYSQL_WAIT_WRITE;
      |                   ^
/home/gimonchik/yusuf-ports-overlay/www/drogon/work/drogon-1.9.8/orm_lib/src/mysql_impl/MysqlConnection.cc:322:19: error: use of undeclared identifier 'MYSQL_WAIT_EXCEPT'
  322 |         status |= MYSQL_WAIT_EXCEPT;
      |                   ^
/home/gimonchik/yusuf-ports-overlay/www/drogon/work/drogon-1.9.8/orm_lib/src/mysql_impl/MysqlConnection.cc:327:23: error: use of undeclared identifier 'mysql_real_connect_cont'
  327 |         waitStatus_ = mysql_real_connect_cont(&ret, mysqlPtr_.get(), status);
      |                       ^
/home/gimonchik/yusuf-ports-overlay/www/drogon/work/drogon-1.9.8/orm_lib/src/mysql_impl/MysqlConnection.cc:369:19: error: use of undeclared identifier 'mysql_set_character_set_cont'
  369 |     waitStatus_ = mysql_set_character_set_cont(&err, mysqlPtr_.get(), status);
      |                   ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
ninja: build stopped: subcommand failed.
*** Error code 1

Stop.
make[1]: stopped in /home/gimonchik/yusuf-ports-overlay/www/drogon
*** Error code 1

Stop.
make: stopped in /home/gimonchik/yusuf-ports-overlay/www/drogon
i tried to install mysql, but it didnt help
 
Sorry, I didn't add the note that drogon fails to build if there is mysql installed, it only builds fine with postgresql and sqlite.

yaml-cpp already installed
Same happened to me until i used USES+= localbase:ldflags in the port's Makefile.

I attached build logs with mysql installed and without.

Added mysql support even if it fails to build with it: https://github.com/nxjosephofficial...1ba7b1a2dc203c05058672da1a10467186/www/drogon

New zip attached.

You can run make config to select if it should use backend of choice. Available options are; pgsql16, sqlite3, mysql80
 

Attachments

I think that if i can control what build options will be, i think i can solve mysql build issue. for example, i can only enable mysql support and disabling other backend supports and then it builds fine with mysql support.

Makefile:
.if empty(PORT_OPTIONS:MSQLITE3) && empty(PORT_OPTIONS:MMYSQL80) && \
        !empty(PORT_OPTIONS:MPGSQL16)
USES+=          pgsql
LIB_DEPENDS+=   libpq.so:databases/postgresql16-client
CMAKE_ARGS+=    -DBUILD_SQLITE=OFF -DBUILD_MYSQL=OFF
.endif
.if empty(PORT_OPTIONS:MPGSQL16) && empty(PORT_OPTIONS:MMYSQL80) && \
        !empty(PORT_OPTIONS:MSQLITE3)
USES+=          sqlite
LIB_DEPENDS+=   libsqlite3.so:databases/sqlite3
CMAKE_ARGS+=    -DBUILD_POSTGRESQL=OFF -DBUILD_MYSQL=OFF
.endif
.if empty(PORT_OPTIONS:MSQLITE3) && empty(PORT_OPTIONS:MPGSQL16) && \
        !empty(PORT_OPTIONS:MMYSQL80)
USES+=          mysql
LIB_DEPENDS+=   libmysqlclient.so:databases/mysql80-client
CMAKE_ARGS+=    -DBUILD_SQLITE=OFF -DBUILD_POSTGRESQL=OFF
.endif

Here is table of build options from upstream CMakeLists.txt.
Code:
include(CMakeDependentOption)
CMAKE_DEPENDENT_OPTION(BUILD_POSTGRESQL "Build with postgresql support" ON "BUILD_ORM" OFF)
CMAKE_DEPENDENT_OPTION(LIBPQ_BATCH_MODE "Use batch mode for libpq" ON "BUILD_POSTGRESQL" OFF)
CMAKE_DEPENDENT_OPTION(BUILD_MYSQL "Build with mysql support" ON "BUILD_ORM" OFF)
CMAKE_DEPENDENT_OPTION(BUILD_SQLITE "Build with sqlite3 support" ON "BUILD_ORM" OFF)
CMAKE_DEPENDENT_OPTION(BUILD_REDIS "Build with redis support" ON "BUILD_ORM" OFF)
CMAKE_DEPENDENT_OPTION(USE_SPDLOG "Allow using the spdlog logging library" OFF "USE_SUBMODULE" OFF)

Update: Added new options

 
I think that if i can control what build options will be, i think i can solve mysql build issue. for example, i can only enable mysql support and disabling other backend supports and then it builds fine with mysql support.
Use OPTION_SINGLE for these, that will create "radio" buttons, you can always only select one.

Code:
OPTIONS_SINGLE= DB
OPTIONS_SINGLE_DB= PGSQL SQLITE MYSQL



Code:
.if empty(PORT_OPTIONS:MSQLITE3) && empty(PORT_OPTIONS:MMYSQL80) && \
        !empty(PORT_OPTIONS:MPGSQL16)
USES+=          pgsql
LIB_DEPENDS+=   libpq.so:databases/postgresql16-client
CMAKE_ARGS+=    -DBUILD_SQLITE=OFF -DBUILD_MYSQL=OFF
.endif

You don't need to do this, it can be simplified like so:
Code:
PGSQL_USES+= pgsql
PGSQL_CMAKE_ARGS+=    -DBUILD_SQLITE=OFF -DBUILD_MYSQL=OFF

With USES= pgsql you don't need to explicitly set LIB_DEPENDS (or RUN_DEPENDS), the macro already takes care of this. And you don't want to set a specific version so DEFAULT_VERSION= pgsql=17 will magically pick up the correct version.

 
I think that if i can control what build options will be, i think i can solve mysql build issue. for example, i can only enable mysql support and disabling other backend supports and then it builds fine with mysql support.

Makefile:
.if empty(PORT_OPTIONS:MSQLITE3) && empty(PORT_OPTIONS:MMYSQL80) && \
        !empty(PORT_OPTIONS:MPGSQL16)
USES+=          pgsql
LIB_DEPENDS+=   libpq.so:databases/postgresql16-client
CMAKE_ARGS+=    -DBUILD_SQLITE=OFF -DBUILD_MYSQL=OFF
.endif
.if empty(PORT_OPTIONS:MPGSQL16) && empty(PORT_OPTIONS:MMYSQL80) && \
        !empty(PORT_OPTIONS:MSQLITE3)
USES+=          sqlite
LIB_DEPENDS+=   libsqlite3.so:databases/sqlite3
CMAKE_ARGS+=    -DBUILD_POSTGRESQL=OFF -DBUILD_MYSQL=OFF
.endif
.if empty(PORT_OPTIONS:MSQLITE3) && empty(PORT_OPTIONS:MPGSQL16) && \
        !empty(PORT_OPTIONS:MMYSQL80)
USES+=          mysql
LIB_DEPENDS+=   libmysqlclient.so:databases/mysql80-client
CMAKE_ARGS+=    -DBUILD_SQLITE=OFF -DBUILD_POSTGRESQL=OFF
.endif

Here is table of build options from upstream CMakeLists.txt.
Code:
include(CMakeDependentOption)
CMAKE_DEPENDENT_OPTION(BUILD_POSTGRESQL "Build with postgresql support" ON "BUILD_ORM" OFF)
CMAKE_DEPENDENT_OPTION(LIBPQ_BATCH_MODE "Use batch mode for libpq" ON "BUILD_POSTGRESQL" OFF)
CMAKE_DEPENDENT_OPTION(BUILD_MYSQL "Build with mysql support" ON "BUILD_ORM" OFF)
CMAKE_DEPENDENT_OPTION(BUILD_SQLITE "Build with sqlite3 support" ON "BUILD_ORM" OFF)
CMAKE_DEPENDENT_OPTION(BUILD_REDIS "Build with redis support" ON "BUILD_ORM" OFF)
CMAKE_DEPENDENT_OPTION(USE_SPDLOG "Allow using the spdlog logging library" OFF "USE_SUBMODULE" OFF)

Update: Added new options

Code:
FAILED: examples/HelloView.h examples/HelloView.cc /home/gimonchik/yusuf-ports-overlay/www/drogon/work/.build/examples/HelloView.h /home/gimonchik/yusuf-ports-overlay/www/drogon/work/.build/examples/HelloView.cc
cd /home/gimonchik/yusuf-ports-overlay/www/drogon/work/drogon-1.9.8/examples && drogon_ctl create view helloworld/HelloView.csp -o /home/gimonchik/yusuf-ports-overlay/www/drogon/work/.build/examples
/bin/sh: drogon_ctl: not found
 
Code:
FAILED: examples/HelloView.h examples/HelloView.cc /home/gimonchik/yusuf-ports-overlay/www/drogon/work/.build/examples/HelloView.h /home/gimonchik/yusuf-ports-overlay/www/drogon/work/.build/examples/HelloView.cc
cd /home/gimonchik/yusuf-ports-overlay/www/drogon/work/drogon-1.9.8/examples && drogon_ctl create view helloworld/HelloView.csp -o /home/gimonchik/yusuf-ports-overlay/www/drogon/work/.build/examples
/bin/sh: drogon_ctl: not found
Did you get this error in build ?

I didn't face with an error like this.
 
Back
Top