Hi Everyone,
We're using several libraries in our product, and most of them just work by adding a line like:
LIBS = libc
However in some cases this is not sufficient. For example lwip requires an additional include directive:
INC_DIR += $(REP_DIR)/src/lib/lwip/include (line from repos/libports/src/test/lwip/http_srv_static/target.mk)
Leaving out this line will result in a compilation error of a local include file. Looking at various library ports (mbedtls, polarssl, curl, and probably more) we see similar behavior. Usually some library configuration header file should be added manually to the include path to make things work.
Adding this extra line for a default library configuration feels redundant, so we're wondering we might do something we're not supposed to do, or should be done in a different way?
Thanks, Menno
Hello Menno,
On Tue, Jun 21, 2016 at 01:01:55PM +0200, Menno Valkema wrote:
However in some cases this is not sufficient. For example lwip requires an additional include directive:
INC_DIR += $(REP_DIR)/src/lib/lwip/include (line from repos/libports/src/test/lwip/http_srv_static/target.mk)
If I remove this line from target.mk the test component compiles without error.
Leaving out this line will result in a compilation error of a local include file. Looking at various library ports (mbedtls, polarssl, curl, and probably more) we see similar behavior. Usually some library configuration header file should be added manually to the include path to make things work.
Could you please be more specific about the error message or maybe point out an example in the public sources that breaks if the INC_DIR directive is removed?
Regards
Hello Christian,
Thanks for your reply. A better example is the curl library. I've put together an example to reproduce the behavior.
Attached a patch which includes the curl library into the hello tutorial. It doesn't call any methods of the library, but it does include <curl/curl.h> and shows the necessity of the extra INC_DIR directive.
To run it I take the following steps: $ git clone https://github.com/genodelabs/genode.git hello_curl $ cd hello_curl
Patch the sources with the attached hello_curl.patch $ patch -p1 < ~/tmp/hello_curl.patch $ ./tool/create_builddir linux_x86 $ cd build/linux_x86 $ echo 'REPOSITORIES += $(GENODE_DIR)/repos/hello_tutorial' >> \ etc/build.conf $ echo 'REPOSITORIES += $(GENODE_DIR)/repos/libports' >> etc/build.conf $ ../../tool/ports/prepare_port curl libc libssh openssl zlib $ make run/hello
This compiles and runs fine (not doing anything functional).
Now remove the following line from repos/hello_tutorial/src/hello/client/target.mk:
INC_DIR += $(REP_DIR)/../libports/src/lib/curl/spec/64bit/curl/
Running it again will give you an error about a missing "curlbuild.h". Hence our question what are we doing wrong? Is this behavior by design, or should we take different steps to include and use the library port?
Thanks, Menno
PS. I've tested lwip in a similar way, and you're right: the error is not there.
I think I had the same issue with curl, I just filed an issue about this: https://github.com/genodelabs/genode/issues/2021
Emery
On Wed, Jun 22, 2016 at 10:39:38AM +0200, Menno Valkema wrote:
Hello Christian,
Thanks for your reply. A better example is the curl library. I've put together an example to reproduce the behavior.
Attached a patch which includes the curl library into the hello tutorial. It doesn't call any methods of the library, but it does include <curl/curl.h> and shows the necessity of the extra INC_DIR directive.
To run it I take the following steps: $ git clone https://github.com/genodelabs/genode.git hello_curl $ cd hello_curl
Patch the sources with the attached hello_curl.patch $ patch -p1 < ~/tmp/hello_curl.patch $ ./tool/create_builddir linux_x86 $ cd build/linux_x86 $ echo 'REPOSITORIES += $(GENODE_DIR)/repos/hello_tutorial' >> \ etc/build.conf $ echo 'REPOSITORIES += $(GENODE_DIR)/repos/libports' >> etc/build.conf $ ../../tool/ports/prepare_port curl libc libssh openssl zlib $ make run/hello
This compiles and runs fine (not doing anything functional).
Now remove the following line from repos/hello_tutorial/src/hello/client/target.mk:
INC_DIR += $(REP_DIR)/../libports/src/lib/curl/spec/64bit/curl/
Running it again will give you an error about a missing "curlbuild.h". Hence our question what are we doing wrong? Is this behavior by design, or should we take different steps to include and use the library port?
Thanks, Menno
PS. I've tested lwip in a similar way, and you're right: the error is not there.
-- Cyber Security Labs B.V. | https://nlcsl.com Gooimeer 6-31 | 1411 DD Naarden | The Netherlands
On 21-06-16 14:10, Christian Helmuth wrote:
Hello Menno,
On Tue, Jun 21, 2016 at 01:01:55PM +0200, Menno Valkema wrote:
However in some cases this is not sufficient. For example lwip requires an additional include directive:
INC_DIR += $(REP_DIR)/src/lib/lwip/include (line from repos/libports/src/test/lwip/http_srv_static/target.mk)
If I remove this line from target.mk the test component compiles without error.
Leaving out this line will result in a compilation error of a local include file. Looking at various library ports (mbedtls, polarssl, curl, and probably more) we see similar behavior. Usually some library configuration header file should be added manually to the include path to make things work.
Could you please be more specific about the error message or maybe point out an example in the public sources that breaks if the INC_DIR directive is removed?
Regards
diff --git a/repos/hello_tutorial/run/hello.run b/repos/hello_tutorial/run/hello.run index 0dd52d8..9f017f0 100644 --- a/repos/hello_tutorial/run/hello.run +++ b/repos/hello_tutorial/run/hello.run @@ -14,6 +14,7 @@ install_config {
<config> <parent-provides> <service name="LOG"/> + <service name="ROM"/> </parent-provides> <default-route> <any-service> <parent/> <any-child/> </any-service> @@ -31,7 +32,8 @@ install_config { # Boot image #
-build_boot_image { core init hello_client hello_server } +build_boot_image { core init hello_client hello_server
- curl.lib.so ld.lib.so libc.lib.so libcrypto.lib.so libssh.lib.so libssl.lib.so zlib.lib.so }
append qemu_args " -nographic "
diff --git a/repos/hello_tutorial/src/hello/client/main.cc b/repos/hello_tutorial/src/hello/client/main.cc index f600117..19bc1e4 100644 --- a/repos/hello_tutorial/src/hello/client/main.cc +++ b/repos/hello_tutorial/src/hello/client/main.cc @@ -16,6 +16,7 @@ #include <base/log.h> #include <hello_session/connection.h>
+#include <curl/curl.h>
Genode::size_t Component::stack_size() { return 64*1024; }
diff --git a/repos/hello_tutorial/src/hello/client/target.mk b/repos/hello_tutorial/src/hello/client/target.mk index 3d69e29..7987979 100644 --- a/repos/hello_tutorial/src/hello/client/target.mk +++ b/repos/hello_tutorial/src/hello/client/target.mk @@ -1,3 +1,4 @@ TARGET = hello_client SRC_CC = main.cc -LIBS = base +LIBS = base curl libc +INC_DIR += $(REP_DIR)/../libports/src/lib/curl/spec/64bit/curl/
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San Francisco, CA to explore cutting-edge tech and listen to tech luminaries present their vision of the future. This family event has something for everyone, including kids. Get more information and register today. http://sdm.link/attshape
genode-main mailing list genode-main@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/genode-main
Hello Menno,
* Menno Valkema <menno.genode@...9...> [2016-06-22 10:39:38 +0200]:
Now remove the following line from repos/hello_tutorial/src/hello/client/target.mk:
INC_DIR += $(REP_DIR)/../libports/src/lib/curl/spec/64bit/curl/
Running it again will give you an error about a missing "curlbuild.h". Hence our question what are we doing wrong? Is this behavior by design, or should we take different steps to include and use the library port?
The problem here is that the import file contains an incorrect include path and is therefore not picked up by Genode's build system. Please see the attached patch [1] for a fix.
Regards, Josef
Hi Josef,
I've tested your patch and this solves the issue! Thanks.
Whenever we encounter similar behavior we'll report it or sent a fix for the .mk files, and refrain from coming up with INC_DIR-based workarounds in our own project ;-)
Cheers, Menno