I would like to make it easier to replace cpp,as,qbe,ld and flag options from the config.h
Perhaps one way is to make all of them consistently use the preprocessor like the DYNAMIC_LINKER option.
-DTARGET_QBE= -DTARGET_AS= -DTARGET_CPP=
My plan is to write a simple configure script which will generate
config.mk, hopefully providing a better out-of-box experience on other operating systems.
So you will be able to run
./configure --with-as=/path/to/as ...
I still have two problems with this, on nixos the dynamic linker is not installed at /lib64/ld-linux-x86-64.so.2 , So i need to either detect this, or pass it in somehow.
The related second problem is on nixos, gcc is actually a wrapper script that already specifies --dynamic-linker on it's own, so I get warnings about this flag being passed more than once.
Nixos is a bit of an oddity, so maybe it could have it it's own section in the configure script, however it is not visible from -dumpmachine , as it just appears as x86_64-unknown-linux-gnu.
I know it is a bit of a pain, but I only use nixos, which is why I care about this.
For the first problem, I think adding a
--with-dynamic-linkeroption should be fine.
Not sure about the second. Do you mean that
ldis a wrapper script? Since we only invoke gcc as a preprocessor. Perhaps the wrapper script should have some extra logic to detect if the user manually specified the
--dynamic-linkerflag to avoid the duplicate parameter. Or, maybe we could define
--with-dynamic-linker=to mean don't pass any flag to ld.
Those solutions would work - I should perhaps make a bug report to nixos for the wrapper script.
I just did some testing and I can get the unwrapped nixos binutils and the proper dynamic linker path from:
[ac@black:~/src/cc]$ cat $(dirname $(realpath $(which ld)))/../nix-support/orig-bintools /nix/store/gqq2w8a0yb3ksx9h9iilp73x5hib3rwi-binutils-2.31.1 [ac@black:~/src/cc]$ cat $(dirname $(realpath $(which ld)))/../nix-support/dynamic-linker /nix/store/sw54ph775lw7b9g4hlfvpx6fmlvdy8qi-glibc-2.27/lib/ld-linux-x86-64.so.2
Probably not necessary for the configure script to be aware of this crap.
I added a
DEFAULT_DYNAMIC_LINKER. However, there isn't yet support for
DEFAULT_DYNAMIC_LINKER=to meandon't pass a --dynamic-linker flag. Shouldn't be too hard to do though.
Done now. I also added a NixOS continuous build to make sure things work.