nixers
GNU free compilation toolchain - Printable Version
+- nixers (https://nixers.net)
+-- Forum: Development & Graphics (https://nixers.net/Forum-Development-Graphics)
+--- Forum: Programming On Unix (https://nixers.net/Forum-Programming-On-Unix)
+--- Thread: GNU free compilation toolchain (/Thread-GNU-free-compilation-toolchain)


GNU free compilation toolchain - z3bra - 13-05-2015

Hello everyone!

As the title say, I'm currently trying to setup a compilation toolchain (for C programs) that would not depend on any GNU software (because freedom shouldn't mean "use GNU software").

Do any of you would like to help me on this? I know of clang, which works great. But I'd like to explore more options, using alternative compilers/assembler/linkers. To former being the hardest to find it seems.

For now, here is what I'm using:
  • libc - musl
  • preprocessor - pcc
  • compiler - pcc
  • assembler - nasm?
  • linker - ???

If you have better options, please share!


RE: GNU free compilation toolchain - vypr - 14-05-2015

I found some good linkers that might be worth a shot.

The Byte Optimized Linker - a x86_64 ELF linker (has some limitations compared to other linkers)
The Rape 'n Load Linker (yes i know the name is fucking stupid) - a x86 ELF linker

Some limitations to 'rld':
  • Command line is limited to 255 arguments.
  • Each command line argument is limited to 255 characters.
  • Input/Output elf cannot exceed 2GiB.
  • Currently supporting only x86 architecture.

I know that having separate linkers for separate architecture is annoying, but finding an alternative linker is not easy.


RE: GNU free compilation toolchain - z3bra - 14-05-2015

Thanks for thosd links, I'll check them out. I found neatld (http://repo.or.cz/w/ld.git), but I couldn't make it link a simple brllo world, no matter how hard I tried...


RE: GNU free compilation toolchain - October - 17-05-2015

Sweet, looking forward to this.

p.s. you are right, "freedom shouldn't mean "use GNU software"."

(14-05-2015, 04:16 AM)vypr Wrote: The Rape 'n Load Linker (yes i know the name is fucking stupid) - a x86 ELF linker
heh


RE: GNU free compilation toolchain - z3bra - 17-08-2015

Waking up this thread, as I made some progress.

I finally build a PCC toolchain using musl as its libc. It's not entirely GNU Free though, as it still need GNU binutils to work. But it's a huge step forward!
I've been looking into elftoolchain (from the fedora project) and elfutils (freebsd iirc) but none of them include an assembler, and only elftoolchain provides a linker (not sure if it's working though).

Regarding the PCC+musl toolchain, I blogged about it, you can find everything about it here: http://blog.z3bra.org/2015/08/cross-compiling-with-pcc-and-musl.html
If you have any questions about it, or think some infos are missing or not crystal clear, tell me and I'll rework this article.


RE: GNU free compilation toolchain - Ypnose - 17-08-2015

LLVM + lld is also a strong candidate to have a system GNU free. I'm seriously thinking of it.
But I guess we will still need to use a few other GPL softwares, especially for the networking part (final system).
And if I'm not wrong, elftoolchain is a project from FreeBSD.


RE: GNU free compilation toolchain - z3bra - 17-08-2015

I never looked much into LLVM and Clang. Even if it's more 'hype' than GNU, I still find them to be too huge for my "minimal" needs. I know it's a dumb statement, But I Like small projects :)
Though after a quick look, lld seems to be a totally standalone project, so it might be worth taking a look. Keep us updated if you give it a go!

(17-08-2015, 08:02 AM)Ypnose Wrote: if I'm not wrong, elftoolchain is a project from FreeBSD.

You were right, I swapped them. elfutils is the fedora project, while elftoolchain is the freebsd one.


RE: GNU free compilation toolchain - October - 03-09-2015

I just recently switched from GCC to Clang on OpenBSD, so far so good.


RE: GNU free compilation toolchain - pranomostro - 03-09-2015

In my opinion, it is astonishing how much GNU has you locked in.
Using another standard library than glibc is surprisingly hard, and gdb does not work with output produced by tcc.


RE: GNU free compilation toolchain - z3bra - 04-09-2015

tcc isn't working well as a standard compiler sadly. But works well as a tiny interpreter for small C programs! Anyway, GNU sucks for locking everything like this. I hate them for that


RE: GNU free compilation toolchain - pranomostro - 04-09-2015

I might also be wrong about tcc, because it is discontinued. It might not yet have implemented symbols for gdb.


RE: GNU free compilation toolchain - robotchaos - 07-02-2017

So z3bra, what's your toolchain these days?


RE: GNU free compilation toolchain - z3bra - 08-02-2017

I finally managed to get a static musl-based toolchain! To do so, I used an alpinelinux container and compiled gcc multiple times.

I now have gcc, binutils, patch, make, m4, and so on, statically compiled.
If anyone wants to try the same, I'd suggest starting there: https://github.com/richfelker/musl-cross-make.
It will let you build a musl-based cross-compiler that's portable.

I'm now able to build packs for my distro ON my distro (currently within an LXC container). I'm facing a few errors, but they are mostly related to the tools I use, and that don't behave like GNU's. For reference, here are the "tool swap" I made to avoid GNU:

There are still some quacks, but this toolset is rather usable for now. As a matter of fact, here are the GNU/tools I'm still relying on, and the replacement I'm considering (if any):