unikernelLinux / ukl

Unikernel Linux
GNU Lesser General Public License v2.1
165 stars 12 forks source link

Unable to compile ukl #24

Closed vishwanath1306 closed 1 year ago

vishwanath1306 commented 1 year ago

I am trying to compile ukl based on the instructions given in README and I get this error

make[6]: Leaving directory '/users/vishwa/sdb/ukl/libgcc-build/x86_64-pc-linux-gnu/libstdc++-v3'
make[5]: Leaving directory '/users/vishwa/sdb/ukl/libgcc-build/x86_64-pc-linux-gnu/libstdc++-v3'
make[4]: Leaving directory '/users/vishwa/sdb/ukl/libgcc-build/x86_64-pc-linux-gnu/libstdc++-v3'
make[3]: Leaving directory '/users/vishwa/sdb/ukl/libgcc-build'
cp libgcc-build/x86_64-pc-linux-gnu/libstdc++-v3/src/.libs/libstdc++.a libstdc++.a
make[2]: Leaving directory '/users/vishwa/sdb/ukl'
make[1]: *** [Makefile:433: all-recursive] Error 1
make[1]: Leaving directory '/users/vishwa/sdb/ukl'
make: *** [Makefile:374: all] Error 2

Did I miss anything during the install step?

rwmjones commented 1 year ago

You've cut out the actual error message so we cannot tell.

vishwanath1306 commented 1 year ago
root@node0:~/sdb/ukl# make -j`nproc`
make  all-recursive
make[1]: Entering directory '/users/vishwa/sdb/ukl'
make[2]: Entering directory '/users/vishwa/sdb/ukl'
rm -f stamp-glibc-configure
mkdir -p glibc-build
cd glibc-build && \
/users/vishwa/sdb/ukl/glibc/configure \
    CFLAGS="-g -O2 -fthread-jumps -mcmodel=kernel -mno-red-zone  -UUKL_BP" \
    --prefix=/users/vishwa/sdb/ukl \
    --enable-hacker-mode \
    --enable-timezone-tools \
    --disable-build-nscd \
    --disable-nscd \
    --disable-pt_chown \
    --enable-static-nss \
    --disable-shared \
    --disable-tunables \
    --disable-werror \
    x86_64-ukl \
    build_alias=x86_64-ukl \
    host_alias=x86_64-ukl \
    target_alias=x86_64-ukl
configure: WARNING: you should use --build, --host, --target
checking build system type... x86_64-pc-ukl
checking host system type... x86_64-pc-ukl
checking for x86_64-ukl-gcc... no
checking for gcc... gcc
checking for suffix of object files... configure: error: in `/users/vishwa/sdb/ukl/glibc-build':
configure: error: cannot compute suffix of object files: cannot compile
See `config.log' for more details
make[2]: *** [Makefile:948: stamp-glibc-configure] Error 1
make[2]: Leaving directory '/users/vishwa/sdb/ukl'
make[1]: *** [Makefile:433: all-recursive] Error 1
make[1]: Leaving directory '/users/vishwa/sdb/ukl'
make: *** [Makefile:374: all] Error 2
root@node0:~/sdb/ukl# 

Apologies. The error seems to happen in all-recursive part.

rwmjones commented 1 year ago

'mkay, and:

configure: error: cannot compute suffix of object files: cannot compile
See 'config.log' for more details

what happens if you do that?

vishwanath1306 commented 1 year ago

The full contents of the file are present in: https://pastebin.com/8SsUJkFs

Bits I think are relevant:

configure:3323: checking minix/config.h usability
configure:3323: gcc -c -g -O2  conftest.c >&5
conftest.c:52:10: fatal error: minix/config.h: No such file or directory
   52 | #include <minix/config.h>
      |          ^~~~~~~~~~~~~~~~
compilation terminated.
configure:3323: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "UKL"
| #define PACKAGE_TARNAME "ukl"
| #define PACKAGE_VERSION "1.0.0"
| #define PACKAGE_STRING "UKL 1.0.0"
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| #define STDC_HEADERS 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_MEMORY_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_UNISTD_H 1
| /* end confdefs.h.  */
| #include <stdio.h>
| #ifdef HAVE_SYS_TYPES_H
| # include <sys/types.h>
| #endif
| #ifdef HAVE_SYS_STAT_H
| # include <sys/stat.h>
| #endif
| #ifdef STDC_HEADERS
| # include <stdlib.h>
| # include <stddef.h>
| #else
| # ifdef HAVE_STDLIB_H
| #  include <stdlib.h>
| # endif
| #endif
| #ifdef HAVE_STRING_H
| # if !defined STDC_HEADERS && defined HAVE_MEMORY_H
| #  include <memory.h>
| # endif
| # include <string.h>
| #endif
| #ifdef HAVE_STRINGS_H
| # include <strings.h>
| #endif
| #ifdef HAVE_INTTYPES_H
| # include <inttypes.h>
| #endif
| #ifdef HAVE_STDINT_H
| # include <stdint.h>
| #endif
| #ifdef HAVE_UNISTD_H
| # include <unistd.h>
| #endif
| #include <minix/config.h>
configure:3323: result: no
configure:3323: checking minix/config.h presence
configure:3323: gcc -E  conftest.c
conftest.c:19:10: fatal error: minix/config.h: No such file or directory
   19 | #include <minix/config.h>
      |          ^~~~~~~~~~~~~~~~

https://stackoverflow.com/questions/9138109/config-h-no-such-file-or-directory

I followed the solution mentioned here regarding the libconfig-dev package, but I didn't work.

rwmjones commented 1 year ago

That's the wrong file. You need the one from /users/vishwa/sdb/ukl/glibc-build

vishwanath1306 commented 1 year ago

Pastebin link for the whole contents of the config.log https://pastebin.com/yiKJ9mqX

arget=x86_64-linux-gnu
Thread model: posix
gcc version 9.3.0 (Ubuntu 9.3.0-17ubuntu1~20.04) 
configure:2606: $? = 0
configure:2595: gcc -V >&5
gcc: error: unrecognized command line option '-V'
gcc: fatal error: no input files
compilation terminated.
configure:2606: $? = 1
configure:2595: gcc -qversion >&5
gcc: error: unrecognized command line option '-qversion'; did you mean '--version'?
gcc: fatal error: no input files
compilation terminated.
configure:2606: $? = 1
configure:2611: checking for suffix of object files
configure:2633: gcc -c -g -O2 -fthread-jumps -mcmodel=kernel -mno-red-zone  -UUKL_BP  conftest.c >&5
cc1: error: code model kernel does not support PIC mode

And

configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "GNU C Library"
| #define PACKAGE_TARNAME "glibc"
| #define PACKAGE_VERSION "(see version.h)"
| #define PACKAGE_STRING "GNU C Library (see version.h)"
| #define PACKAGE_BUGREPORT "https://sourceware.org/bugzilla/"
| #define PACKAGE_URL "https://www.gnu.org/software/glibc/"
| #define PKGVERSION "(GNU libc) "
| #define REPORT_BUGS_TO "<https://www.gnu.org/software/libc/bugs.html>"
| /* end confdefs.h.  */
| 
| int
| main ()
| {
| 
|   ;
|   return 0;
| }
configure:2651: error: in `/users/vishwa/sdb/ukl/glibc-build':
configure:2653: error: cannot compute suffix of object files: cannot compile
rwmjones commented 1 year ago

OK we think we know what causes this, can you try reverting this patch: https://github.com/unikernelLinux/ukl/commit/d28167ba988872ae2b21b6aeff77c242c2ce2b2b

I'm going to try to come up with a better fix later.

@khers ^

rwmjones commented 1 year ago

Actually, that might not be the right commit. Eric should be able to tell me which commit to revert.

khers commented 1 year ago

Yeah, that commit let me build on a modern debian derivative.

vishwanath1306 commented 1 year ago

Just to clarify, I rever it back to the commit mentioned by @rwmjones?

khers commented 1 year ago

No, you just revert it with git revert d28167ba988872ae2b21b6aeff77c242c2ce2b2b

khers commented 1 year ago

Sorry, you actually want to revert c1a9a3afb81ebd585ba3608466f74661b2f128b8 git revert c1a9a3afb81ebd585ba3608466f74661b2f128b8

vishwanath1306 commented 1 year ago

That seemed to work! Thank you!

bash: cannot set terminal process group (-1): Inappropriate ioctl for device
bash: no job control in this shell
groups: cannot find name for group ID 0
I have no name!@(none):/# df[   23.635088] In PID 1 and in_user is 1
[   23.635088] Going to create UKL here.
[   23.636449] Run /init as init process
hello, from the UKL world
khers commented 1 year ago

glad that worked for you