Comments (5)
Good catch!
I need to research deeper how easy (or hard) it would be to improve the build process of the currently available overlay bundles and if it is possible to introduce general fix, e.g. perhaps set some global shell properties which will guide GCC...
from minimal.
I looked around in gcc and came up with a very very ugly solution that doesn't link / interact with the host in any way (part of bundle.sh for nweb):
cd $MAIN_SRC_DIR/work/overlay/nweb
# our sysroot
SYSROOT="$MAIN_SRC_DIR/work/glibc/glibc_prepared"
# gcc has a "internal" path that needs to be added to find the static versions of libgcc_*
GCC_INTERNAL_PATH=$(dirname $(gcc -print-libgcc-file-name))
# create a specs file to overwrite /usr/lib and so on
# this specs file should ideally reside in src/work/sysroot.specs along with the sysroot
cat << CEOF > test.specs
*link_libgcc:
-L$SYSROOT/lib -L$SYSROOT/lib64 -L$SYSROOT/usr/lib -L$SYSROOT/usr/lib64 -L$SYSROOT/usr/local/lib -L$SYSROOT/usr/local/lib64 -L$GCC_INTERNAL_PATH
CEOF
## -specs could maybe be moved to CFLAGS
#CC="gcc -specs=$PWD/test.specs"
#
## -nostdlib prevents ld's linker script from adding /usr/lib
#LDFLAGS="-Wl,--verbose,-nostdlib"
#
## we don't have gcc-libs for our guest/minimal system so we have to force static linking for libgcc
#CFLAGS="--verbose -static-libgcc"
CC="gcc -specs=$PWD/test.specs -Wl,-nostdlib -static-libgc"
set -x
#strace \
$CC $SRC_DIR/nweb23.c -o nweb
# uncomment strace and run
# ./bundle.sh &>/dev/fd/1 | grep "[^d]/usr/lib" --color=auto
# to see that it doesn't access host files in /usr/lib in anway (apart from the compilers own files in /usr/lib/gcc/...)
Since we already have to redo the sysroot, what about moving the sysroot from src/work/glibc/glibc_prepared
to src/work/sysroot
so future libraries can be added easily (and maybe solve the extra flags for bundles that depend on each other)
Still needs to be tested for other bundles
from minimal.
Good research! The only drawback I see for now is that this complicates the build process quite a lot. Nevertheless, this is an interesting approach and personally I am willing to experiment with this.
The idea to move the sysroot
to its own work
folder is OK and it actually makes sense.
Implementing this might complement very well with #58 and more precisely the part where custom linker needs to be added as separate step in MLL. This also leaves room for further size optimizations where the object "stripping" could be done on linker level instead of relying on the strip
command.
Just as a side note - I believe this should be done as a best effort to support the overlay bundle build structure. The MLL build structure should not be affected by these changes. I know from personal experience that playing with the GCC related shell variables easily leads to compilation issues which are hard to find/debug and I would like to keep the original MLL build process as simple as possible. At least for now.
The above note does not apply for the overlay bundles and there we can do all kinds of experimental stuff and optimizations.
from minimal.
Look at https://github.com/bauen1/minimal/tree/misc-changes
from minimal.
Yes, that's exactly what I had in mind with my last comment. Feel free to submit PR when you believe it is ready. I'll review and test it as soon as possible.
from minimal.
Related Issues (20)
- Migrate Travis CI workflow to GitHub workflow HOT 1
- Implement Xorg with FLWM onto MLL HOT 3
- Missing CRC32 at the rootfs compression HOT 3
- Missing gpg and or at least sha256 hash check against MtM attacks HOT 2
- Grouping of the log output / missing logs HOT 1
- Fails to build on Ubuntu 20.04.2 LTS HOT 3
- [Package Request] jwm HOT 1
- pulling in bundles from web...live HOT 2
- Your linker does not support HOT 1
- yo HOT 1
- Update v86 HOT 2
- How to get 32-bit version? HOT 2
- Build, Compile errors and package download file was missing... HOT 2
- can't build the iso. HOT 1
- Files not available
- make[2]: *** [scripts/Makefile.build:357: arch/x86/entry/thunk_64.o] Error 1 HOT 2
- How to add minimal GUI HOT 1
- Dead links in README.md
- All builds end up with Kernel panic - not syncing: No working init found HOT 4
- Possible issues with connecting tty / ttyS0, qemu, virtual console
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from minimal.