babelouest / ulfius

Web Framework to build REST APIs, Webservices or any HTTP endpoint in C language. Can stream large amount of data, integrate JSON data with Jansson, and create websocket services
https://babelouest.github.io/ulfius
GNU Lesser General Public License v2.1
1.07k stars 183 forks source link

Having trouble building ulfius on static mode #230

Closed f4r4 closed 1 year ago

f4r4 commented 2 years ago
make[2]: *** [orcania-download-prefix/src/orcania-download-stamp/orcania-download-download] Error 1
make[1]: *** [CMakeFiles/orcania-download.dir/all] Error 2
make: *** [all] Error 2
CMake Error at cmake-modules/DownloadProject.cmake:179 (message):
  Build step for orcania failed: 2
Call Stack (most recent call first):
  CMakeLists.txt:263 (download_project)

OS- Ubuntu 18.04

cmake ../ -DBUILD_STATIC=on -DWITH_JANSSON=off -DWITH_CURL=off -DWITH_GNUTLS=off -DWITH_WEBSOCKET=off -DWITH_JOURNALD=off -DWITH_YDER=off -DBUILD_UWSC=off -DBUILD_ULFIUS_TESTING=off -DBUILD_ULFIUS_DOCUMENTATION=off -DINSTALL_HEADER=off -DBUILD_RPM=off -DCMAKE_BUILD_TYPE=Debug I am getting the above error when I tried to build ulfius could anyone please advice thanks

babelouest commented 2 years ago

Hello @f4r4 ,

I can't reproduce your error using a fresh Debian stable and the last release. Can you describe your environment and what ulfius release you're using?

f4r4 commented 2 years ago

Okay I understand I cloned the master branch and tried to install btw I have already installed orcania and yder I mean cloned and make

I understand if this cannot be answered to to reproduce issue if that's the case any pointers on cross-building building ulfis ?

babelouest commented 2 years ago

Usually the master branch is not recommended for install, as it can be a work-in-progress, like now. That's the same for the other projects. I recommend to build ulfius, yder and orcania using their last release, instead of the master branch.

I understand if this cannot be answered to to reproduce issue if that's the case any pointers on cross-building building ulfis ?

I'm not sure I understand this question, what cross-build to you want to do?

f4r4 commented 2 years ago

We have a 18.04 ubuntu machine thats locked down we cannot have dynamic libs on that, that's the reason I want to build static but first I need to statically build on my ubuntu machine and test things

babelouest commented 2 years ago

I can build ulfius 2.7.9 on a fresh Ubuntu 18.04 running on a docker instance:

root@e5fdb4e59cf7:/# cd /opt
root@e5fdb4e59cf7:/opt# wget https://github.com/babelouest/ulfius/archive/refs/tags/v2.7.9.tar.gz
--2022-05-25 14:59:07--  https://github.com/babelouest/ulfius/archive/refs/tags/v2.7.9.tar.gz
Resolving github.com (github.com)... 140.82.112.4
Connecting to github.com (github.com)|140.82.112.4|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://codeload.github.com/babelouest/ulfius/tar.gz/refs/tags/v2.7.9 [following]
--2022-05-25 14:59:07--  https://codeload.github.com/babelouest/ulfius/tar.gz/refs/tags/v2.7.9
Resolving codeload.github.com (codeload.github.com)... 140.82.113.10
Connecting to codeload.github.com (codeload.github.com)|140.82.113.10|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [application/x-gzip]
Saving to: 'v2.7.9.tar.gz'

v2.7.9.tar.gz                                    [ <=>                                                                                           ] 409.34K  2.40MB/s    in 0.2s    

2022-05-25 14:59:08 (2.40 MB/s) - 'v2.7.9.tar.gz' saved [419169]

root@e5fdb4e59cf7:/opt# tar xf v2.7.9.tar.gz 
root@e5fdb4e59cf7:/opt# mkdir build 
root@e5fdb4e59cf7:/opt# cd build/
root@e5fdb4e59cf7:/opt/build# cmake -DBUILD_STATIC=on -DWITH_JANSSON=off -DWITH_CURL=off -DWITH_GNUTLS=off -DWITH_WEBSOCKET=off -DWITH_JOURNALD=off -DWITH_YDER=off -DBUILD_UWSC=off -DBUILD_ULFIUS_TESTING=off -DBUILD_ULFIUS_DOCUMENTATION=off -DINSTALL_HEADER=off -DBUILD_RPM=off -DCMAKE_BUILD_TYPE=Debug  ../ulfius-2.7.9/
-- The C compiler identification is GNU 7.5.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
-- Looking for __GNU_LIBRARY__
-- Looking for __GNU_LIBRARY__ - found
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- 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 MHD: /usr/lib/x86_64-linux-gnu/libmicrohttpd.so (found version "00.09.59.00") 
-- Found MHD: /usr/lib/x86_64-linux-gnu/libmicrohttpd.so (found suitable version "00.09.59.00", minimum required is "0.9.51") 
INSTALL TARGETS - target orcania has PUBLIC_HEADER files but no PUBLIC_HEADER DESTINATION.
-- Force inline implementation of strstr: OFF
-- Build static library:                  on
-- Build testing tree:                    OFF
-- Install the header files:              off
-- Build RPM package:                     off
-- Build documentation:                   OFF
-- Build base64url application:           ON
INSTALL TARGETS - target ulfius has PUBLIC_HEADER files but no PUBLIC_HEADER DESTINATION.
-- GNU TLS support:           off
-- Websocket support:         OFF
-- Outgoing requests support: off
-- Jansson library support:   off
-- Yder support:              off
-- Build uwsc application:    OFF
-- Build static library:      on
-- Build testing tree:        off
-- Install the header files:  off
-- Build RPM package:         off
-- Build documentation:       off
-- Configuring done
-- Generating done
CMake Warning:
  Manually-specified variables were not used by the project:

    WITH_JOURNALD

-- Build files have been written to: /opt/build
root@e5fdb4e59cf7:/opt/build# make
Scanning dependencies of target ulfius_static
[  3%] Building C object CMakeFiles/ulfius_static.dir/src/u_map.c.o
[  7%] Building C object CMakeFiles/ulfius_static.dir/src/u_request.c.o
[ 11%] Building C object CMakeFiles/ulfius_static.dir/src/u_response.c.o
[ 15%] Building C object CMakeFiles/ulfius_static.dir/src/u_send_request.c.o
[ 19%] Building C object CMakeFiles/ulfius_static.dir/src/u_websocket.c.o
[ 23%] Building C object CMakeFiles/ulfius_static.dir/src/yuarel.c.o
[ 26%] Building C object CMakeFiles/ulfius_static.dir/src/ulfius.c.o
[ 30%] Linking C static library libulfius.a
[ 30%] Built target ulfius_static
Scanning dependencies of target orcania
[ 34%] Building C object orcania-build/CMakeFiles/orcania.dir/src/base64.c.o
[ 38%] Building C object orcania-build/CMakeFiles/orcania.dir/src/memory.c.o
[ 42%] Building C object orcania-build/CMakeFiles/orcania.dir/src/orcania.c.o
[ 46%] Linking C shared library liborcania.so
[ 46%] Built target orcania
Scanning dependencies of target ulfius
[ 50%] Building C object CMakeFiles/ulfius.dir/src/u_map.c.o
[ 53%] Building C object CMakeFiles/ulfius.dir/src/u_request.c.o
[ 57%] Building C object CMakeFiles/ulfius.dir/src/u_response.c.o
[ 61%] Building C object CMakeFiles/ulfius.dir/src/u_send_request.c.o
[ 65%] Building C object CMakeFiles/ulfius.dir/src/u_websocket.c.o
[ 69%] Building C object CMakeFiles/ulfius.dir/src/yuarel.c.o
[ 73%] Building C object CMakeFiles/ulfius.dir/src/ulfius.c.o
[ 76%] Linking C shared library libulfius.so
[ 76%] Built target ulfius
Scanning dependencies of target orcania_static
[ 80%] Building C object orcania-build/CMakeFiles/orcania_static.dir/src/base64.c.o
[ 84%] Building C object orcania-build/CMakeFiles/orcania_static.dir/src/memory.c.o
[ 88%] Building C object orcania-build/CMakeFiles/orcania_static.dir/src/orcania.c.o
[ 92%] Linking C static library liborcania.a
[ 92%] Built target orcania_static
Scanning dependencies of target base64url
[ 96%] Building C object orcania-build/CMakeFiles/base64url.dir/tools/base64url/base64url.c.o
[100%] Linking C executable base64url
[100%] Built target base64url
root@e5fdb4e59cf7:/opt/build# ls -Al
total 428
drwxr-xr-x 6 root root   4096 May 25 14:59 ./
drwxr-xr-x 1 root root   4096 May 25 14:59 ../
-rw-r--r-- 1 root root  18038 May 25 14:59 CMakeCache.txt
drwxr-xr-x 7 root root   4096 May 25 14:59 CMakeFiles/
-rw-r--r-- 1 root root   3883 May 25 14:59 CPackConfig.cmake
-rw-r--r-- 1 root root   4147 May 25 14:59 CPackSourceConfig.cmake
-rw-r--r-- 1 root root  17357 May 25 14:59 Makefile
-rw-r--r-- 1 root root   3256 May 25 14:59 cmake_install.cmake
-rw-r--r-- 1 root root 212470 May 25 14:59 libulfius.a
-rw-rw-r-- 1 root root    503 May 25 14:59 libulfius.pc
lrwxrwxrwx 1 root root     16 May 25 14:59 libulfius.so -> libulfius.so.2.7*
lrwxrwxrwx 1 root root     18 May 25 14:59 libulfius.so.2.7 -> libulfius.so.2.7.9*
-rwxr-xr-x 1 root root 134144 May 25 14:59 libulfius.so.2.7.9*
drwxr-xr-x 3 root root   4096 May 25 14:59 orcania-build/
drwxr-xr-x 4 root root   4096 May 25 14:59 orcania-download/
drwxr-xr-x 9 root root   4096 Mar  9 21:23 orcania-src/
-rw-rw-r-- 1 root root   1653 May 25 14:59 ulfius-cfg.h
babelouest commented 1 year ago

@f4r4 , any update on this?