microhttp guidance please
lazarus / 38-Networking and Web Programming
----------------------------------------------------------------------
Michael Collier · 2024-08-02 20:26
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 · 2024-08-03 02:11
On Ubuntu 20.04.
Code: Text [Select][+][-]window.onload = function(){var x1 =
document.getElementById("main_content_section"); if (x1) { var x =
document.getElementsByClassName("geshi");for (var i = 0; i % 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/
Simple server demo
If you see this
page, it demonstrates that the simple server demo serves theindex.html page.
If it shows index.html in
adifferent style, it means the css is loaded as well.
End user needs libmicrohttpd.so.12:
Code: Text [Select][+][-]window.onload = function(){var x1 =
document.getElementById("main_content_section"); if (x1) { var x =
document.getElementsByClassName("geshi");for (var i = 0; i % ldd
simpleserver | egrep micro(standard input): libmicrohttpd.so.12
=> /lib/x86_64-linux-gnu/libmicrohttpd.so.12 (0x00007f33b374e000)
----------------------------------------------------------------------
MarkMLl · 2024-08-03 07:13
Quote from: PierceNg on August 03, 2024, 04:11:55 amEnd user needs
libmicrohttpd.so.12:
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 [Select][+][-]window.onload = function(){var x1 =
document.getElementById("main_content_section"); if (x1) { var x =
document.getElementsByClassName("geshi");for (var i = 0; i $ apt-cache
search microhttpd...libmicrohttpd-dev - library embedding HTTP server
functionality (development)...
and
Code: Text [Select][+][-]window.onload = function(){var x1 =
document.getElementById("main_content_section"); if (x1) { var x =
document.getElementsByClassName("geshi");for (var i = 0; i $ 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 · 2024-08-07 01:27
..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 [Select][+][-]window.onload = function(){var x1 =
document.getElementById("main_content_section"); if (x1) { var x =
document.getElementsByClassName("geshi");for (var i = 0; i 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 · 2024-08-07 05:43
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.
----------------------------------------------------------------------
Michael Collier · 2024-08-08 00:31
Quote from: Thaddy on August 07, 2024, 07:43:36 amWhat happens if you
copy libmicrohttpd.pp and the example over to a new directory and
change the version to libmicrohttpd-12 ?
It gave error 0xc0000022
Quote from: Thaddy on August 07, 2024, 07:43:36 amYou need to use a
32bit FPC compiler.
I used fpcupdeluxe to install i386 compiler and tried with that
(Target OS=Win32 and Target CPU=i386) I can't seem to compile Win64 &
i386 (I get FPC configuration warning)
I've gone through all combinations I can think of to compile 32/64 bit
and trying different DLL (10 & 12).
Always same error 0xc0000022
----------------------------------------------------------------------
Thaddy · 2024-08-08 05:51
I seem to remember that error 0xc0000022 is a permissions issue. Try
to run as administrator and if that works, add a manifest resource
with elevated rights.
Example manifest:Code: XML [Select][+][-]window.onload =
function(){var x1 = document.getElementById("main_content_section");
if (x1) { var x = document.getElementsByClassName("geshi");for (var i
= 0; i Your application description
It may be enough to add this instead:Code: XML
[Select][+][-]window.onload = function(){var x1 =
document.getElementById("main_content_section"); if (x1) { var x =
document.getElementsByClassName("geshi");for (var i = 0; i
The latter means that if the user is in the
administrator group, requireAdministrator will be in effect.
Users that are not in the administrator group can not run the
application, but will be notified that they have insufficient rights.
----------------------------------------------------------------------
Michael Collier · 2024-08-08 22:25
Quote from: Thaddy on August 08, 2024, 07:51:34 amI seem to remember
that error 0xc0000022 is a permissions issue.
Ok yes that seemed to be the problem..
The exe and DLL's reside on a linux drive, the windows machine has a
drive mapped to their location.
When I copy the exe and DLL's to windows desktop and run from there it
is ok, but (so far...) must use exe compiled as 32 bit and use the
version 10 DLL's - but at least it is running now.
----------------------------------------------------------------------
Michael Collier · 2024-08-11 21:09
I'd like to get macOS (macbook air) working too..
Found libmicrohttpd on this site, is it the correct download?
(couldn't find libmicrohttpd-dev as per linux):
https://formulae.brew.sh/formula/libmicrohttpd
So I installed the Homebrew system (https://brew.sh/)
/bin/bash -c "$(curl -fsSL
https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
And installed libmicrohttpd
brew install libmicrohttpd
I can see header file (microhttpd.h) and dylib files (
libmicrohttpd.12.dylib and 'shortcut' libmicrohttpd.dylib ). I've
tried copying these files into simpleserver project directory (tried
other directories, and setting library paths) but get linker errors.
The errors are 'undefined symbols for architecture x86_64' and list of
names of functions that I can find in header file.
I'm not sure what to try next..?