Created attachment 640740 [details] no_direct.sh When trying to build systems and things with ago's approach of removing the relevant symlinks from /usr/bin/ , its rather annoying to have an update come through and having an automatic reinstallation of these symlinks, invalidating all tests that happen afterwards. It would be nice if there was some mechanism to stop binutils-config automatically resurrecting these. I'm not sure what the best approach is, but it should be something one can set and forget, and then later, restore as needed. Perhaps a USE flag is too aggressive an option, because it *is* useful to be able to bring these back to work around problems, temporarily. But if you do anything to remove these, you very much want them gone, and not have them come back automatically. Perhaps, it would be nice to have an option to do something like: > binutils-config --unlink-bin Which: 1. Removes all the applicable links in /usr/bin/ 2. Sets a flag so future calls to binutils-config don't resurrect them And: > binutils-config --link-bin Which: 1. Restores applicable links in /usr/bin/ if they're missing 2. Updates applicable links in /usr/bin/ if they're wrong 3. Sets a flag so future calls to binutils-config update these links. The only advantages of it being a USE flag is things could depend on this facility if necessary, and no additional work has to be done to provide config-persistence, but ... I don't really think that's something anyone wants to encourage. ( toolchain-funcs.eclass is the way forward there ), and it would be detrimental to need to recompile binutils-config just to toggle this capacity. Presently I just have this script that I run when I realise they're back and need to nuke them (or conversely, to restore them when needed) [attached]
The idea is fine and should be applied in the same sense to gcc. Pure USE-guarded mechanism should be most straightforward. *-config packages are not big to re-merge. We can try binutils first.
This idea seems redundant and inferior to wrappers which can be generated by Portage (bug #684894). Wrappers are configurable to redirect to chosen tool (e.g. cc -> ${CHOST}-gcc / ${CHOST}-clang) and are configurable to print QA warning or fatal error (call to die()).
(In reply to Arfrever Frehtes Taifersar Arahesis from comment #2) > This idea seems redundant and inferior to wrappers which can be generated by > Portage (bug #684894). > Wrappers are configurable to redirect to chosen tool (e.g. cc -> > ${CHOST}-gcc / ${CHOST}-clang) and are configurable to print QA warning or > fatal error (call to die()). There are more usecases for this than "running under portage" however. Particularly, if you plan on transitioning a system to a system without these things, both under portage, _and_ under user code, the portage option won't help the "user code" situation. And of course it does nothing for other package managers. So while the portage wrappers are a nice thing to have, its not an exclusive-or situation.
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/proj/binutils-config.git/commit/?id=36eba05752348258a79bbe6a9937e6e406c262e6 commit 36eba05752348258a79bbe6a9937e6e406c262e6 Author: Sergei Trofimovich <slyfox@gentoo.org> AuthorDate: 2020-05-21 21:55:26 +0000 Commit: Sergei Trofimovich <slyfox@gentoo.org> CommitDate: 2020-05-21 21:55:26 +0000 binutils-config: add build-time and runtime switches to disable native symlinks We have two knobs here: 1. Build-time knob USE_NATIVE_LINKS to set a default, defaults to 'yes' (existing behaviour) 2. Run-time --enable-native-links / --disable-native-links knobs. These are not persistent across binutils-config runs and are meant for manual testing. Undocumented for now. Reported-by: Kent Fredric Bug: https://bugs.gentoo.org/724454 Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org> Makefile | 19 +++++++++++++++++-- src/binutils-config | 16 ++++++++++++++-- 2 files changed, 31 insertions(+), 4 deletions(-)
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8f92925b8d3eceb7e1d66571505ad040089b3921 commit 8f92925b8d3eceb7e1d66571505ad040089b3921 Author: Sergei Trofimovich <slyfox@gentoo.org> AuthorDate: 2020-05-21 22:05:32 +0000 Commit: Sergei Trofimovich <slyfox@gentoo.org> CommitDate: 2020-05-21 22:05:47 +0000 sys-devel/binutils-config: add live ebuild To ease live testing of changes like bug #724454 let's have a live ebuild. Should also be a good hint where default repository hides. Add USE=+native-symlinks flag to install 'as', 'ar' and friends. Bug: https://bugs.gentoo.org/724454 Package-Manager: Portage-2.3.99, Repoman-2.3.22 Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org> .../binutils-config/binutils-config-9999.ebuild | 46 ++++++++++++++++++++++ sys-devel/binutils-config/metadata.xml | 11 ++++-- 2 files changed, 53 insertions(+), 4 deletions(-)
sys-devel/binutils-config-9999[-native-symlinks] should implement simple filtering of /usr/bin/{as,ar,} and friends. Please give it a try. It will probably need an explicit binutils re-registration for symlinks to get rebuilt: # binutils-config $(binutils-config -c)
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/proj/gcc-config.git/commit/?id=d91cd5bdc56a6fcb71a998fd8ba81b47c9a13246 commit d91cd5bdc56a6fcb71a998fd8ba81b47c9a13246 Author: Sergei Trofimovich <slyfox@gentoo.org> AuthorDate: 2020-05-22 09:39:26 +0000 Commit: Sergei Trofimovich <slyfox@gentoo.org> CommitDate: 2020-05-22 09:39:26 +0000 gcc-config: add build-time and runtime switches to disable native symlinks We have two knobs here: 1. Build-time knob USE_NATIVE_LINKS to set a default, defaults to 'yes' (existing behaviour) 2. Run-time --enable-native-links / --disable-native-links knobs. These are not persistent across gcc-config runs and are meant for manual testing. Undocumented for now. Reported-by: Kent Fredric Bug: https://bugs.gentoo.org/724454 Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org> Makefile | 8 ++++++++ gcc-config | 8 ++++++-- 2 files changed, 14 insertions(+), 2 deletions(-)
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bcf1494c50e606bb0ac0a7b49afeaa9c2b2c2d52 commit bcf1494c50e606bb0ac0a7b49afeaa9c2b2c2d52 Author: Sergei Trofimovich <slyfox@gentoo.org> AuthorDate: 2020-05-22 09:47:00 +0000 Commit: Sergei Trofimovich <slyfox@gentoo.org> CommitDate: 2020-05-22 09:47:00 +0000 sys-devel/gcc-config: add USE=+native-symlinks flag This flag guards presence of 'cc', 'gcc' and friends. Bug: https://bugs.gentoo.org/724454 Package-Manager: Portage-2.3.99, Repoman-2.3.22 Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org> sys-devel/gcc-config/gcc-config-9999.ebuild | 5 +++-- sys-devel/gcc-config/metadata.xml | 11 +++++++---- 2 files changed, 10 insertions(+), 6 deletions(-)
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/proj/gcc-config.git/commit/?id=d52506c8d5e78e26ae607d8805a5436cb9c89c05 commit d52506c8d5e78e26ae607d8805a5436cb9c89c05 Author: Sergei Trofimovich <slyfox@gentoo.org> AuthorDate: 2020-05-22 10:00:07 +0000 Commit: Sergei Trofimovich <slyfox@gentoo.org> CommitDate: 2020-05-22 10:00:07 +0000 gcc-config: link /lib/cpp to qualified 'cpp' Change link /lib/cpp from /usr/bin/cpp to /usr/bin/${CTARGET}-cpp. When USE_NATIVE_LINKS=no starts skipping unqualified links we might want to delete /lib/cpp, or keep it. Depends on how many tools depend on it's presence. Bug: https://bugs.gentoo.org/724454 Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org> gcc-config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/proj/gcc-config.git/commit/?id=8a4854aec042fc347066a8e73053490c403d7649 commit 8a4854aec042fc347066a8e73053490c403d7649 Author: Sergei Trofimovich <slyfox@gentoo.org> AuthorDate: 2020-05-22 13:18:58 +0000 Commit: Sergei Trofimovich <slyfox@gentoo.org> CommitDate: 2020-05-22 13:18:58 +0000 gcc-config: make USE_NATIVE_LINKS=no to clean stale symlinks Before the change symlinks like /usr/bin/cc were untouched. After the change they are explicitly removed. Bug: https://bugs.gentoo.org/724454 Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org> gcc-config | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/proj/gcc-config.git/commit/?id=7afca3b66cac89ed09172181252aed8fde9836c7 commit 7afca3b66cac89ed09172181252aed8fde9836c7 Author: Sergei Trofimovich <slyfox@gentoo.org> AuthorDate: 2020-05-22 13:22:48 +0000 Commit: Sergei Trofimovich <slyfox@gentoo.org> CommitDate: 2020-05-22 13:22:48 +0000 gcc-config: make USE_NATIVE_LINKS=no to clean /lib/cpp Bug: https://bugs.gentoo.org/724454 Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org> gcc-config | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
sys-devel/gcc-config-9999[-native-symlinks] should implement also simple filtering of /usr/bin/{cc,gcc} /lib/cpp and friends. Please give it a try as well.
(In reply to Sergei Trofimovich from comment #12) > sys-devel/gcc-config-9999[-native-symlinks] should implement also simple > filtering of /usr/bin/{cc,gcc} /lib/cpp and friends. Please give it a try as > well. I gather the runtime way of doing it is: > binutils-config $profile_name --enable-native-links > binutils-config $profile_nmae --disable-native-links And all the USE flag does is switch which of those happens by default. /me was trying to initially just do `binutils-config --enable-native-links` which just errored.
Awesome stuff though. Means the code to turn it all on, or off, is now simpler: > binutils_config="$( binutils-config -c )" > gcc_config="$( gcc-config -c )" > > links=disable > > if [[ "${RELINK:-0}" != "0" ]]; then > links=enable > fi > > binutils-config "${binutils_config}" --${links}-native-links && > gcc-config "${gcc_config}" --${links}-native-links && > eselect compiler-shadow clean all && > eselect compiler-shadow update all > Those latter stanzas are also necessary if you don't want to be bitten by ccache shadow links causing confusing errors ;) "update" seems to be enough on its own, but I did clean first explicitly because it gives output of cleanup that way.
(In reply to Kent Fredric (IRC: kent\n) from comment #13) > (In reply to Sergei Trofimovich from comment #12) > > sys-devel/gcc-config-9999[-native-symlinks] should implement also simple > > filtering of /usr/bin/{cc,gcc} /lib/cpp and friends. Please give it a try as > > well. > > I gather the runtime way of doing it is: > > > binutils-config $profile_name --enable-native-links > > binutils-config $profile_nmae --disable-native-links > > And all the USE flag does is switch which of those happens by default. > > /me was trying to initially just do `binutils-config --enable-native-links` > which just errored. Correct. You always need to pass the profile you want to switch to: # binutils-config --enable-native-links $(binutils-config -c) I'll check if it's easy to implement 'binutils-config --enable-native-links' to update current profile. But might give up :)
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=97214ef7618a46554ee41c475c041536dda31aa2 commit 97214ef7618a46554ee41c475c041536dda31aa2 Author: Sergei Trofimovich <slyfox@gentoo.org> AuthorDate: 2020-05-22 20:35:47 +0000 Commit: Sergei Trofimovich <slyfox@gentoo.org> CommitDate: 2020-05-22 20:35:56 +0000 sys-devel/gcc-config: always regenerate ccache cache USE flag change or code updates can change contents n /usr/bin. The change adds ccache link regeneration. Bug: https://bugs.gentoo.org/724454 Package-Manager: Portage-2.3.99, Repoman-2.3.22 Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org> sys-devel/gcc-config/gcc-config-9999.ebuild | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
(In reply to Kent Fredric (IRC: kent\n) from comment #14) > Awesome stuff though. Means the code to turn it all on, or off, is now > simpler: > > > binutils_config="$( binutils-config -c )" > > gcc_config="$( gcc-config -c )" > > > > links=disable > > > > if [[ "${RELINK:-0}" != "0" ]]; then > > links=enable > > fi > > > > binutils-config "${binutils_config}" --${links}-native-links && > > gcc-config "${gcc_config}" --${links}-native-links && > > eselect compiler-shadow clean all && > > eselect compiler-shadow update all > > > > Those latter stanzas are also necessary if you don't want to be bitten by > ccache shadow links causing confusing errors ;) > > "update" seems to be enough on its own, but I did clean first explicitly > because it gives output of cleanup that way. Good point. Added ccache regeneration into ebuild.
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=50a8395a13105e32b3d1487485def981ee9ccfd9 commit 50a8395a13105e32b3d1487485def981ee9ccfd9 Author: Sergei Trofimovich <slyfox@gentoo.org> AuthorDate: 2020-05-22 20:52:03 +0000 Commit: Sergei Trofimovich <slyfox@gentoo.org> CommitDate: 2020-05-22 20:53:03 +0000 sys-devel/binutils-config: bump up to 5.3, bug #724454 Main change is USE=native-symlinks to avoid symlinks without ${CTARGET} qualifier. Bug: https://bugs.gentoo.org/724454 Package-Manager: Portage-2.3.99, Repoman-2.3.22 Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org> sys-devel/binutils-config/Manifest | 1 + .../binutils-config/binutils-config-5.3.ebuild | 43 ++++++++++++++++++++++ .../binutils-config/binutils-config-9999.ebuild | 2 +- 3 files changed, 45 insertions(+), 1 deletion(-) https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=23a16099eab64a5114d8350dd0e2b5cd5d7cc3d1 commit 23a16099eab64a5114d8350dd0e2b5cd5d7cc3d1 Author: Sergei Trofimovich <slyfox@gentoo.org> AuthorDate: 2020-05-22 20:46:33 +0000 Commit: Sergei Trofimovich <slyfox@gentoo.org> CommitDate: 2020-05-22 20:53:02 +0000 sys-devel/gcc-config: bump up to 2.3, bug #724454 Main change is USE=native-symlinks to avoid symlinks without ${CTARGET} qualifier. Bug: https://bugs.gentoo.org/724454 Package-Manager: Portage-2.3.99, Repoman-2.3.22 Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org> sys-devel/gcc-config/Manifest | 1 + sys-devel/gcc-config/gcc-config-2.3.ebuild | 59 +++++++++++++++++++++++++++++ sys-devel/gcc-config/gcc-config-9999.ebuild | 5 +-- 3 files changed, 62 insertions(+), 3 deletions(-)
Let's declare it done. - USE=-native-symlinks for sys-devel/binutils-config (starting from 5.3) - USE=-native-symlinks for sys-devel/gcc-config (starting from 2.3) The effect is removed links like: - /lib/cpp - /usr/bin/{gcc,cc,g++,c++,...} - /usr/bin/{as,ld,ranlib,dwp,...}
binutils-config removed my /usr/bin/ar and friends despite USE=native-symlinks until I manually ran binutils-config myself to set them again. Could reproduce by by running the pkg_postinst(): for x in $(binutils-config -C -l 2>/dev/null | awk '$NF == "*" { print $2 }') ; do binutils-config ${x} done Where x will be i686-w64-mingw32-2.34, x86_64-pc-linux-gnu-2.34, and x86_64-w64-mingw32-2.34 Only running x86_64-pc-linux-gnu-2.34 is fine, but the mingw stuff seems to cause issues.
(In reply to Ionen Wolkens from comment #20) > binutils-config removed my /usr/bin/ar and friends despite > USE=native-symlinks until I manually ran binutils-config myself to set them > again. > > Could reproduce by by running the pkg_postinst(): > for x in $(binutils-config -C -l 2>/dev/null | awk '$NF == "*" { print > $2 }') ; do > binutils-config ${x} > done > > Where x will be i686-w64-mingw32-2.34, x86_64-pc-linux-gnu-2.34, and > x86_64-w64-mingw32-2.34 > > Only running x86_64-pc-linux-gnu-2.34 is fine, but the mingw stuff seems to > cause issues. That's unexpected. Can you file a new bug? I'll need more details.
Well, it looks simple.. from binutils-config script: if [[ ${TARGET} == ${HOST} && ${USE_NATIVE_LINKS} == yes ]] ... else rm -f "${EROOT}/usr/bin/${x}" fi I'd guess TARGET wasn't equal to HOST, so it went to to the else close despite USE_NATIVE_LINKS was yes, in which it removes all of those. Didn't have any problems with gcc-config, which seems to do things differently if [[ ${x#${CTARGET}-} == ${x} && ${USE_NATIVE_LINKS} != yes ]]; then # Delete stale native symlink. rm -f "${EROOT}usr/bin/${x}" else ...
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4a112963b02b7aa30c6b0f9e87b81c763805e986 commit 4a112963b02b7aa30c6b0f9e87b81c763805e986 Author: Sergei Trofimovich <slyfox@gentoo.org> AuthorDate: 2020-05-22 23:00:41 +0000 Commit: Sergei Trofimovich <slyfox@gentoo.org> CommitDate: 2020-05-22 23:02:02 +0000 profiles/package.mask: mask fresh binutils-config and gcc-config Let's mask them until we make sure things work for cross-compilers as well. Reported-by: Ionen Wolkens Bug: https://bugs.gentoo.org/724454 Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org> profiles/package.mask | 5 +++++ 1 file changed, 5 insertions(+)
OK, let's reopen this bug then.
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/proj/binutils-config.git/commit/?id=9fc1728560e2cd81d27dd85dc766152ddccf65c5 commit 9fc1728560e2cd81d27dd85dc766152ddccf65c5 Author: Sergei Trofimovich <slyfox@gentoo.org> AuthorDate: 2020-05-22 23:12:45 +0000 Commit: Sergei Trofimovich <slyfox@gentoo.org> CommitDate: 2020-05-22 23:12:45 +0000 binutils-config: document current binary assumptions There is a difference in gcc / binutils layout: binutils binaries are always unprefixed. Bug: https://bugs.gentoo.org/724454 Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org> src/binutils-config | 12 ++++++++++++ 1 file changed, 12 insertions(+)
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/proj/binutils-config.git/commit/?id=a9d04f80c3d5ec32168b1389a5db79cc780b05ef commit a9d04f80c3d5ec32168b1389a5db79cc780b05ef Author: Sergei Trofimovich <slyfox@gentoo.org> AuthorDate: 2020-05-23 07:37:53 +0000 Commit: Sergei Trofimovich <slyfox@gentoo.org> CommitDate: 2020-05-23 07:37:53 +0000 binutils-config: fix native link removal by cross-compilers, bug #724454 commit 36eba05752348258a7 ("binutils-config: add build-time and runtime switches to disable native symlinks"). Added symlink deletion for USE_NATIVE_LINKS=no mode. It had a bug: it unconditionally deleted native symlinks if binutils-config is called on a cross-binutils installation. I missed the case because I assumed that tool names in binutils' private directory match gcc' private directory. The change is not to perform symlink cleanup for unprefixed binaries for cross-binutils. Reported-by: Ionen Wolkens Bug: https://bugs.gentoo.org/724454 Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org> src/binutils-config | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-)
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c59883acaf26d9b1412921cb61907b30e6d90902 commit c59883acaf26d9b1412921cb61907b30e6d90902 Author: Sergei Trofimovich <slyfox@gentoo.org> AuthorDate: 2020-05-23 07:51:53 +0000 Commit: Sergei Trofimovich <slyfox@gentoo.org> CommitDate: 2020-05-23 07:55:21 +0000 sys-devel/binutils-config: bump up to 5.3.1, bug #724454 Single new change: - #724454: fix native link removal by cross-compilers Reported-by: Ionen Wolkens Closes: https://bugs.gentoo.org/724454 Package-Manager: Portage-2.3.99, Repoman-2.3.22 Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org> sys-devel/binutils-config/Manifest | 1 + .../binutils-config/binutils-config-5.3.1.ebuild | 43 ++++++++++++++++++++++ 2 files changed, 44 insertions(+) Additionally, it has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=deac1b3f0ed81ee8aa173d00645949dc9337cf34 commit deac1b3f0ed81ee8aa173d00645949dc9337cf34 Author: Sergei Trofimovich <slyfox@gentoo.org> AuthorDate: 2020-05-23 07:52:46 +0000 Commit: Sergei Trofimovich <slyfox@gentoo.org> CommitDate: 2020-05-23 07:55:21 +0000 sys-devel/binutils-config: drop problematic 5.3 release Bug: https://bugs.gentoo.org/724454 Package-Manager: Portage-2.3.99, Repoman-2.3.22 Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org> sys-devel/binutils-config/Manifest | 1 - .../binutils-config/binutils-config-5.3.ebuild | 43 ---------------------- 2 files changed, 44 deletions(-)
Should be fixed now.