Skip to content

Conversation

elmarco
Copy link
Contributor

@elmarco elmarco commented Dec 3, 2019

libslirp 4.1 is soon to be released. It will be possible to link directly with it.

@AkihiroSuda
Copy link
Member

thanks!

@AkihiroSuda
Copy link
Member

cc @rootless-containers/slirp4netns-package-maintainers PTAL RFC

@barthalion
Copy link
Member

I've just pushed libslirp to Arch's [community] repository. No complaints from me on PR itself, LGTM.

@AkihiroSuda
Copy link
Member

ping

@siretart
Copy link

I've tried applying this patch onto the latest v0.4.3 release. I had to manually resolve some minor conflicts, but I still fail to link against libslirp in debian/unstable. This is what the error looks like:

   dh_auto_build
	make -j1
make[1]: Entering directory '/<<PKGBUILDDIR>>'
make  all-am
make[2]: Entering directory '/<<PKGBUILDDIR>>'
gcc -DHAVE_CONFIG_H -I.   -Wdate-time -D_FORTIFY_SOURCE=2 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/slirp -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include   -DCOMMIT="\"2244b9b6461afeccad1678fac3d6e478c28b4ad6\"" -g -O2 -fdebug-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -c -o slirp4netns-main.o `test -f 'main.c' || echo './'`main.c
gcc -DHAVE_CONFIG_H -I.   -Wdate-time -D_FORTIFY_SOURCE=2 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/slirp -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include   -DCOMMIT="\"2244b9b6461afeccad1678fac3d6e478c28b4ad6\"" -g -O2 -fdebug-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -c -o slirp4netns-slirp4netns.o `test -f 'slirp4netns.c' || echo './'`slirp4netns.c
gcc -DHAVE_CONFIG_H -I.   -Wdate-time -D_FORTIFY_SOURCE=2 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/slirp -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include   -DCOMMIT="\"2244b9b6461afeccad1678fac3d6e478c28b4ad6\"" -g -O2 -fdebug-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -c -o slirp4netns-api.o `test -f 'api.c' || echo './'`api.c
gcc -DHAVE_CONFIG_H -I.   -Wdate-time -D_FORTIFY_SOURCE=2 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/slirp -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include   -DCOMMIT="\"2244b9b6461afeccad1678fac3d6e478c28b4ad6\"" -g -O2 -fdebug-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -c -o slirp4netns-sandbox.o `test -f 'sandbox.c' || echo './'`sandbox.c
gcc -DHAVE_CONFIG_H -I.   -Wdate-time -D_FORTIFY_SOURCE=2 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/slirp -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include   -DCOMMIT="\"2244b9b6461afeccad1678fac3d6e478c28b4ad6\"" -g -O2 -fdebug-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -c -o slirp4netns-seccompfilter.o `test -f 'seccompfilter.c' || echo './'`seccompfilter.c
gcc -DHAVE_CONFIG_H -I.   -Wdate-time -D_FORTIFY_SOURCE=2 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/slirp -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include   -I/<<PKGBUILDDIR>>/vendor/parson -g -O2 -fdebug-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -c -o vendor/parson/libparson_a-parson.o `test -f 'vendor/parson/parson.c' || echo './'`vendor/parson/parson.c
rm -f libparson.a
ar cru libparson.a vendor/parson/libparson_a-parson.o 
ar: `u' modifier ignored since `D' is the default (see `U')
ranlib libparson.a
gcc -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/slirp -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include   -DCOMMIT="\"2244b9b6461afeccad1678fac3d6e478c28b4ad6\"" -g -O2 -fdebug-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -lglib-2.0 -lslirp -lglib-2.0 -lseccomp -lpthread -Wl,-z,relro -o slirp4netns slirp4netns-main.o slirp4netns-slirp4netns.o slirp4netns-api.o slirp4netns-sandbox.o slirp4netns-seccompfilter.o libparson.a 
/usr/bin/ld: slirp4netns-slirp4netns.o: in function `libslirp_timer_free':
./slirp4netns.c:68: undefined reference to `g_slist_remove'
/usr/bin/ld: slirp4netns-slirp4netns.o: in function `libslirp_timer_new':
./slirp4netns.c:56: undefined reference to `g_malloc0'
/usr/bin/ld: ./slirp4netns.c:60: undefined reference to `g_slist_append'
/usr/bin/ld: slirp4netns-slirp4netns.o: in function `libslirp_add_poll':
./slirp4netns.c:160: undefined reference to `g_array_append_vals'
/usr/bin/ld: slirp4netns-slirp4netns.o: in function `create_slirp':
./slirp4netns.c:278: undefined reference to `slirp_new'
/usr/bin/ld: slirp4netns-slirp4netns.o: in function `do_slirp':
./slirp4netns.c:296: undefined reference to `g_array_new'
/usr/bin/ld: ./slirp4netns.c:317: undefined reference to `g_array_append_vals'
/usr/bin/ld: ./slirp4netns.c:320: undefined reference to `g_array_append_vals'
/usr/bin/ld: ./slirp4netns.c:333: undefined reference to `g_array_append_vals'
/usr/bin/ld: ./slirp4netns.c:356: undefined reference to `g_array_set_size'
/usr/bin/ld: ./slirp4netns.c:357: undefined reference to `slirp_pollfds_fill'
/usr/bin/ld: ./slirp4netns.c:361: undefined reference to `g_poll'
/usr/bin/ld: ./slirp4netns.c:373: undefined reference to `slirp_input'
/usr/bin/ld: ./slirp4netns.c:393: undefined reference to `slirp_pollfds_poll'
/usr/bin/ld: ./slirp4netns.c:408: undefined reference to `g_array_free'
/usr/bin/ld: slirp4netns-slirp4netns.o: in function `libslirp_timer_free':
./slirp4netns.c:69: undefined reference to `g_free'
/usr/bin/ld: slirp4netns-api.o: in function `api_ctx_alloc':
./api.c:60: undefined reference to `g_malloc0'
/usr/bin/ld: slirp4netns-api.o: in function `api_ctx_free':
./api.c:82: undefined reference to `g_free'
/usr/bin/ld: ./api.c:82: undefined reference to `g_list_free_full'
/usr/bin/ld: slirp4netns-api.o: in function `api_handle_req_remove_hostfwd':
./api.c:252: undefined reference to `g_list_find_custom'
/usr/bin/ld: ./api.c:261: undefined reference to `slirp_remove_hostfwd'
/usr/bin/ld: ./api.c:267: undefined reference to `g_list_remove'
/usr/bin/ld: ./api.c:268: undefined reference to `g_free'
/usr/bin/ld: slirp4netns-api.o: in function `api_handle_req_list_hostfwd':
./api.c:225: undefined reference to `g_list_foreach'
/usr/bin/ld: slirp4netns-api.o: in function `api_handle_req_add_hostfwd':
./api.c:104: undefined reference to `g_malloc0'
/usr/bin/ld: ./api.c:159: undefined reference to `slirp_add_hostfwd'
/usr/bin/ld: ./api.c:170: undefined reference to `g_list_append'
/usr/bin/ld: slirp4netns-seccompfilter.o: in function `enable_seccomp':
./seccompfilter.c:11: undefined reference to `seccomp_init'
/usr/bin/ld: ./seccompfilter.c:27: undefined reference to `seccomp_rule_add'
/usr/bin/ld: ./seccompfilter.c:29: undefined reference to `seccomp_rule_add'
/usr/bin/ld: ./seccompfilter.c:37: undefined reference to `seccomp_rule_add'
/usr/bin/ld: ./seccompfilter.c:38: undefined reference to `seccomp_rule_add'
/usr/bin/ld: ./seccompfilter.c:39: undefined reference to `seccomp_rule_add'
/usr/bin/ld: slirp4netns-seccompfilter.o:./seccompfilter.c:40: more undefined references to `seccomp_rule_add' follow
/usr/bin/ld: slirp4netns-seccompfilter.o: in function `enable_seccomp':
./seccompfilter.c:51: undefined reference to `seccomp_load'
/usr/bin/ld: ./seccompfilter.c:53: undefined reference to `seccomp_release'
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:670: slirp4netns] Error 1
make[2]: Leaving directory '/<<PKGBUILDDIR>>'
make[1]: *** [Makefile:556: all] Error 2
make[1]: Leaving directory '/<<PKGBUILDDIR>>'
dh_auto_build: error: make -j1 returned exit code 2

I note that the missing references should be in glib-2.0. However, -lglib-2.0 is present on the link line. Twice actually. Any idea what could be the problem?

@AkihiroSuda
Copy link
Member

Seems already cherry-picked by Debian: https://sources.debian.org/patches/slirp4netns/0.4.3-2/libslirp.patch/

@siretart
Copy link

Seems already cherry-picked by Debian: https://sources.debian.org/patches/slirp4netns/0.4.3-2/libslirp.patch/

that would have been my doing. I've uploaded that patch to experimental only to see whether it builds on all architectures: https://buildd.debian.org/status/package.php?p=slirp4netns&suite=experimental (it does)

I could easily sync it to ubuntu focal (20.04) easily as well, but hesitated because I wanted to see your opinion on this PR first.

@siretart
Copy link

@elmarco any update on this PR? Are you still working on it?

@elmarco elmarco force-pushed the libslirp branch 2 times, most recently from 6c7531b to e90c4bd Compare March 10, 2020 11:53
@elmarco elmarco marked this pull request as ready for review March 11, 2020 22:23
@elmarco
Copy link
Contributor Author

elmarco commented Mar 11, 2020

CI failing is not me, it's clang-format, perhaps a new version? I can update the files too if it's ok

@AkihiroSuda
Copy link
Member

BTW any ETA of the next version of libslirp?

@elmarco elmarco force-pushed the libslirp branch 3 times, most recently from c79fd49 to 0c5649b Compare March 13, 2020 17:50
Also drop ubuntu-static in docker build (meson there is a bit old and
doesnt build both dynamic & static at the same time, it shouldn't
matter as we are targeting shared library in 20.04, and ubuntu should
have libslirp in backports for 18.04 if necessary)

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
@elmarco elmarco changed the title WIP: Link with system libslirp Link with system libslirp Mar 14, 2020
Copy link
Member

@AkihiroSuda AkihiroSuda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@AkihiroSuda
Copy link
Member

cc @giuseppe

Copy link
Collaborator

@giuseppe giuseppe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@AkihiroSuda AkihiroSuda merged commit 75233a7 into rootless-containers:master Mar 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants