HTTP library
-
wrote on 19 Jan 2023, 07:49 last edited by
I build the library as instructed
# first clone this repository: $> git clone https://github.com/azadkuh/qhttp.git $> cd qhttp # prepare dependencies: $qhttp/> ./update-dependencies.sh # now build the library and the examples $qhttp/> qmake -r qhttp.pro $qhttp/> make -j 8
Now I want to include it in my project (as I do with others libs)
LIBS += -lqhttp
And get
error: cannot find -lqhttpHow can I actually include the lib in the project?
-
I build the library as instructed
# first clone this repository: $> git clone https://github.com/azadkuh/qhttp.git $> cd qhttp # prepare dependencies: $qhttp/> ./update-dependencies.sh # now build the library and the examples $qhttp/> qmake -r qhttp.pro $qhttp/> make -j 8
Now I want to include it in my project (as I do with others libs)
LIBS += -lqhttp
And get
error: cannot find -lqhttpHow can I actually include the lib in the project?
@jenya7 said in HTTP library:
How can I actually include the lib in the project?
You forgot to tell linker where to find the lib:
LIBS += -LFOLDER_CONTAINING_THE_LIB -lqhttp
-
wrote on 19 Jan 2023, 08:07 last edited by
Typically a library like this would have an
install
target in its Makefile (that derives from the PRO file). Not the case here.The built library is in the
qhttp_build_dir/xbin
folder.
The headers needed to compile code to use the library remain in theqhttp/src
folder.You need to install the resulting library and public headers into a system library or include folder.
Alternatively, add the folder to your project:INCLUDEPATH += /a/path/to/qhttp/src LIBS += -L/a/path/to/qhttp_build_dir/xbin -lqhttp
Use absolute paths unless you are certain about relative paths.
-
@jenya7 said in HTTP library:
How can I actually include the lib in the project?
You forgot to tell linker where to find the lib:
LIBS += -LFOLDER_CONTAINING_THE_LIB -lqhttp
wrote on 19 Jan 2023, 08:14 last edited by@jsulm said in HTTP library:
@jenya7 said in HTTP library:
How can I actually include the lib in the project?
You forgot to tell linker where to find the lib:
LIBS += -LFOLDER_CONTAINING_THE_LIB -lqhttp
I tried
INCLUDEPATH += /home/pi/qhttp/xbin
Still can't find it.
A folder xbin was created home/pi/qhttp/xbin but I see only a shortcut to libqhttp.so in it.
-
@jsulm said in HTTP library:
@jenya7 said in HTTP library:
How can I actually include the lib in the project?
You forgot to tell linker where to find the lib:
LIBS += -LFOLDER_CONTAINING_THE_LIB -lqhttp
I tried
INCLUDEPATH += /home/pi/qhttp/xbin
Still can't find it.
A folder xbin was created home/pi/qhttp/xbin but I see only a shortcut to libqhttp.so in it.
@jenya7 Please reread what I wrote, I did not write anything about INCLUDEPATH...
-
Typically a library like this would have an
install
target in its Makefile (that derives from the PRO file). Not the case here.The built library is in the
qhttp_build_dir/xbin
folder.
The headers needed to compile code to use the library remain in theqhttp/src
folder.You need to install the resulting library and public headers into a system library or include folder.
Alternatively, add the folder to your project:INCLUDEPATH += /a/path/to/qhttp/src LIBS += -L/a/path/to/qhttp_build_dir/xbin -lqhttp
Use absolute paths unless you are certain about relative paths.
wrote on 19 Jan 2023, 08:36 last edited by@ChrisW67 said in HTTP library:
Typically a library like this would have an
install
target in its Makefile (that derives from the PRO file). Not the case here.The built library is in the
qhttp_build_dir/xbin
folder.
The headers needed to compile code to use the library remain in theqhttp/src
folder.You need to install the resulting library and public headers into a system library or include folder.
Alternatively, add the folder to your project:INCLUDEPATH += /a/path/to/qhttp/src LIBS += -L/a/path/to/qhttp_build_dir/xbin -lqhttp
Use absolute paths unless you are certain about relative paths.
thank you. it works.
-
wrote on 19 Jan 2023, 08:37 last edited by
@jsulm said in HTTP library:
@jenya7 Please reread what I wrote, I did not write anything about INCLUDEPATH...
I missed -L. :)
-
wrote on 19 Jan 2023, 08:50 last edited by jenya7
Now it compiles good. But in run time I get
Starting /home/pi/Projects/build-AgroLogicWidget-Desktop-Debug/AgroLogicWidget...
/home/pi/Projects/build-AgroLogicWidget-Desktop-Debug/AgroLogicWidget: error while loading shared libraries: libqhttp.so.1: cannot open shared object file: No such file or directory/home/pi/Projects/build-AgroLogicWidget-Desktop-Debug/AgroLogicWidget exited with code 127
-
Now it compiles good. But in run time I get
Starting /home/pi/Projects/build-AgroLogicWidget-Desktop-Debug/AgroLogicWidget...
/home/pi/Projects/build-AgroLogicWidget-Desktop-Debug/AgroLogicWidget: error while loading shared libraries: libqhttp.so.1: cannot open shared object file: No such file or directory/home/pi/Projects/build-AgroLogicWidget-Desktop-Debug/AgroLogicWidget exited with code 127
-
Now it compiles good. But in run time I get
Starting /home/pi/Projects/build-AgroLogicWidget-Desktop-Debug/AgroLogicWidget...
/home/pi/Projects/build-AgroLogicWidget-Desktop-Debug/AgroLogicWidget: error while loading shared libraries: libqhttp.so.1: cannot open shared object file: No such file or directory/home/pi/Projects/build-AgroLogicWidget-Desktop-Debug/AgroLogicWidget exited with code 127
@jenya7 said in HTTP library:
libqhttp.so.1
Copy it into your build folder (/home/pi/Projects/build-AgroLogicWidget-Desktop-Debug).
As another solution you can also set LD_LIBRARY_PATH=/home/pi/Projects/build-AgroLogicWidget-Desktop-Debug in your Run configuration in QtCreator. -
@jenya7 said in HTTP library:
libqhttp.so.1
Copy it into your build folder (/home/pi/Projects/build-AgroLogicWidget-Desktop-Debug).
As another solution you can also set LD_LIBRARY_PATH=/home/pi/Projects/build-AgroLogicWidget-Desktop-Debug in your Run configuration in QtCreator.wrote on 19 Jan 2023, 09:40 last edited by@jsulm said in HTTP library:
@jenya7 said in HTTP library:
libqhttp.so.1
Copy it into your build folder (/home/pi/Projects/build-AgroLogicWidget-Desktop-Debug).
As another solution you can also set LD_LIBRARY_PATH=/home/pi/Projects/build-AgroLogicWidget-Desktop-Debug in your Run configuration in QtCreator.it happens in Debug as well.
-
@jenya7
So where is yourlibqhttp.so.1
and how does your application locate it at runtime? And if it can be found, does runningldd
on it reveal any missing dependencies?wrote on 19 Jan 2023, 09:41 last edited by@JonB said in HTTP library:
@jenya7
So where is yourlibqhttp.so.1
and how does your application locate it at runtime? And if it can be found, does runningldd
on it reveal any missing dependencies?How do we know which one is missing?
ldd /home/pi/qhttp/xbin/libqhttp.so.1 linux-vdso.so.1 (0xbef67000) /usr/lib/arm-linux-gnueabihf/libarmmem-${PLATFORM}.so => /usr/lib/arm-linux-gnueabihf/libarmmem-v7l.so (0xb6f16000) libQt5Network.so.5 => /lib/arm-linux-gnueabihf/libQt5Network.so.5 (0xb6d6a000) libQt5Core.so.5 => /lib/arm-linux-gnueabihf/libQt5Core.so.5 (0xb68f0000) libpthread.so.0 => /lib/arm-linux-gnueabihf/libpthread.so.0 (0xb68c6000) libatomic.so.1 => /lib/arm-linux-gnueabihf/libatomic.so.1 (0xb68ad000) libstdc++.so.6 => /lib/arm-linux-gnueabihf/libstdc++.so.6 (0xb6766000) libm.so.6 => /lib/arm-linux-gnueabihf/libm.so.6 (0xb66e4000) libgcc_s.so.1 => /lib/arm-linux-gnueabihf/libgcc_s.so.1 (0xb66b7000) libc.so.6 => /lib/arm-linux-gnueabihf/libc.so.6 (0xb6569000) libz.so.1 => /lib/arm-linux-gnueabihf/libz.so.1 (0xb653e000) /lib/ld-linux-armhf.so.3 (0xb6f5c000) libicui18n.so.63 => /lib/arm-linux-gnueabihf/libicui18n.so.63 (0xb62f0000) libicuuc.so.63 => /lib/arm-linux-gnueabihf/libicuuc.so.63 (0xb616a000) libpcre2-16.so.0 => /lib/arm-linux-gnueabihf/libpcre2-16.so.0 (0xb60ee000) libdouble-conversion.so.1 => /lib/arm-linux-gnueabihf/libdouble-conversion.so.1 (0xb60ca000) libdl.so.2 => /lib/arm-linux-gnueabihf/libdl.so.2 (0xb60b7000) libglib-2.0.so.0 => /lib/arm-linux-gnueabihf/libglib-2.0.so.0 (0xb5fa7000) libicudata.so.63 => /lib/arm-linux-gnueabihf/libicudata.so.63 (0xb45a9000) libpcre.so.3 => /lib/arm-linux-gnueabihf/libpcre.so.3 (0xb4532000)
-
@JonB said in HTTP library:
@jenya7
So where is yourlibqhttp.so.1
and how does your application locate it at runtime? And if it can be found, does runningldd
on it reveal any missing dependencies?How do we know which one is missing?
ldd /home/pi/qhttp/xbin/libqhttp.so.1 linux-vdso.so.1 (0xbef67000) /usr/lib/arm-linux-gnueabihf/libarmmem-${PLATFORM}.so => /usr/lib/arm-linux-gnueabihf/libarmmem-v7l.so (0xb6f16000) libQt5Network.so.5 => /lib/arm-linux-gnueabihf/libQt5Network.so.5 (0xb6d6a000) libQt5Core.so.5 => /lib/arm-linux-gnueabihf/libQt5Core.so.5 (0xb68f0000) libpthread.so.0 => /lib/arm-linux-gnueabihf/libpthread.so.0 (0xb68c6000) libatomic.so.1 => /lib/arm-linux-gnueabihf/libatomic.so.1 (0xb68ad000) libstdc++.so.6 => /lib/arm-linux-gnueabihf/libstdc++.so.6 (0xb6766000) libm.so.6 => /lib/arm-linux-gnueabihf/libm.so.6 (0xb66e4000) libgcc_s.so.1 => /lib/arm-linux-gnueabihf/libgcc_s.so.1 (0xb66b7000) libc.so.6 => /lib/arm-linux-gnueabihf/libc.so.6 (0xb6569000) libz.so.1 => /lib/arm-linux-gnueabihf/libz.so.1 (0xb653e000) /lib/ld-linux-armhf.so.3 (0xb6f5c000) libicui18n.so.63 => /lib/arm-linux-gnueabihf/libicui18n.so.63 (0xb62f0000) libicuuc.so.63 => /lib/arm-linux-gnueabihf/libicuuc.so.63 (0xb616a000) libpcre2-16.so.0 => /lib/arm-linux-gnueabihf/libpcre2-16.so.0 (0xb60ee000) libdouble-conversion.so.1 => /lib/arm-linux-gnueabihf/libdouble-conversion.so.1 (0xb60ca000) libdl.so.2 => /lib/arm-linux-gnueabihf/libdl.so.2 (0xb60b7000) libglib-2.0.so.0 => /lib/arm-linux-gnueabihf/libglib-2.0.so.0 (0xb5fa7000) libicudata.so.63 => /lib/arm-linux-gnueabihf/libicudata.so.63 (0xb45a9000) libpcre.so.3 => /lib/arm-linux-gnueabihf/libpcre.so.3 (0xb4532000)
-
@jenya7
This shows it is not missing any dependencies. So how do you think your application should know to find and load it from/home/pi/qhttp/xbin
?wrote on 19 Jan 2023, 09:50 last edited by@JonB said in HTTP library:
@jenya7
This shows it is not missing any dependencies. So how do you think your application should know to find and load it from/home/pi/qhttp/xbin
?I have
LIBS += -L/home/pi/qhttp/xbin -lqhttp
in pro file
-
@JonB said in HTTP library:
@jenya7
This shows it is not missing any dependencies. So how do you think your application should know to find and load it from/home/pi/qhttp/xbin
?I have
LIBS += -L/home/pi/qhttp/xbin -lqhttp
in pro file
-
@jenya7
Sorry, Why do you want use this library? I checked source code, httpclient does not use Qnetworkmanager but, it sends directly with QTcpSocket.Thanks
wrote on 19 Jan 2023, 10:03 last edited by jenya7@piervalli said in HTTP library:
@jenya7
Sorry, Why do you want use this library? I checked source code, httpclient does not use Qnetworkmanager but, it sends directly with QTcpSocket.Thanks
I'm not tied to the lib. any lib I can include in my project without having a heart attack will go. do you have one to suggest?
-
@JonB said in HTTP library:
@jenya7
This shows it is not missing any dependencies. So how do you think your application should know to find and load it from/home/pi/qhttp/xbin
?I have
LIBS += -L/home/pi/qhttp/xbin -lqhttp
in pro file
wrote on 19 Jan 2023, 10:16 last edited by JonB@jenya7 said in HTTP library:
LIBS += -L/home/pi/qhttp/xbin -lqhttp
This tells the linker where to locate the
libqhttp.a
file while linking. I am not sure that it puts anything into the executable to tell it to look in that directory for thelibqhttp.so
file at runtime. See @jsulm's last post earlier on above. -
@jenya7 said in HTTP library:
LIBS += -L/home/pi/qhttp/xbin -lqhttp
This tells the linker where to locate the
libqhttp.a
file while linking. I am not sure that it puts anything into the executable to tell it to look in that directory for thelibqhttp.so
file at runtime. See @jsulm's last post earlier on above.wrote on 19 Jan 2023, 10:30 last edited by@JonB said in HTTP library:
@jenya7 said in HTTP library:
LIBS += -L/home/pi/qhttp/xbin -lqhttp
This tells the linker where to locate the
libqhttp.a
file while linking. I am not sure that it puts anything into the executable to tell it to look in that directory for thelibqhttp.so
file at runtime. See @jsulm's last post earlier on above.There is no libqhttp.so in Debug folder. I don't know how it's linked in run time.
-
@JonB said in HTTP library:
@jenya7 said in HTTP library:
LIBS += -L/home/pi/qhttp/xbin -lqhttp
This tells the linker where to locate the
libqhttp.a
file while linking. I am not sure that it puts anything into the executable to tell it to look in that directory for thelibqhttp.so
file at runtime. See @jsulm's last post earlier on above.There is no libqhttp.so in Debug folder. I don't know how it's linked in run time.
wrote on 19 Jan 2023, 10:55 last edited by -
wrote on 19 Jan 2023, 13:24 last edited by
well...no luck with the lib. do we have something more user friendly?
1/29