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

Undefined references in libulfius.so #194

Closed LloydShelby closed 2 years ago

LloydShelby commented 2 years ago

Attempting to build/install this on Raspbian Buster, I noticed that there are not precompiles for 2.7.0+ so trying various methods as indicated (from source, from the 2.6.9 tagged release, etc.). Continuing to receive these errors on building example programs:

$ make Scanning dependencies of target sheep_counter [ 3%] Building C object CMakeFiles/sheep_counter.dir/sheep_counter/sheep_counter.c.o [ 6%] Linking C executable sheep_counter /usr/bin/ld: /usr/local/lib/libulfius.so: undefined reference to pointer_list_init' /usr/bin/ld: /usr/local/lib/libulfius.so: undefined reference topointer_list_size' /usr/bin/ld: /usr/local/lib/libulfius.so: undefined reference to mstrcatf' /usr/bin/ld: /usr/local/lib/libulfius.so: undefined reference topointer_list_get_at' /usr/bin/ld: /usr/local/lib/libulfius.so: undefined reference to pointer_list_append' /usr/bin/ld: /usr/local/lib/libulfius.so: undefined reference totrimcharacter' /usr/bin/ld: /usr/local/lib/libulfius.so: undefined reference to `pointer_list_clean_free' collect2: error: ld returned 1 exit status make[2]: [CMakeFiles/sheep_counter.dir/build.make:85: sheep_counter] Error 1 make[1]: [CMakeFiles/Makefile2:104: CMakeFiles/sheep_counter.dir/all] Error 2 make: *** [Makefile:84: all] Error 2

Any ideas or workarounds? Thanks!

oliv3 commented 2 years ago

This function is defined in orcania: https://github.com/babelouest/orcania/blob/master/src/orcania.c#L544. Did you install it ?

LloydShelby commented 2 years ago

Thanks for the reply. Yes, I extracted orcania from the 2.6.9 distribution and did "sudo dpkg -i liborcania-dev_2.1.1_raspbian_buster_armv7l.deb", it seemed to complete successfully.

pi@gherkin:~` $ sudo dpkg -i liborcania-dev_2.1.1_raspbian_buster_armv7l.deb
(Reading database ... 175072 files and directories currently installed.)
Preparing to unpack liborcania-dev_2.1.1_raspbian_buster_armv7l.deb ...
Unpacking liborcania (2.1.1) over (2.1.1) ...
Setting up liborcania (2.1.1) ...
pi@gherkin:~ $ cd ulfius/ulfius-2.6.9/example_programs/build
pi@gherkin:~/ulfius/ulfius-2.6.9/example_programs/build $ cmake ..
-- Found Ulfius: /usr/local/lib/libulfius.so (found version "2.7.3") 
-- Found Ulfius: /usr/local/lib/libulfius.so (found suitable version "2.7.3", minimum required is "2.6") 
-- Websocket support: ON
-- Outgoing requests support: ON
-- Jansson library support: ON
-- Yder library support: 
-- Configuring done
-- Generating done
-- Build files have been written to: /home/pi/ulfius/ulfius-2.6.9/example_programs/build
pi@gherkin:~/ulfius/ulfius-2.6.9/example_programs/build $ make 
[  3%] Linking C executable sheep_counter
/usr/bin/ld: /usr/local/lib/libulfius.so: undefined reference to `pointer_list_init'
/usr/bin/ld: /usr/local/lib/libulfius.so: undefined reference to `pointer_list_size'
/usr/bin/ld: /usr/local/lib/libulfius.so: undefined reference to `mstrcatf'
/usr/bin/ld: /usr/local/lib/libulfius.so: undefined reference to `pointer_list_get_at'
/usr/bin/ld: /usr/local/lib/libulfius.so: undefined reference to `pointer_list_append'
/usr/bin/ld: /usr/local/lib/libulfius.so: undefined reference to `trimcharacter'
/usr/bin/ld: /usr/local/lib/libulfius.so: undefined reference to `pointer_list_clean_free'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/sheep_counter.dir/build.make:85: sheep_counter] Error 1
make[1]: *** [CMakeFiles/Makefile2:104: CMakeFiles/sheep_counter.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
babelouest commented 2 years ago

In general, I wouldn't mix packages that come from different versions, to avoid some improbable mistakes and release some Kraken... Indeed the release 2.7.3 has no package for Raspberry Pi. I forgot about that, it's gonna be fixed soon. But the previous version has a package for raspbian, it's just not called raspbian anymore, just Debian, you can test this:https://github.com/babelouest/ulfius/releases/download/v2.7.2/ulfius-dev-full_2.7.2_debian_buster_armv7l.tar.gz

babelouest commented 2 years ago

@LloydShelby , I have uploaded packages for Ulfius 2.7.3 on Raspbian Buster in the release page: https://github.com/babelouest/ulfius/releases/tag/v2.7.3

https://github.com/babelouest/ulfius/releases/download/v2.7.3/libulfius-dev_2.7.3_debian_buster_armv7l.deb https://github.com/babelouest/ulfius/releases/download/v2.7.3/ulfius-dev-full_2.7.3_debian_buster_armv7l.tar.gz

Can you try to install this package? If you still have your issue to build the example programs we'll restart from there...

LloydShelby commented 2 years ago

Fantastic! I did a total restore and installed the 2.7.2 packages as you indicated and the build was resolved. I will try the 2.7.3 as well. Thank you for being so responsive and well organized, this project is exactly what I have been looking for. Thanks again, Lloyd

babelouest commented 2 years ago

No problem, happy hacking!