unikraft / lib-libsodium

Unikraft port of libsodium, a crypto library
Other
0 stars 5 forks source link

Possible missing internal dependency #5

Closed hchandad closed 1 year ago

hchandad commented 2 years ago

As part of working on lib-mimalloc#2, trying to run the app-helloworld app with this change to the Makefile

diff --git a/Makefile b/Makefile
index 5426bae..3e13e23 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
 UK_ROOT ?= $(PWD)/../../unikraft
 UK_LIBS ?= $(PWD)/../../libs
-LIBS :=
+LIBS := $(UK_LIBS)/lib-newlib:$(UK_LIBS)/lib-libsodium

 all:
        @$(MAKE) -C $(UK_ROOT) A=$(PWD) L=$(LIBS)

Fails to link with the following error undefined reference to 'poll'

  LD      app-helloworld-libsodium_kvm-x86_64.dbg
/usr/bin/ld: /home/ubuntu/usoc22/apps/app-helloworld-libsodium/build/app-helloworld-libsodium_kvm-x86_64.o: in function `randombytes_block_on_dev_random':
/home/ubuntu/usoc22/apps/app-helloworld-libsodium/build/libsodium/origin/libsodium-1.0.18/src/libsodium/randombytes/internal/randombytes_internal_random.c:265: undefined reference to `poll'
/usr/bin/ld: /home/ubuntu/usoc22/apps/app-helloworld-libsodium/build/app-helloworld-libsodium_kvm-x86_64.o: in function `randombytes_block_on_dev_random':
/home/ubuntu/usoc22/apps/app-helloworld-libsodium/build/libsodium/origin/libsodium-1.0.18/src/libsodium/randombytes/sysrandom/randombytes_sysrandom.c:166: undefined reference to `poll'
collect2: error: ld returned 1 exit status
make[3]: *** [/home/ubuntu/usoc22/unikraft/plat/kvm/Linker.uk:24: /home/ubuntu/usoc22/apps/app-helloworld-libsodium/build/app-helloworld-libsodium_kvm-x86_64.dbg] Error 1
make[2]: *** [Makefile:1016: sub-make] Error 2
make[1]: *** [Makefile:32: _all] Error 2
make[1]: Leaving directory '/home/ubuntu/usoc22/unikraft'
make: *** [Makefile:6: all] Error 2

If this is reproducible, i have included a patch for updating the dependencies list

diff --git a/Config.uk b/Config.uk
index be95b8a..27af070 100644
--- a/Config.uk
+++ b/Config.uk
@@ -3,6 +3,7 @@ menuconfig LIBSODIUM
    default n
    select LIBNEWLIBC
    select LIBUKSWRAND
+   select LIBPOSIX_EVENT

 if LIBSODIUM
    config LIBSODIUM_TEST
diff --git a/README.md b/README.md
index e362218..3246fe1 100644
--- a/README.md
+++ b/README.md
@@ -12,6 +12,7 @@ equivalent state of configuring libsodium using `configure --enable-minimal`.
 libsodium on Unikraft depends on the following Unikraft libraries:
 * lib-newlib (external)
 * ukswrand (internal)
+* posix-event (internal)

 Both dependencies are automatically enabled via KConfig.
hchandad commented 2 years ago

Pull Request: #6

kubanrob commented 1 year ago

@razvand The linked pull request is closed, but this issue is still open.

razvand commented 1 year ago

Thanks, @kubanrob . I closed this issue.