klange / toaruos

A completely-from-scratch hobby operating system: bootloader, kernel, drivers, C library, and userspace including a composited graphical UI, dynamic linker, syntax-highlighting text editor, network stack, etc.
https://toaruos.org/
University of Illinois/NCSA Open Source License
6.09k stars 477 forks source link

Can't build gcc toolchain #231

Closed mxlgv closed 2 years ago

mxlgv commented 2 years ago

Maybe I'm doing something wrong, but when I run ./build-toolchain.sh , the build fails with the error: "g++: error: gengtype-lex.c: No such file or directory g++: fatal error: no input files"

My gcc version 10.3.0 (Ubuntu 10.3.0-1ubuntu1). Tried both Ubuntu 21.04 and Cygwin with the same result.

PS. I would be glad to find an already builded version for windows or linux

klange commented 2 years ago

There is an "already built" toolchain in the form of a Docker container, which also contains some of the other tools necessary for the build: https://github.com/klange/toaruos#building-with-docker - Since building a whole OS is a complicated task, I generally suggest not trying to build the toolchain or perform builds directly, and can't feasibly support trying to do it outside of an environment that matches my own Ubuntu host system (and I'm still on the LTS); using the Docker container avoids a number of issues, including the fact that it can take up to an hour to build the gcc cross-compiler.

All that said, from a quick perusal of the GCC sources, I believe that file is built with flex from a .l source, which might suggest you are missing flex (you might be able to confirm this with earlier error messages). Check that you have all of the required packages, most of which are just for building gcc, as listed in the Dockerfile used to build the CI images: https://github.com/klange/toaruos/blob/master/util/docker/Dockerfile#L6

mxlgv commented 2 years ago

I have done here this command to install the tools.

apt-get update && apt-get install -y build-essential python3 xorriso genext2fs mtools gnu-efi git automake autoconf wget libgmp-dev libmpfr-dev libmpc-dev flex bison texinfo dosfstools

And it didn't help. I'll try later in docker.

mxlgv commented 2 years ago

Can I use gcc from linux with a linker script as a temporary solution?

klange commented 2 years ago

No. A fully targeted cross-compiler is required to build the userspace.

mxlgv commented 2 years ago

Building via docker really helped