Giter Site home page Giter Site logo

Comments (5)

jayrm avatar jayrm commented on May 30, 2024

See: Bootstrapping fbc on a new system

What is it that you are trying to do?

If you are using 'make bootstrap-dist' to create a package and 'make bootstrap' to build it, then files are expected to be in ./bootstrap.

If you are following the manual steps, then files are expected to be in ./lib/freebasic.

I added an example to the wiki showing the how to create and use a bootstrap package in more detail.

from fbc.

jayrm avatar jayrm commented on May 30, 2024

Eric, weird, I received your response notification with the option to view it here (but it is not here).

Interesting paper, thanks for the link. https://www.acsa-admin.org/countering-trusting-trust-through-diverse-double-compiling/

Yes, fbc is a self-hosting compiler. The process for building a new fbc has always been, since the beginning of fbc, to build the new version with an installation of the previous official release, and using cross-compiling to other systems where fbc is not yet available.

Makefile targets 'bootstrap-dist' and 'bootstrap' are a means to create a bootstrap compiler for a few popular host/targets by taking the emitted .c or .asm from the build system to the host/target system. We don't have a separately maintained version of fbc written in some other language (like C or assembler) to bootstrap from independently.

For our Travis-CI builds, we use the previous official release of fbc to build the next release. You can see our scripts here: https://github.com/freebasic/fbc/tree/master/contrib/travis

Does this information answer the issue report?

from fbc.

ericherman avatar ericherman commented on May 30, 2024

from fbc.

jayrm avatar jayrm commented on May 30, 2024

Eric, I appreciate you giving your (free) time to provide more information (I get the immediate impression that you have much more knowledge on this subject). If there's nothing else to add to this issue, can probably just close it out.


yea, it would be difficult to answer, with confidence, the question of "does the toolchain have a trojan?" given our current practices.

Then the bootstrap-from-source story becomes 1) grab the bootstrap sources, 2) use those to build a bootstrap-fbc, then 3) use the bootstrap-fbc to build fbc.

There are bootstrap source versions available last few fbc releases. So, I wrote the following script, 1) to provide another example related to the issue report, and 2) at least minimally, answer for myself, the question "is the bootstrap package self consistent?"

I only tried with FreeBASIC-1.05.0-source-bootstrap.tar.xz so far. (Sorry about the '~/' paths, but I'm not sure how the process will handle relative paths.)

#!/bin/sh
set -ex

# bootstrap source versions available are:
#	1.02.0, 1.02.1, 1.03.0, 1.04.0, 1.05.0

bootstrap_version='1.05.0'
bootstrap_package='FreeBASIC-1.05.0-source-bootstrap'
download_url='https://github.com/freebasic/fbc/releases/download'

# download source for the bootstrap compiler
cd ~
wget -O $bootstrap_package.tar.xz $download_url/$bootstrap_version/$bootstrap_package.tar.xz
tar xf $bootstrap_package.tar.xz

# build the bootstrap complier (c/asm sources)
cd ~/$bootstrap_package
make bootstrap

# rebuild the compiler (bas sources) using bootstrap compiler
cd ~/$bootstrap_package
make "FBC=~/$bootstrap_package/bin/fbc -i ~/$bootstrap_package/inc"

# At this point we'd like to also rebuild the bootstrap package to compare, but
# currently, '$ make bootstrap-dist' expects to be made in a clone of the git repo, so,
# we would need to make some modifications to the makefile first to have this work:
#	$ cd ~/$bootstrap_package
#	$ make bootstrap-dist "FBC=~/$bootstrap_package/bin/fbc -i ~/$bootstrap_package/inc"

# instead, remove the ./bootstrap directory, and create a fake git repo:
cd ~/$bootstrap_package
rm -rf bootstrap
git init
git add .
git -c user.name="none" -c user.email="none" commit -m "bootstrap"

# make a new bootstrap package using newly built compiler
make bootstrap-dist "FBC=~/$bootstrap_package/bin/fbc -i ~/$bootstrap_package/inc"

# compare the contents of the 2 bootstrap packages:
tardiff --modified ~/$bootstrap_package.tar.xz ~/$bootstrap_package/$bootstrap_package.tar.xz

Turns out, for me, there is a difference by one file: `./contrib/swig/swig.exe' that probably wasn't meant to be in the original bootstrap package.

from fbc.

ericherman avatar ericherman commented on May 30, 2024

Yes. Thank you for your time and thoughtful treatment of the subject. Perhaps I will make some time next weekend to look at this again. Regardless, I think it makes sense to close this issue. Cheers!

from fbc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.