Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the build of LiteBSD more self-contained: #62

Merged
merged 1 commit into from Jun 22, 2016

Conversation

Projects
None yet
4 participants
@ibara
Copy link
Collaborator

commented Jun 13, 2016

  • Use our own lorder script instead of relying on what is on the OS.
  • /usr/bin/env perl everywhere, for FreeBSD (which installs to /usr/local/bin).
  • ufstool needs a FreeBSD-specific #ifdef in one spot.
  • pcc was using bison as its yacc, switch pcc to byacc like everything else.
  • Some tweaks to the ncurses build process.
Make the build of LiteBSD more self-contained:
* Use our own lorder script instead of relying on what is on the OS.
* /usr/bin/env perl everywhere, for FreeBSD (which installs to /usr/local/bin).
* ufstool needs a FreeBSD-specific #ifdef in one spot.
* pcc was using bison as its yacc, switch pcc to byacc like everything else.
* Some tweaks to the ncurses build process.
@majenkotech

This comment has been minimized.

Copy link
Collaborator

commented Jun 13, 2016

Compilation on Debian still seems to work at least. Not tried the image that it's created yet, but it's created one.

FreeBSD seems to churn out a number of warnings and errors when compiling at various points, but they don't look to be that critical. Such as in the mkdep phase of building:

In file included from dwarf_dealloc.c:27:
In file included from ./_libdwarf.h:45:
In file included from ./../libelftc/_elftc.h:381:
In file included from /usr/include/sys/endian.h:33:
In file included from /usr/include/sys/_types.h:33:
In file included from /usr/include/machine/_types.h:6:
/usr/include/x86/_types.h:43:2: error: this file needs sys/cdefs.h as a prerequisite
#error this file needs sys/cdefs.h as a prerequisite
 ^
1 error generated.

Not sure it should actually be looking at those /usr/include files should it? Not that you can tell mkdep not to... I think that's a completely separate thing though and nothing to worry about WRT this PR. Maybe we would need to bundle our own somewhat tweaked version of mkdep to use instead. One that doesn't look in the system directories.

It makes an image at the end of it all though, and that's the main thing...

@ibara

This comment has been minimized.

Copy link
Collaborator Author

commented Jun 13, 2016

Good.
You're right that mkdep should not be looking at the system's /usr/include files -- I guess I should make an internal mkdep like I made an internal lorder that would always do the right thing. The lorder thing was more pressing--the build would fail because no libraries would ever be created.

@majenkotech

This comment has been minimized.

Copy link
Collaborator

commented Jun 13, 2016

Things like buildroot and crosstool-ng and similar seem to install most utilities they need locally rather than relying on system-installed versions. I guess that means there are no problems with having the wrong version of some tool or other installed. They even do it with the toolchain. There is no reason we couldn't do something similar - all the things that are needed, like byacc, flex, etc, could be downloaded and compiled into a staging location prior to the actual building of the LiteBSD system. Included in that could be custom versions of things like mkdep, etc.

@ibara

This comment has been minimized.

Copy link
Collaborator Author

commented Jun 13, 2016

That's true. I guess it's just a matter of diminishing returns and people to maintain the build infrastructure. bmake, byacc, flex, etc. are available everywhere as a package (if not in the base system) and if it's not, they're just a ./configure && make && sudo make install away. And they're basically platform agnostic. But as they're all BSD-licensed, we can easily include them. Pros and Cons either way. I just don't want to have to maintain that if I don't have to.

@hjoertel

This comment has been minimized.

Copy link

commented Jun 14, 2016

On my OpenSuse system mkdep and lorder have not been available
I used
http://www.chiark.greenend.org.uk/~pmaydell/hp/misctools.tar.gz
with some changes

@majenkotech

This comment has been minimized.

Copy link
Collaborator

commented Jun 14, 2016

Did you change anything else in mkdep other than the GCC compiler it's using?

@hjoertel

This comment has been minimized.

Copy link

commented Jun 14, 2016

No, only gcc related part, see diff

> CC=/usr/local/bin/m68k-hp-netbsd-gccc
> CC=gcc
> 
81c84
<       /usr/local/bin/m68k-hp-netbsd-gcc -M "$@" | sed -e 's; \./; ;g' > $TMP
---
>       $CC -M "$@" | sed -e 's; \./; ;g' > $TMP
83c86
<       /usr/local/bin/m68k-hp-netbsd-gcc -M "$@" | sed -e 's;\.o :; :;' -e 's; \./; ;g' > $TMP
---
>       $CC -M "$@" | sed -e 's;\.o :; :;' -e 's; \./; ;g' > $TMP
98a102
> 

@hjoertel

This comment has been minimized.

Copy link

commented Jun 14, 2016

did the same for lorder

39a40,42
> NM=/usr/local/bin/m68k-hp-netbsd-nm
> NM=/usr/bin/nm
> 
60c63
< /usr/local/bin/m68k-hp-netbsd-nm -go $* | tee $T \
---
> $NM -go $* | tee $T \
88a92
> 

@majenkotech

This comment has been minimized.

Copy link
Collaborator

commented Jun 14, 2016

How about adding -nostdinc -I${BSDSRC}/include to the ${CC} command line? Also, ${CC} should really be found from ${MIPS_GCC_ROOT}

@hjoertel

This comment has been minimized.

Copy link

commented Jun 14, 2016

Am Dienstag, 14. Juni 2016, 09:29:37 schrieb Majenko Technologies:

How about adding -nostdinc -I${BSDSRC}/include to the ${CC} command line? Also, ${CC} should really be found from ${MIPS_GCC_ROOT}

No idea.
It worked for me with only changing the called compiler

Heinz

@majenkotech

This comment has been minimized.

Copy link
Collaborator

commented Jun 14, 2016

I have tweaked up a version that uses ${MIPS_GCC_ROOT}/bin/mips-sde-elf-gcc or ${MIPS_GCC_ROOT}/bin/mips-elf-gcc, whichever it finds, and adds -nostdinc -I${BSDSRC}/include and this is the typical .depend file generated:

mkdir.o: mkdir.c /home/matt/LiteBSD/DESTDIR/usr/include/sys/types.h \
 /home/matt/LiteBSD/DESTDIR/usr/include/machine/ansi.h \
 /home/matt/LiteBSD/DESTDIR/usr/include/machine/types.h \
 /home/matt/LiteBSD/DESTDIR/usr/include/sys/cdefs.h \
 /home/matt/LiteBSD/DESTDIR/usr/include/machine/endian.h \
 /home/matt/LiteBSD/DESTDIR/usr/include/sys/stat.h \
 /home/matt/LiteBSD/DESTDIR/usr/include/sys/time.h \
 /home/matt/LiteBSD/include/time.h \
 /home/matt/LiteBSD/DESTDIR/usr/include/machine/limits.h \
 /home/matt/LiteBSD/include/err.h \
 /home/matt/LiteBSD/DESTDIR/usr/include/errno.h \
 /home/matt/LiteBSD/include/stdio.h /home/matt/LiteBSD/include/stdlib.h \
 /home/matt/LiteBSD/include/string.h /home/matt/LiteBSD/include/unistd.h \
 /home/matt/LiteBSD/DESTDIR/usr/include/sys/unistd.h

So everything is now picked up from within LiteBSD, which is as it should be.

@majenkotech

This comment has been minimized.

Copy link
Collaborator

commented Jun 14, 2016

Added it as pr #63

@sergev sergev merged commit 7c9f8ce into master Jun 22, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.