unikraft / lib-musl

musl: A C standard library
Other
9 stars 29 forks source link

undefined reference to `__muldc3` #71

Closed nderjung closed 1 year ago

nderjung commented 1 year ago

When using lib-musl, the following link-time error occurs:

 E  /usr/bin/ld: warning: /github/workspace/_helloworld/.unikraft/build/libmusl/setjmp.x86_64.o: missing .note.GNU-stack section implies executable stack
 E  /usr/bin/ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
 i    OBJCOPY libmusl.o
 i    LD      helloworld_qemu-x86_64.dbg
 E  /usr/bin/ld: warning: /github/workspace/_helloworld/.unikraft/build/libkvmplat.o: requires executable stack (because the .note.GNU-stack section is executable)
 E  /usr/bin/ld: /github/workspace/_helloworld/.unikraft/build/libmusl.o: in function `cpow':
 E  /github/workspace/_helloworld/.unikraft/build/libmusl/origin/musl-1.2.3//src/complex/cpow.c:7: undefined reference to `__muldc3'
 E  /usr/bin/ld: /github/workspace/_helloworld/.unikraft/build/libmusl.o: in function `cpowf':
 E  /github/workspace/_helloworld/.unikraft/build/libmusl/origin/musl-1.2.3//src/complex/cpowf.c:5: undefined reference to `__mulsc3'
 E  /usr/bin/ld: /github/workspace/_helloworld/.unikraft/build/libmusl.o: in function `cpowl':
 E  /github/workspace/_helloworld/.unikraft/build/libmusl/origin/musl-1.2.3//src/complex/cpowl.c:11: undefined reference to `__mulxc3'
 E  collect2: error: ld returned 1 exit status
 E  make[1]: *** [/github/workspace/plat/kvm/Linker.uk:48: /github/workspace/_helloworld/.unikraft/build/helloworld_qemu-x86_64.dbg] Error 1
 E  make: *** [Makefile:1055: sub-make] Error 2

This issue was introduced in https://github.com/unikraft/lib-musl/pull/64.

Either LIBMUSL_COMPLEX needs to be unselected or lib-compiler-rt must be added to the build.

StefanJum commented 1 year ago

lib-compiler-rt is a dependency for building LIBMUSL_COMPLEX (see this commit). So to fix the build error you need to either unselect LIBMUSL_COMPLEX (this is done selected by default), or add compiler-rt to the build.

andreittr commented 1 year ago

This issue is (going to be) fixed by https://github.com/unikraft/lib-compiler-rt/pull/18.

andreittr commented 1 year ago

Fixed by https://github.com/unikraft/lib-compiler-rt/pull/18.