frannecki / ladder

A light-weight cross-platform event-driven web server
BSD 3-Clause "New" or "Revised" License
1 stars 1 forks source link

Build failed #3

Closed zoujiaqing closed 2 years ago

zoujiaqing commented 2 years ago

OS: Debian 11 amd64 on WSL2

Using build.sh

g++ -Wall -std=c++11 -O0 -g -I./../../ladder/include/ -I./../ -o test.out test_argument_parser.o test_buffer.o test_gzip.o test_memory_pool.o test_protobuf_codec.o test_socket_addr.o test_utils.o ../proto/tests.pb.cc -L/usr/local/lib -lpthread -L./../../ladder/build -lladder -L/usr/local/lib64 -lgtest_main -lgmock_main -lgtest -lgmock -lprotobuf -lz
/usr/bin/ld: ./../../ladder/build/libladder.so: undefined reference to `SSL_CTX_free'
/usr/bin/ld: ./../../ladder/build/libladder.so: undefined reference to `SSL_get_error'
/usr/bin/ld: ./../../ladder/build/libladder.so: undefined reference to `BIO_write'
/usr/bin/ld: ./../../ladder/build/libladder.so: undefined reference to `SSL_set_bio'
/usr/bin/ld: ./../../ladder/build/libladder.so: undefined reference to `SSL_read'
/usr/bin/ld: ./../../ladder/build/libladder.so: undefined reference to `SSL_is_init_finished'
/usr/bin/ld: ./../../ladder/build/libladder.so: undefined reference to `OPENSSL_init_ssl'
/usr/bin/ld: ./../../ladder/build/libladder.so: undefined reference to `BIO_s_mem'
/usr/bin/ld: ./../../ladder/build/libladder.so: undefined reference to `OPENSSL_init_crypto'
/usr/bin/ld: ./../../ladder/build/libladder.so: undefined reference to `BIO_read'
/usr/bin/ld: ./../../ladder/build/libladder.so: undefined reference to `ERR_print_errors_fp'
/usr/bin/ld: ./../../ladder/build/libladder.so: undefined reference to `SSL_CTX_new'
/usr/bin/ld: ./../../ladder/build/libladder.so: undefined reference to `ERR_load_BIO_strings'
/usr/bin/ld: ./../../ladder/build/libladder.so: undefined reference to `BIO_new'
/usr/bin/ld: ./../../ladder/build/libladder.so: undefined reference to `TLS_client_method'
/usr/bin/ld: ./../../ladder/build/libladder.so: undefined reference to `SSL_CTX_use_certificate_file'
/usr/bin/ld: ./../../ladder/build/libladder.so: undefined reference to `SSL_CTX_set_options'
/usr/bin/ld: ./../../ladder/build/libladder.so: undefined reference to `SSL_set_connect_state'
/usr/bin/ld: ./../../ladder/build/libladder.so: undefined reference to `SSL_free'
/usr/bin/ld: ./../../ladder/build/libladder.so: undefined reference to `SSL_write'
/usr/bin/ld: ./../../ladder/build/libladder.so: undefined reference to `SSL_CTX_use_PrivateKey_file'
/usr/bin/ld: ./../../ladder/build/libladder.so: undefined reference to `SSL_set_accept_state'
/usr/bin/ld: ./../../ladder/build/libladder.so: undefined reference to `TLS_server_method'
/usr/bin/ld: ./../../ladder/build/libladder.so: undefined reference to `SSL_new'
/usr/bin/ld: ./../../ladder/build/libladder.so: undefined reference to `SSL_do_handshake'
collect2: error: ld returned 1 exit status
make: *** [Makefile:16: test.out] Error 1
./build.sh: line 13: ./build.sh: No such file or directory
./build.sh: line 15: cd: tests_client: No such file or directory
./build.sh: line 18: cd: examples/http: No such file or directory

Using cmake

zoujiaqing@BRIAN-LAPTOP:~/projects/ladder/temp$ cmake ..
-- The C compiler identification is GNU 10.2.1
-- The CXX compiler identification is GNU 10.2.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Found Protobuf: /usr/lib/x86_64-linux-gnu/libprotobuf.so;-lpthread (found version "3.12.4")
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.11")
-- Found GTest: /usr/lib/x86_64-linux-gnu/libgtest.a
-- Found OpenSSL: /usr/lib/x86_64-linux-gnu/libcrypto.so (found version "1.1.1k")
-- Configuring done
CMake Error at CMakeLists.txt:36 (add_executable):
  Target "ladder_unit_tests" links to target "GTest::gmock" but the target
  was not found.  Perhaps a find_package() call is missing for an IMPORTED
  target, or an ALIAS target is missing?

CMake Error at CMakeLists.txt:36 (add_executable):
  Target "ladder_unit_tests" links to target "GTest::gmock_main" but the
  target was not found.  Perhaps a find_package() call is missing for an
  IMPORTED target, or an ALIAS target is missing?

-- Generating done
CMake Generate step failed.  Build files cannot be regenerated correctly.
frannecki commented 2 years ago

Thanks for your feedback. Building with cmake should be fixed in bb6b1fe.

zoujiaqing commented 2 years ago

Build successfully using cmake :) Install dependent libs in Debian:

sudo apt install libprotobuf-dev
sudo apt install libgtest-dev
sudo apt install libssl-dev
sudo apt install libgmock-dev