Forum > Networking and Web Programming

microhttp guidance please

(1/2) > >>

Michael Collier:
Hi,

I'm playing with the simpleserver example fpcupdeluxe/fpcsrc/packages/fcl-web/examples/simpleserver and noticed {$DEFINE USEMICROHTTP}

Looks interesting but I don't know what to download / install to get the demo to link "Error: Error while linking"

I'm using linux at the moment and found references to installing micro-httpd via apt-get.
I also found download libmicrohttpd here https://www.gnu.org/software/libmicrohttpd/

Can anyone point me in the right direction please?

What should I do to get the demo to link?

Also curious about what the end-user would need to download / install for the application to run?

TIA
Mike

PierceNg:
On Ubuntu 20.04.


--- Code: Text  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---% sudo apt install libmicrohttpd-dev... %  ls -ltotal 924-rw-r--r-- 1 pierce pierce     28 Oct 16  2021 index.css-rw-r--r-- 1 pierce pierce    308 Oct 16  2021 index.html-rw-r--r-- 1 pierce pierce  24301 Oct 16  2021 mime.types-rw-r--r-- 1 pierce pierce   1023 Oct 16  2021 README.txt-rw-r--r-- 1 pierce pierce   1924 Oct 16  2021 simpleserver.lpi-rw-r--r-- 1 pierce pierce  10747 Jan 13  2022 simpleserver.pas % lazbuild simpleserver.lpi...(9015) Linking /home/pierce/pkg/fpc/share/fpcsrc/3.2.2/packages/fcl-web/examples/simpleserver/simpleserver(1008) 9764 lines compiled, 0.8 sec(1021) 39 warning(s) issued(1022) 22 hint(s) issued(1023) 2 note(s) issued % ./simpleserver -p 80802024-08-03 09:55:07.360 [etInfo] Listening on port 8080, serving files from directory: /home/pierce/pkg/fpc/share/fpcsrc/3.2.2/packages/fcl-web/examples/simpleserver/ (using SSL: false)2024-08-03 09:55:07.360 [etInfo] Using index page index.htmlServer created. % curl http://localhost:8080/<http><link rel="stylesheet" href="index.css"><body><H1>Simple server demo</H1>If you see this page, it demonstrates that the simple server demo serves the<span class="important">index.html</span> page. <p>If it shows index.html in adifferent style, it means the css is loaded as well.</body></http>
End user needs libmicrohttpd.so.12:


--- Code: Text  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---% ldd simpleserver | egrep micro(standard input):       libmicrohttpd.so.12 => /lib/x86_64-linux-gnu/libmicrohttpd.so.12 (0x00007f33b374e000)

MarkMLl:

--- Quote from: PierceNg on August 03, 2024, 04:11:55 am ---End user needs libmicrohttpd.so.12:

--- End quote ---

OP's out of order for not telling us what OS he was running: "Linux" is a kernel and potentially includes a multitude of embedded systems etc. However on Debian:


--- Code: Text  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---$ apt-cache search microhttpd...libmicrohttpd-dev - library embedding HTTP server functionality (development)... 
and


--- Code: Text  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---$ apt-file search libmicrohttpd.so.12libmicrohttpd12: /usr/lib/x86_64-linux-gnu/libmicrohttpd.so.12libmicrohttpd12: /usr/lib/x86_64-linux-gnu/libmicrohttpd.so.12.60.0 
There's a minor disparity in the package name there, but it's probably that -dev package which ensures that files and symlinks are in place.

MarkMLl

Michael Collier:
..Linux working ok..

Trying also on windows11 64 bit machine, error missing DLL (libmicrohttpd-10.dll)

The latest windows download (32 bit?) conatains DLL version 12 (libmicrohttpd-12.dll)
https://ftpmirror.gnu.org/libmicrohttpd/libmicrohttpd-latest-w32-bin.zip

Found pre-compiled DLL (libmicrohttpd-10.dll) in old download here (32 bit?)..
https://ftp.gnu.org/gnu/libmicrohttpd/libmicrohttpd-0.9.35-w32.zip

Pascal code specifies version 10 here,,
/fpcupdeluxe/fpcsrc/packages/libmicrohttpd/src

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---const  MHD_LIB_NAME = {$IFDEF MSWINDOWS}'libmicrohttpd-10'{$ELSE}'microhttpd'{$ENDIF};    
I can't seem to get the simpleserver to run, get error 0xc0000022

Not sure what options to use for compiling and/or files to download to get it working..

Tried variations, nothing worked for me but was mostly guessing..

Thaddy:
What happens if you copy  libmicrohttpd.pp and the example over to a new directory and change the version to libmicrohttpd-12 ?
You need to use a 32bit FPC compiler. Could not find a precompiled 64 bit dll version for Windows, although you might be able to build it from source.

Navigation

[0] Message Index

[#] Next page

Go to full version