Skip to content
This repository has been archived by the owner on Apr 11, 2024. It is now read-only.

Adjust the Multiarch Specifier #80

Merged
merged 1 commit into from
Feb 11, 2023
Merged

Conversation

212dandan
Copy link

Changes

  • Replace loongarch64-linux-gnuf64 with loongarch64-linux-gnu.
  • Remove all loongarch32 multiarch specifiers.

Several reasons for making the changes

  • "f64" indicates the generic purpose ABI variant. So "gnuf64" seems unnecessary - can be replaced with "gnu". We see a related discussion in llvm [1]. And gnu is adopted by many popular archs [2].
  • There is no 32-bit LoongArch chips and operating systems at present and we are not sure whether 32-bit hardware is allowed or necessary to support 64-bit floating-point. So it's better not define the tuples for now.

[1]. https://reviews.llvm.org/D135751#3851867
[2]. https://wiki.debian.org/Multiarch/Tuples

* Changes
- Replace loongarch64-linux-gnuf64 with loongarch64-linux-gnu.
- Remove all loongarch32 multiarch specifiers.

* Several reasons for making the changes
- "f64" indicates the generic purpose ABI variant. So "gnuf64" seems unnecessary - can be replaced with "gnu".
  We see a related discussion in llvm [1]. And gnu is adopted by many popular archs [2].
- There is no 32-bit LoongArch chips and operating systems at present and we are not sure whether 32-bit hardware
  is allowed or necessary to support 64-bit floating-point. So it's better not define the tuples for now.

[1]. https://reviews.llvm.org/D135751#3851867
[2]. https://wiki.debian.org/Multiarch/Tuples
@xen0n
Copy link
Contributor

xen0n commented Feb 9, 2023

You're basically overturning the previous consensus reached at #24 (actually in that thread, people including me would have liked if it stayed loongarch64-linux-gnu, but collectively we're content with the changes as-is so it got merged eventually. Much time has since passed and right now we're just starting to settle on loongarch64-linux-gnuf64, at which time you're trying to bring us back to square one again).

Although reinstating loongarch64-linux-gnu as the canonical LP64D multiarch specifier would incur minimal work for re-adapting things Debian-side at the moment, much effort would still be wasted as I suggested in #79, and doing so IMO isn't sufficient to refute pabs' suggestion on the grounds that it's in general better to protect us from name clashes even in the most unlikely cases.

Relevant IRC log:

Dec 14 09:32:40 <xxxxen0n>      and btw what's the current situation inside Loongson wrt the multiarch tuples? do we want to amend the wiki page to say "loongarch64-linux-gnuf64" instead for the new-world LP64D port?
Dec 14 10:02:52 <pabs>  for the list I'd suggest its fine to keep the vendor name "debian-loongarch", as we did for the IRC channel.
Dec 14 10:05:28 <pabs>  the shorter name should be preferred really, but I don't mind if Loongson want LoongArch for the list/irc
Dec 14 10:06:56 *       pabs has no idea re tuples, dpkg/rebootstrap/GNU upstream folks would be the ones to ask about that
Dec 14 10:08:16 <pabs>  xxxxen0n, zhangdandan: seems like the new-world loong64 should definitely have a different multi-arch tuple to old-world loongarch64 though, since they are incompatible?
Dec 14 10:10:46 <xxxxen0n>      pabs: at least I and Zhang Ning think so (although he's not in the channel), given we already took loong64 instead of loongarch64, it would be nice to have the libpath definitely separate
Dec 14 10:11:21 <xxxxen0n>      so even if some extremely ignorant user manually unpacked old-world libs onto their sysroots, the arch-specific files still won't collide
Dec 14 10:32:35 *       zhangdandan has quit (Remote host closed the connection)
Dec 14 13:23:54 <helmut>        please leave rebootstrap out of the naming discussion: it is designed such that you can rename at any time and experiment with names to see what would break.
Dec 14 13:24:37 <helmut>        rebootstrap is a qa tool. it just uses whatever name is selected elsewhere (or most likely to be selected elsewhere).
Dec 14 13:34:26 <pabs>  ah, ok
Dec 14 14:03:05 <xxxxen0n>      and, for the record, I mean we should go for `loongarch64-linux-gnuf64` as per Loongson's own Toolchain Conventions document, instead of the current `loongarch64-linux-gnu`
Dec 14 14:03:36 *       xxxxen0n afk until night
Dec 14 14:23:15 *       zhangdandan (~oftc-webi@114.242.206.180) has joined
Dec 14 14:25:16 <zhangdandan>   The aim of using “loongarch64-linux-gnuf64”,is it want to be compatible with the old world?
Dec 14 14:33:44 <zhangdandan>   loong64 just defined in dpkg, determines the name of the software package,like  linux-libc-dev_6.0.12-1_loong64.deb.
Dec 14 14:38:09 *       zhangdandan1 (~zhangdand@103.117.101.100) has joined
Dec 14 14:48:20 <zhangdandan>   Could you give me a contact information,for example weixin,mail and so on.
Dec 14 15:53:41 *       zhangdandan has quit (Remote host closed the connection)
Dec 14 16:01:18 *       zhangdandan (~oftc-webi@114.242.206.180) has joined
Dec 14 16:01:21 <zhangdandan>   "loongarch64-linux-gnuf64" instead for the new-world LP64D port is a good idea. We need change.

In conclusion:

I strongly suggest to just stick to the current state of things and settle on loongarch64-linux-gnuf64. We should:

  • document that loongarch64-linux-gnu is valid but canonicalizes into loongarch64-linux-gnuf64, and
  • explicitly disallow loongarch64-linux-gnu as the new-world multiarch specifier.

Otherwise, you should at least:

  • provide detailed argument as to why sharing the same multiarch specifier with the old world wouldn't create problems,
  • document that loongarch64-linux-gnuf64 is valid but canonicalizes into loongarch64-linux-gnu, then
  • bring pretty much everyone back into the conversation and re-reach consensus here.

And months of efforts would still be wasted, requiring much rework.

@xen0n
Copy link
Contributor

xen0n commented Feb 9, 2023

cc @scylaac @xry111 @yetist @chenhuacai @ChenghuaXu (participants of #23 #24 and #25)
cc @Rabenda (who raised the question)

Also I've noted that at least LLVM and systemd would suffer from code churn if we're to abolish loongarch64-linux-gnuf64. There are certainly many more projects that'll get affected as well.

@xen0n
Copy link
Contributor

xen0n commented Feb 9, 2023

Regarding removal of ILP32 multiarch IDs:

It's indeed true that no LA32-only chip is generally available at the moment, but some work has already been done for ILP32 support, as can be seen in LLVM/Clang. And it's not like the future tuples that would get added again after appearance of LA32 chips would change much from the present definition, so again IMO it's avoidable code churn that's best to just leave out for now.

And, as for your doubt that you "are not sure whether 32-bit hardware is allowed or necessary to support 64-bit floating-point", here's excerpt from the LoongArch Reference Manual, Chapter 3:

实现基础浮点数指令时是否包含操作双精度浮点数和双字整数的指令与架构是 LA32 还是 LA64 无关。

Whether the implementation of basic floating-point instructions includes instructions for operating double-precision floating-point numbers and double-word integers has nothing to do with whether the architecture is LA32 or LA64.

So either you don't have to worry about this non-existent problem, or tell your documentation and ISA guys to amend the manual...

@xry111
Copy link
Contributor

xry111 commented Feb 9, 2023

cc @scylaac @xry111 @yetist @chenhuacai @ChenghuaXu (participants of #23 #24 and #25) cc @Rabenda (who raised the question)

Also I've noted that at least LLVM and systemd would suffer from code churn if we're to abolish loongarch64-linux-gnuf64. There are certainly many more projects that'll get affected as well.

And GCC. If I read GCC build system code correctly:

  • With --disable-multilib --enable-multiarch: gcc -print-multiarch will say loongarch64-linux-gnu.
  • With --disable-multilib --enable-multiarch --target=loongarch64-linux-gnuf64: gcc -print-multiarch will say loongarch64-linux-gnuf64
    • Note that it means if GCC pulls a config.guess update, the result can "mysteriously" change.
  • With --enable-multilib --enable-multiarch: gcc -print-multiarch -mabi=lp64d will always say loongarch64-linux-gnuf64 no matter if --target= contains f64.

The inconsistency can be trivially fixed after a final decision about using or not using f64 though.

@xry111
Copy link
Contributor

xry111 commented Feb 9, 2023

cc @scylaac @xry111 @yetist @chenhuacai @ChenghuaXu (participants of #23 #24 and #25) cc @Rabenda (who raised the question)
Also I've noted that at least LLVM and systemd would suffer from code churn if we're to abolish loongarch64-linux-gnuf64. There are certainly many more projects that'll get affected as well.

And GCC. If I read GCC build system code correctly:

  • With --disable-multilib --enable-multiarch: gcc -print-multiarch will say loongarch64-linux-gnu.

  • With --disable-multilib --enable-multiarch --target=loongarch64-linux-gnuf64: gcc -print-multiarch will say loongarch64-linux-gnuf64

    • Note that it means if GCC pulls a config.guess update, the result can "mysteriously" change.
  • With --enable-multilib --enable-multiarch: gcc -print-multiarch -mabi=lp64d will always say loongarch64-linux-gnuf64 no matter if --target= contains f64.

The inconsistency can be trivially fixed after a final decision about using or not using f64 though.

Well, not a suffer from code churn actually, but "the inconsistency can churn other code".

@xry111
Copy link
Contributor

xry111 commented Feb 9, 2023

And, as for your doubt that you "are not sure whether 32-bit hardware is allowed or necessary to support 64-bit floating-point", here's excerpt from the LoongArch Reference Manual, Chapter 3:

实现基础浮点数指令时是否包含操作双精度浮点数和双字整数的指令与架构是 LA32 还是 LA64 无关。
Whether the implementation of basic floating-point instructions includes instructions for operating double-precision floating-point numbers and double-word integers has nothing to do with whether the architecture is LA32 or LA64.

So either you don't have to worry about this non-existent problem, or tell your documentation and ISA guys to amend the manual...

Some off-topic trivia:

LA32 + FP64 reminds me some old time when people (over)uses floating point operation to speed up the integer arithmetic in range $[2^{31}, 2^{52})$ on https://codeforces.com (using a 32-bit GCC years ago). Such a configuration can be useful for data processing etc. anyway...

@rex-ms
Copy link

rex-ms commented Feb 9, 2023

  1. 当时使用loongarch64-linux-gnuf64是参考《工具链调用约定》:https://loongson.github.io/LoongArch-Documentation/LoongArch-toolchain-conventions-CN.html
    当时的工具链约定手册写的是gnuf64。

  2. 我们本地gnuf64和gnu的环境也基本到位了, 根据决策开展工作。

@RevySR
Copy link

RevySR commented Feb 9, 2023

龙芯员工代表龙芯公司说的话语:
image

一切的讨论都是无效的 只有龙芯的最终决定才行 我只能说 之前那些讨论有什么用呢 龙芯开会定不是挺好的嘛

@SixWeining
Copy link

cc @scylaac @xry111 @yetist @chenhuacai @ChenghuaXu (participants of #23 #24 and #25) cc @Rabenda (who raised the question)
Also I've noted that at least LLVM and systemd would suffer from code churn if we're to abolish loongarch64-linux-gnuf64. There are certainly many more projects that'll get affected as well.

And GCC. If I read GCC build system code correctly:

  • With --disable-multilib --enable-multiarch: gcc -print-multiarch will say loongarch64-linux-gnu.

  • With --disable-multilib --enable-multiarch --target=loongarch64-linux-gnuf64: gcc -print-multiarch will say loongarch64-linux-gnuf64

    • Note that it means if GCC pulls a config.guess update, the result can "mysteriously" change.
  • With --enable-multilib --enable-multiarch: gcc -print-multiarch -mabi=lp64d will always say loongarch64-linux-gnuf64 no matter if --target= contains f64.

The inconsistency can be trivially fixed after a final decision about using or not using f64 though.

And some triples I see in llvm:
$ llvm-config --host-target
loongarch64-unknown-linux-gnu
$ clang -print-target-triple
loongarch64-unknown-linux-gnu
$ llc --version
LLVM (http://llvm.org/):
LLVM version 17.0.0git
DEBUG build with assertions.
Default target: loongarch64-unknown-linux-gnu
Host CPU: la464

@xry111
Copy link
Contributor

xry111 commented Feb 9, 2023

cc @scylaac @xry111 @yetist @chenhuacai @ChenghuaXu (participants of #23 #24 and #25) cc @Rabenda (who raised the question)
Also I've noted that at least LLVM and systemd would suffer from code churn if we're to abolish loongarch64-linux-gnuf64. There are certainly many more projects that'll get affected as well.

And GCC. If I read GCC build system code correctly:

  • With --disable-multilib --enable-multiarch: gcc -print-multiarch will say loongarch64-linux-gnu.

  • With --disable-multilib --enable-multiarch --target=loongarch64-linux-gnuf64: gcc -print-multiarch will say loongarch64-linux-gnuf64

    • Note that it means if GCC pulls a config.guess update, the result can "mysteriously" change.
  • With --enable-multilib --enable-multiarch: gcc -print-multiarch -mabi=lp64d will always say loongarch64-linux-gnuf64 no matter if --target= contains f64.

The inconsistency can be trivially fixed after a final decision about using or not using f64 though.

And some triples I see in llvm: $ llvm-config --host-target loongarch64-unknown-linux-gnu $ clang -print-target-triple loongarch64-unknown-linux-gnu $ llc --version LLVM (http://llvm.org/): LLVM version 17.0.0git DEBUG build with assertions. Default target: loongarch64-unknown-linux-gnu Host CPU: la464

这个无所谓,主要问题是 clang -print-multiarch 的输出。

我来说一下问题背景,multiarch 这个东西事为了修饰文件/目录名,从而让发行版更容易支持多个 ABI。比如在 x86 上一些发行版会有 /usr/lib/i386-linux-gnu/usr/lib/x86_64-linux-gnu (大概相当于传统的 /usr/lib32/usr/lib64),还有 /usr/include/i386-linux-gnu/usr/include/x86_64-linux-gnu 之类的,定了规范以后 gcc/clang/ld/ld.so 这些东西就都按这个规范配置搜索路径,所以这个东西至少在一个发行版上必须一致,不能和 ./configure --target= 那个一样弄别名。

Python 也开始加这东西:

$ ls /usr/lib/python3.11/site-packages/*.so | head -n1
/usr/lib/python3.11/site-packages/_brotli.cpython-311-x86_64-linux-gnu.so

然后还有个东西叫 PyPI,就有个什么结果呢,你的发行版的 Python 给的 multiarch 目录名如果和 PyPI 不一致的话 pip install 就没法用。目前 Python 的行为是在构建时先 $(CC) -print-multiarch,没输出就根据当前架构直接加一个,不知道当前架构就不加,所以我本地编译出来的 Python Module 的 .so 文件是不加的。

其实意见不一致的话可以每个发行版自己搞,工具链 patch 一下,Python patch 一下,大概就行了?(就是工具链按自己搞法,Python 和 PyPI 一致。) 这又不是啥神秘的难搞的东西,改个搜索路径很 trivial 的。

至于“不同发行版间兼容性”这个概念早就已经咩了,不用管,不然 docker 这种东西也不会大行其道。

@RevySR
Copy link

RevySR commented Feb 9, 2023

cc @scylaac @xry111 @yetist @chenhuacai @ChenghuaXu (participants of #23 #24 and #25) cc @Rabenda (who raised the question)
Also I've noted that at least LLVM and systemd would suffer from code churn if we're to abolish loongarch64-linux-gnuf64. There are certainly many more projects that'll get affected as well.

And GCC. If I read GCC build system code correctly:

  • With --disable-multilib --enable-multiarch: gcc -print-multiarch will say loongarch64-linux-gnu.

  • With --disable-multilib --enable-multiarch --target=loongarch64-linux-gnuf64: gcc -print-multiarch will say loongarch64-linux-gnuf64

    • Note that it means if GCC pulls a config.guess update, the result can "mysteriously" change.
  • With --enable-multilib --enable-multiarch: gcc -print-multiarch -mabi=lp64d will always say loongarch64-linux-gnuf64 no matter if --target= contains f64.

The inconsistency can be trivially fixed after a final decision about using or not using f64 though.

And some triples I see in llvm: $ llvm-config --host-target loongarch64-unknown-linux-gnu $ clang -print-target-triple loongarch64-unknown-linux-gnu $ llc --version LLVM (http://llvm.org/): LLVM version 17.0.0git DEBUG build with assertions. Default target: loongarch64-unknown-linux-gnu Host CPU: la464

https://reviews.llvm.org/D142685
https://reviews.llvm.org/D142688

@xen0n
Copy link
Contributor

xen0n commented Feb 9, 2023

And some triples I see in llvm:

$ llvm-config --host-target
loongarch64-unknown-linux-gnu
$ clang -print-target-triple
loongarch64-unknown-linux-gnu
$ llc --version
LLVM (http://llvm.org/):
  LLVM version 17.0.0git
  DEBUG build with assertions.
  Default target: loongarch64-unknown-linux-gnu
  Host CPU: la464

This actually depends on the host triple i.e. CHOST.

For example on my (migrated for Toolchain Conventions compliance) box:

$ llvm-config --host-target
loongarch64-unknown-linux-gnuf64

$ clang -print-target-triple
loongarch64-unknown-linux-gnuf64

$ llc --version
LLVM (http://llvm.org/):
  LLVM version 16.0.0
  Optimized build.
  Default target: loongarch64-unknown-linux-gnuf64
  Host CPU: (unknown)

@xry111
Copy link
Contributor

xry111 commented Feb 9, 2023

龙芯员工代表龙芯公司说的话语: image

一切的讨论都是无效的 只有龙芯的最终决定才行 我只能说 之前那些讨论有什么用呢 龙芯开会定不是挺好的嘛

这个东西理论上还真不是龙芯能决定的,我很确定 Intel 没有决定 x86_64-linux-gnu,RISC-V 我大概搜了一下 multiarch tuple 也不是 foundation 定的,基本上就是发行版想怎么样怎么样。甚至就算龙芯强推到上游也就是一行 sed 或者几行 patch 的事情,我记得 Debian/Ubuntu 编译 GCC 时候打 multiarch 补丁打了好几年了。

@wangleiat
Copy link

wangleiat commented Feb 9, 2023

这个东西理论上还真不是龙芯能决定的,我很确定 Intel 没有决定 x86_64-linux-gnu,RISC-V 我大概搜了一下 multiarch tuple 也不是 foundation 定的,基本上就是发行版想怎么样怎么样。

基本赞同,按照发行版Debian惯例,新的架构还是优先使用gnu更好一些。

甚至就算龙芯强推到上游也就是一行 sed 或者几行 patch 的事情,我记得 Debian/Ubuntu 编译 GCC 时候打 multiarch 补丁打了好几年了。

目前真正推到社区的发行版好像还没有?自己私下做的,如你所说打几个补丁就好了。

@xen0n
Copy link
Contributor

xen0n commented Feb 9, 2023

这个东西理论上还真不是龙芯能决定的,我很确定 Intel 没有决定 x86_64-linux-gnu,RISC-V 我大概搜了一下 multiarch tuple 也不是 foundation 定的,基本上就是发行版想怎么样怎么样。

基本赞同,按照发行版Debian惯例,新的架构还是优先使用gnu更好一些。

不完全,我们当初《工具链约定》写全 multiarch ID 的 float ABI suffix 也是形式对称,显式、直观提供更多信息。不至于因为“最常用”就使得 multiarch ID 外形的不对称合理化。

另外见前边我贴的 12 月 IRC log,旧世界已经用了 loongarch64-linux-gnu 因此上游维护者、参与 loong64 port 工作的 Debian Developer 之一 pabs 也提议新世界是不是换一个,毕竟 ABI 不兼容了。loongarch64 也换 loong64 了,文件安装路径变一下也最稳妥。

甚至就算龙芯强推到上游也就是一行 sed 或者几行 patch 的事情,我记得 Debian/Ubuntu 编译 GCC 时候打 multiarch 补丁打了好几年了。

目前真正推到社区的发行版好像还没有?自己私下做的,如你所说打几个补丁就好了。

如前所述 Gentoo 已经达到官方正式支持,且早已准备按照《工具链约定》修正先前的做法。(Gentoo 采用 loongarch64-unknown-linux-gnu 的唯一原因是这个移植比《工具链约定》还早,后边维持只是为了方便用户不用切换 CHOST 麻烦。)

不过 Gentoo 本身不采用 multiarch 的目录布局,所以这边的改动也只是影响跟 Debian 互操作而已。

@RevySR
Copy link

RevySR commented Feb 9, 2023

这个东西理论上还真不是龙芯能决定的,我很确定 Intel 没有决定 x86_64-linux-gnu,RISC-V 我大概搜了一下 multiarch tuple 也不是 foundation 定的,基本上就是发行版想怎么样怎么样。

基本赞同,按照发行版Debian惯例,新的架构还是优先使用gnu更好一些。

甚至就算龙芯强推到上游也就是一行 sed 或者几行 patch 的事情,我记得 Debian/Ubuntu 编译 GCC 时候打 multiarch 补丁打了好几年了。

目前真正推到社区的发行版好像还没有?自己私下做的,如你所说打几个补丁就好了。

根本不是打几个补丁的事 已经反复推翻了两次 deepin这边都快能启动了

@wangleiat
Copy link

这个东西理论上还真不是龙芯能决定的,我很确定 Intel 没有决定 x86_64-linux-gnu,RISC-V 我大概搜了一下 multiarch tuple 也不是 foundation 定的,基本上就是发行版想怎么样怎么样。

基本赞同,按照发行版Debian惯例,新的架构还是优先使用gnu更好一些。

不完全,我们当初《工具链约定》写全 multiarch ID 的 float ABI suffix 也是形式对称,显式、直观提供更多信息。不至于因为“最常用”就使得 multiarch ID 外形的不对称合理化。

另外见前边我贴的 12 月 IRC log,旧世界已经用了 loongarch64-linux-gnu 因此上游维护者、参与 loong64 port 工作的 Debian Developer 之一 pabs 也提议新世界是不是换一个,毕竟 ABI 不兼容了。loongarch64 也换 loong64 了,文件安装路径变一下也最稳妥。

这个应该不是问题吧?社区中真的存在什么新旧世界之分吗?个人观点,还是按照Debian的惯例更合理一些(好像没有哪个架构上来就加了万恶的尾巴^_^)

甚至就算龙芯强推到上游也就是一行 sed 或者几行 patch 的事情,我记得 Debian/Ubuntu 编译 GCC 时候打 multiarch 补丁打了好几年了。

目前真正推到社区的发行版好像还没有?自己私下做的,如你所说打几个补丁就好了。

如前所述 Gentoo 已经达到官方正式支持,且早已准备按照《工具链约定》修正先前的做法。(Gentoo 采用 loongarch64-unknown-linux-gnu 的唯一原因是这个移植比《工具链约定》还早,后边维持只是为了方便用户不用切换 CHOST 麻烦。)

不过 Gentoo 本身不采用 multiarch 的目录布局,所以这边的改动也只是影响跟 Debian 互操作而已。

同样道理,社区中还没有哪个发行版使用了gnuf64,即使有也只是影响与Debian的互操作而已。

@RevySR
Copy link

RevySR commented Feb 9, 2023

这个东西理论上还真不是龙芯能决定的,我很确定 Intel 没有决定 x86_64-linux-gnu,RISC-V 我大概搜了一下 multiarch tuple 也不是 foundation 定的,基本上就是发行版想怎么样怎么样。

基本赞同,按照发行版Debian惯例,新的架构还是优先使用gnu更好一些。

不完全,我们当初《工具链约定》写全 multiarch ID 的 float ABI suffix 也是形式对称,显式、直观提供更多信息。不至于因为“最常用”就使得 multiarch ID 外形的不对称合理化。
另外见前边我贴的 12 月 IRC log,旧世界已经用了 loongarch64-linux-gnu 因此上游维护者、参与 loong64 port 工作的 Debian Developer 之一 pabs 也提议新世界是不是换一个,毕竟 ABI 不兼容了。loongarch64 也换 loong64 了,文件安装路径变一下也最稳妥。

这个应该不是问题吧?社区中真的存在什么新旧世界之分吗?个人观点,还是按照Debian的惯例更合理一些(好像没有哪个架构上来就加了万恶的尾巴^_^)

甚至就算龙芯强推到上游也就是一行 sed 或者几行 patch 的事情,我记得 Debian/Ubuntu 编译 GCC 时候打 multiarch 补丁打了好几年了。

目前真正推到社区的发行版好像还没有?自己私下做的,如你所说打几个补丁就好了。

如前所述 Gentoo 已经达到官方正式支持,且早已准备按照《工具链约定》修正先前的做法。(Gentoo 采用 loongarch64-unknown-linux-gnu 的唯一原因是这个移植比《工具链约定》还早,后边维持只是为了方便用户不用切换 CHOST 麻烦。)
不过 Gentoo 本身不采用 multiarch 的目录布局,所以这边的改动也只是影响跟 Debian 互操作而已。

同样道理,社区中还没有哪个发行版使用了gnuf64,即使有也只是影响与Debian的互操作而已。

有啊 如果有新世界装了loongnix/uos/kylin的deb包 还可以当跨新旧世界的兼容方案 在不同的目录里安装

而且将来适配的时候 给装旧世界的包留有余地

@cheese
Copy link

cheese commented Feb 9, 2023

没看完前面的的对话。只想说,制订 specification 是要负起历史责任的,应该尽量保持向前兼容

@xry111
Copy link
Contributor

xry111 commented Feb 9, 2023

这个东西理论上还真不是龙芯能决定的,我很确定 Intel 没有决定 x86_64-linux-gnu,RISC-V 我大概搜了一下 multiarch tuple 也不是 foundation 定的,基本上就是发行版想怎么样怎么样。

基本赞同,按照发行版Debian惯例,新的架构还是优先使用gnu更好一些。

甚至就算龙芯强推到上游也就是一行 sed 或者几行 patch 的事情,我记得 Debian/Ubuntu 编译 GCC 时候打 multiarch 补丁打了好几年了。

目前真正推到社区的发行版好像还没有?自己私下做的,如你所说打几个补丁就好了。

根本不是打几个补丁的事 已经反复推翻了两次 deepin这边都快能启动了

我意思你把所有出现 loongarch64-linux-gnu 的地方都加个 f64,然后已经编译的就不用动了。硬编码 multiarch tuple 的地方不多,一般都是用 $(CC) -print-multiarch 去获取,所以主要管住 GCC 和 clang。

在这个 LSB 已经死了,大家群魔乱舞地搞静态编译/系统镜像的时代不同发行版根本就不可能互操作,所以我对这个问题不站立场,按我们 LFS 的话来说 your distro your rules,他非要写进文档你不管他就行了,只要你自己发行版内部是一致的就行。

@RevySR
Copy link

RevySR commented Feb 9, 2023

这个东西理论上还真不是龙芯能决定的,我很确定 Intel 没有决定 x86_64-linux-gnu,RISC-V 我大概搜了一下 multiarch tuple 也不是 foundation 定的,基本上就是发行版想怎么样怎么样。

基本赞同,按照发行版Debian惯例,新的架构还是优先使用gnu更好一些。

甚至就算龙芯强推到上游也就是一行 sed 或者几行 patch 的事情,我记得 Debian/Ubuntu 编译 GCC 时候打 multiarch 补丁打了好几年了。

目前真正推到社区的发行版好像还没有?自己私下做的,如你所说打几个补丁就好了。

根本不是打几个补丁的事 已经反复推翻了两次 deepin这边都快能启动了

我意思你把所有出现 loongarch64-linux-gnu 的地方都加个 f64,然后已经编译的就不用动了。硬编码 multiarch tuple 的地方不多,一般都是用 $(CC) -print-multiarch 去获取,所以主要管住 GCC 和 clang。

在这个 LSB 已经死了,大家群魔乱舞地搞静态编译/系统镜像的时代不同发行版根本就不可能互操作,所以我对这个问题不站立场,按我们 LFS 的话来说 your distro your rules,他非要写进文档你不管他就行了,只要你自己发行版内部是一致的就行。

  1. 这个操作在切f64的时候已经做过一次兼容了 现在显然的问题在于 龙芯这次推规范根本没有能足够说服社区的理由

  2. Debian 涉及到以下问题 在用旧的枚举新的时候

  • python就是典型受害者 这个会撞到大量鬼打墙(指满足依赖但是不能编译通过) 之前我是手工干预掉的
  • 还有ghc的编译会吃到上一轮枚举的triple干预
  • 需要迁移multiarch目录到新目录 旧目录采取link手段(这个地方反着做会遇到pkg-config打出来的东西libdir计算错误 属于debian独有问题
  • 头文件涉及的 linux-libc-dev这个包需要优先干预 否则涉及内核的也会遇到错误
  • llvm还没验证到 现在还不能确定llvm相关是否会遇到问题
  • (补充)gir系列包的debhelper相关辅助函数会确认是不是真正归属于f64路径下的包 没有就失败(也算debian独有问题)

以上的那些顺便验证了f64在debian上工作良好 根本就不会遇到所谓的技术难题
之前 @rex-ms 讲到与约定存在矛盾 矛盾点从我验证这些东西来看 没有看到

  • 以我的经验看起来 现在技术上根本没有难题 所以更不能接受的是反复横跳这件事本身
  • 反复横跳现在是消解社区对龙芯的耐心
  • 如果确实有能够说服这次切回f64的技术性难题 可以试图公开一起解决
  • 龙芯公司决议这种理由说服社区人员接受显然是不够诚意 也不能理解的

改f64中涉及修改的包的列表
(有的可能不完全是改f64 这些都是当初等待dpkg修改完成准备提交上游化的包

beige|main|source: autoconf2.69 2.69-3.1deepin1
beige|main|source: binutils 2.39.90.20230110-1deepin1
beige|main|source: doxygen 1.9.4-4deepin1
beige|main|source: dpkg 1.21.18deepin2
beige|main|source: eckit 1.20.2-1deepin1
beige|main|source: efibootmgr 17-2deepin1
beige|main|source: efivar 37-6deepin1
beige|main|source: fakeroot 1.30.1-1.1deepin1
beige|main|source: gcc-12 12.2.0-14deepin1
beige|main|source: gcc-13 13-20230126-1deepin1
beige|main|source: gcc-snapshot 1:20230108-1deepin2
beige|main|source: ghc 9.0.2-4+ulb3+deepin3
beige|main|source: glibc 2.36-8deepin3
beige|main|source: gnu-efi 3.0.15-1deepin1
beige|main|source: golang-1.19 1.19.4-1deepin1
beige|main|source: google-perftools 2.10-1deepin1
beige|main|source: guile-3.0 3.0.8-2deepin1
beige|main|source: hdf5 1.10.8+repack1-1deepin1
beige|main|source: ipykernel 6.17.0-1deepin1
beige|main|source: libffi 3.4.4-1deepin1
beige|main|source: libhdf4 4.2.15-5deepin1
beige|main|source: libqtxdg 3.6.0-1+deepin1
beige|main|source: libseccomp 2.5.4-1deepin2
beige|main|source: libxml2 2.9.14+dfsg-1.1+rdeepin1
beige|main|source: luajit 2.1.0~beta3+git20220320+dfsg-4.1deepin1
beige|main|source: luajit2 2.1-20220915-2deepin1
beige|main|source: mpi-defaults 1.14+deepin1
beige|main|source: netcdf 1:4.9.0-3+rdeepin1
beige|main|source: nodejs 18.13.0+dfsg1-1deepin1
beige|main|source: odc 1.4.6-2deepin1
beige|main|source: openblas 0.3.21+ds-4deepin1
beige|main|source: opencv 4.6.0+dfsg-10deepin1
beige|main|source: openssl 3.0.7-2deepin1
beige|main|source: pandoc 2.17.1.1-1.1deepin1
beige|main|source: pydevd 2.9.5+ds-2deepin1
beige|main|source: python-asyncssh 2.10.1-2deepin1
beige|main|source: python-greenlet 2.0.1-1deepin1
beige|main|source: python3.10 3.10.9-1deepin1
beige|main|source: python3.11 3.11.1-2deepin1
beige|main|source: pythran 0.11.0+ds-7deepin1
beige|main|source: qscintilla2 2.13.3+dfsg-3deepin1
beige|main|source: qtwebkit-opensource-src 5.212.0~alpha4-28deepin1
beige|main|source: sysbench 1.0.20+ds-5deepin1
beige|main|source: systemd 252.4-2deepin1
beige|main|source: vtk9 9.1.0+really9.1.0+dfsg2-4deepin2

@SixWeining
Copy link

我意思你把所有出现 loongarch64-linux-gnu 的地方都加个 f64,然后已经编译的就不用动了。硬编码 multiarch tuple 的地方不多,一般都是用 $(CC) -print-multiarch 去获取,所以主要管住 GCC 和 clang。

clang已经从16开始废弃了对--print-multiarch的支持 https://reviews.llvm.org/D133170

@RevySR
Copy link

RevySR commented Feb 10, 2023

龙芯不回应的approve是在是否是想在这件事上装死糊弄过去?

@Rei-Hatada
Copy link

Rei-Hatada commented Feb 10, 2023

@lixing-star @rex-ms

你们没法站出来正面回应一下?这件事对于社区来说影响太恶劣了,在这装死只会让事情更加恶化。

@RevySR
Copy link

RevySR commented Feb 10, 2023

补充2023年1月30日 达成的第二次共识(社区讨论群的社区人员达成共识 龙芯方面未做表态):

image

Copy link

@SixWeining SixWeining left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里貌似主要在定义GNU相关的triple和multiarch,musl相关定义似乎不适合放在这个文档里定义?可一起删掉?

@xen0n
Copy link
Contributor

xen0n commented Feb 10, 2023

这里貌似主要在定义GNU相关的triple和multiarch,musl相关定义似乎不适合放在这个文档里定义?可一起删掉?

musl 的部分倒是:

  • port 没上游(仍在 review 中)
  • 在 musl 上游要围绕 multiarch tuple 开展的相关讨论没开始
  • 当初 https://reviews.llvm.org/D135751 这边也 back out 了相关适配
  • 《工具链约定》里的相应内容是从 glibc 情况平移过来的,这部分内容里没有新的讨论点

所以去掉没问题,不会伤到共识。

本次讨论的焦点是 2 年前讨论形成的大家不反对的共识(LP64D ABI 的 multiarch ID 仍然带 f64 后缀以保持形式对称)要不要被单方面推翻。

Copy link

@wangleiat wangleiat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个东西本身就是Debian定义的东西(不排除其他发行版也借鉴了),在这里讨论其实已经超出了这个文档所能约束的范围。但是这个改动,看起来更符合Debian风格(新架构的常用abi对应的multiarch为gnu,最新一个应该是riscv64-linux-gnu)。而且Debian的loong64 ports页面也已经进行了描述(loongarch64-linux-gnu),这里的修改只需要保持与Debian一致就好,文档对multiarch的描述只是提示作用,而不是约束。

@SixWeining SixWeining self-requested a review February 11, 2023 01:43
Copy link

@SixWeining SixWeining left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

很遗憾没能参与到 #29 的讨论中。鉴于Debian wiki已经是loongarch64-linux-gnu,我同意本次修改。@MaskRay 觉得怎么样?

@loongson-zn
Copy link

cc @scylaac @xry111 @yetist @chenhuacai @ChenghuaXu (participants of #23 #24 and #25) cc @Rabenda (who raised the question)
Also I've noted that at least LLVM and systemd would suffer from code churn if we're to abolish loongarch64-linux-gnuf64. There are certainly many more projects that'll get affected as well.

And GCC. If I read GCC build system code correctly:

  • With --disable-multilib --enable-multiarch: gcc -print-multiarch will say loongarch64-linux-gnu.

  • With --disable-multilib --enable-multiarch --target=loongarch64-linux-gnuf64: gcc -print-multiarch will say loongarch64-linux-gnuf64

    • Note that it means if GCC pulls a config.guess update, the result can "mysteriously" change.
  • With --enable-multilib --enable-multiarch: gcc -print-multiarch -mabi=lp64d will always say loongarch64-linux-gnuf64 no matter if --target= contains f64.

The inconsistency can be trivially fixed after a final decision about using or not using f64 though.

And some triples I see in llvm: $ llvm-config --host-target loongarch64-unknown-linux-gnu $ clang -print-target-triple loongarch64-unknown-linux-gnu $ llc --version LLVM (http://llvm.org/): LLVM version 17.0.0git DEBUG build with assertions. Default target: loongarch64-unknown-linux-gnu Host CPU: la464

这个无所谓,主要问题是 clang -print-multiarch 的输出。

我来说一下问题背景,multiarch 这个东西事为了修饰文件/目录名,从而让发行版更容易支持多个 ABI。比如在 x86 上一些发行版会有 /usr/lib/i386-linux-gnu/usr/lib/x86_64-linux-gnu (大概相当于传统的 /usr/lib32/usr/lib64),还有 /usr/include/i386-linux-gnu/usr/include/x86_64-linux-gnu 之类的,定了规范以后 gcc/clang/ld/ld.so 这些东西就都按这个规范配置搜索路径,所以这个东西至少在一个发行版上必须一致,不能和 ./configure --target= 那个一样弄别名。

Python 也开始加这东西:

$ ls /usr/lib/python3.11/site-packages/*.so | head -n1
/usr/lib/python3.11/site-packages/_brotli.cpython-311-x86_64-linux-gnu.so

然后还有个东西叫 PyPI,就有个什么结果呢,你的发行版的 Python 给的 multiarch 目录名如果和 PyPI 不一致的话 pip install 就没法用。目前 Python 的行为是在构建时先 $(CC) -print-multiarch,没输出就根据当前架构直接加一个,不知道当前架构就不加,所以我本地编译出来的 Python Module 的 .so 文件是不加的。

其实意见不一致的话可以每个发行版自己搞,工具链 patch 一下,Python patch 一下,大概就行了?(就是工具链按自己搞法,Python 和 PyPI 一致。) 这又不是啥神秘的难搞的东西,改个搜索路径很 trivial 的。

至于“不同发行版间兼容性”这个概念早就已经咩了,不用管,不然 docker 这种东西也不会大行其道。

  1. 关于python multiarch 部分,我们将根据新的用户手册在上游提交补丁,以后*.so会像其他架构一样会带着 multiarch 部分。 同时也避免出现有带multiarch和不带multiarch的两种情况,出现so-abi不兼容的情况
  2. pypi 龙芯有自己的搭建的仓库,配上运行速度更快。为了出现您所说的用不了的情况(so-abi不兼容),统一都带multiarch
  3. 考虑龙芯线上线下长久发展,及日后各操作系统厂商不必要的麻烦,同意更改为loongarch64-linux-gnu

@FreeFlyingSheep FreeFlyingSheep merged commit 55dbaad into loongson:main Feb 11, 2023
@RevySR
Copy link

RevySR commented Feb 11, 2023

考虑到商业因素之类的东西
#80 (comment) 是可以接受的
但是这些approve的人没有给出理由就approve 观感很差

关于debian wiki相关描述的原因补充解释一下 @wangleiat @SixWeining
在irc里提出修改后 实际上wiki没修改的原因是等待 Debian合并dpkg后修改wiki
用wiki证明属于因果倒置

@MaskRay
Copy link

MaskRay commented Feb 11, 2023

https://wiki.debian.org/Multiarch/Tuples 很多triples用 *-linux-gnu,但也有很多用 *-linux-gnu<suffix>,所以"更符合Debian风格"不应做为主要理由。

我理解的Debian multiarch的问题是 gcc -dumpmachine 输出没有部分,其他绝大多数系统都带(可以填unknownpc)。

@xen0n
Copy link
Contributor

xen0n commented Feb 11, 2023

  1. 关于python multiarch 部分,我们将根据新的用户手册在上游提交补丁,以后*.so会像其他架构一样会带着 multiarch 部分。 同时也避免出现有带multiarch和不带multiarch的两种情况,出现so-abi不兼容的情况
  2. pypi 龙芯有自己的搭建的仓库,配上运行速度更快。为了出现您所说的用不了的情况(so-abi不兼容),统一都带multiarch
  3. 考虑龙芯线上线下长久发展,及日后各操作系统厂商不必要的麻烦,同意更改为loongarch64-linux-gnu

感谢披露商业因素。您这条回复很勇敢。

xen0n added a commit to xen0n/LoongArch-Documentation that referenced this pull request Feb 11, 2023
This is without the commercial reasons (see the linked PR) to hopefully
make the change more palatable to the angry mob of unknowing readers.

For the record: this is DEFINITELY NOT the full reason behind the
closed-door decision. But this is about as close as we community people
can get in persuading the depressed ourselves, and about all I can
disclose after having multiple private conversations with relevant
parties, without inflicting damage to anyone at Loongson or Loongson as
a whole (we don't really want to openly criticize Loongson for tweaking
a 1-year-old document for primarily commercial reasons, but again it's
arguably fair for a privately-controlled ISA to evolve like this).

See: loongson#80
@xen0n
Copy link
Contributor

xen0n commented Feb 11, 2023

@loongson-zn

pypi 龙芯有自己的搭建的仓库,配上运行速度更快。为了出现您所说的用不了的情况(so-abi不兼容),统一都带multiarch

考虑龙芯线上线下长久发展,及日后各操作系统厂商不必要的麻烦,同意更改为loongarch64-linux-gnu

仔细想了下,很不幸,这有风险:

我们无法控制龙架构的用户不向真正 PyPI 传包(其实向你们的 PyPI 镜像传包也一样),所以可预见的将来一定会同时有新世界和旧世界上构建的 wheel 被传上。目前上游在 wheel 的命名上没有感知龙架构的新旧世界,所以两个世界做的 wheel 名字目前来看一定是一样的。

这样一定会出现用户装上异世界 wheel 且流程不马上死掉的情况,失败会发生在更往后的运行时某时刻。因为 Python 原生扩展不是完整 POSIX 程序,所以没踩到新旧世界不兼容点(如信号处理、裸的 fstat 等系统调用之类)的那些扩展不会出事,其他的会在被调用的时候炸。虽然我不是很确定存不存在这样的扩展(因为新旧世界不兼容之一是 glibc 符号版本,其实想像不到会有不依赖 libc 符号的 Python 扩展,这样的话 import 时刻动态链接器就会拒绝加载)但总归这是现状处理方式确实会允许的现实可能性。

wangliu-iscas pushed a commit to plctlab/patchwork-gcc that referenced this pull request Feb 13, 2023
Multiarch tuple will be coded in file or directory names in
multiarch-aware distros, so one ABI should have only one multiarch
tuple.  For example, "--target=loongarch64-linux-gnu --with-abi=lp64s"
and "--target=loongarch64-linux-gnusf" should both set multiarch tuple
to "loongarch64-linux-gnusf".  Before this commit,
"--target=loongarch64-linux-gnu --with-abi=lp64s --disable-multilib"
will produce wrong result (loongarch64-linux-gnu).

A recent LoongArch psABI revision mandates "loongarch64-linux-gnu" to be
used for -mabi=lp64d (instead of "loongarch64-linux-gnuf64") for some
non-technical reason [1].  Note that we cannot make
"loongarch64-linux-gnuf64" an alias for "loongarch64-linux-gnu" because
to implement such an alias, we must create thousands of symlinks in the
distro and doing so would be completely unpractical.  This commit also
aligns GCC with the revision.

Tested by building cross compilers with --enable-multiarch and multiple
combinations of --target=loongarch64-linux-gnu*, --with-abi=lp64{s,f,d},
and --{enable,disable}-multilib; and run "xgcc --print-multiarch" then
manually verify the result with eyesight.

Ok for trunk and backport to releases/gcc-12?

[1]: loongson/LoongArch-Documentation#80

gcc/ChangeLog:

	* config.gcc (triplet_abi): Set its value based on $with_abi,
	instead of $target.
	(la_canonical_triplet): Set it after $triplet_abi is set
	correctly.
	* config/loongarch/t-linux (MULTILIB_OSDIRNAMES): Make the
	multiarch tuple for lp64d "loongarch64-linux-gnu" (without
	"f64" suffix).
xionghul pushed a commit to xionghul/gcc that referenced this pull request Feb 18, 2023
Multiarch tuple will be coded in file or directory names in
multiarch-aware distros, so one ABI should have only one multiarch
tuple.  For example, "--target=loongarch64-linux-gnu --with-abi=lp64s"
and "--target=loongarch64-linux-gnusf" should both set multiarch tuple
to "loongarch64-linux-gnusf".  Before this commit,
"--target=loongarch64-linux-gnu --with-abi=lp64s --disable-multilib"
will produce wrong result (loongarch64-linux-gnu).

A recent LoongArch psABI revision mandates "loongarch64-linux-gnu" to be
used for -mabi=lp64d (instead of "loongarch64-linux-gnuf64") for some
non-technical reason [1].  Note that we cannot make
"loongarch64-linux-gnuf64" an alias for "loongarch64-linux-gnu" because
to implement such an alias, we must create thousands of symlinks in the
distro and doing so would be completely unpractical.  This commit also
aligns GCC with the revision.

Tested by building cross compilers with --enable-multiarch and multiple
combinations of --target=loongarch64-linux-gnu*, --with-abi=lp64{s,f,d},
and --{enable,disable}-multilib; and run "xgcc --print-multiarch" then
manually verify the result with eyesight.

[1]: loongson/LoongArch-Documentation#80

gcc/ChangeLog:

	* config.gcc (triplet_abi): Set its value based on $with_abi,
	instead of $target.
	(la_canonical_triplet): Set it after $triplet_abi is set
	correctly.
	* config/loongarch/t-linux (MULTILIB_OSDIRNAMES): Make the
	multiarch tuple for lp64d "loongarch64-linux-gnu" (without
	"f64" suffix).
kraj pushed a commit to kraj/gcc that referenced this pull request Feb 18, 2023
Multiarch tuple will be coded in file or directory names in
multiarch-aware distros, so one ABI should have only one multiarch
tuple.  For example, "--target=loongarch64-linux-gnu --with-abi=lp64s"
and "--target=loongarch64-linux-gnusf" should both set multiarch tuple
to "loongarch64-linux-gnusf".  Before this commit,
"--target=loongarch64-linux-gnu --with-abi=lp64s --disable-multilib"
will produce wrong result (loongarch64-linux-gnu).

A recent LoongArch psABI revision mandates "loongarch64-linux-gnu" to be
used for -mabi=lp64d (instead of "loongarch64-linux-gnuf64") for some
non-technical reason [1].  Note that we cannot make
"loongarch64-linux-gnuf64" an alias for "loongarch64-linux-gnu" because
to implement such an alias, we must create thousands of symlinks in the
distro and doing so would be completely unpractical.  This commit also
aligns GCC with the revision.

Tested by building cross compilers with --enable-multiarch and multiple
combinations of --target=loongarch64-linux-gnu*, --with-abi=lp64{s,f,d},
and --{enable,disable}-multilib; and run "xgcc --print-multiarch" then
manually verify the result with eyesight.

[1]: loongson/LoongArch-Documentation#80

gcc/ChangeLog:

	* config.gcc (triplet_abi): Set its value based on $with_abi,
	instead of $target.
	(la_canonical_triplet): Set it after $triplet_abi is set
	correctly.
	* config/loongarch/t-linux (MULTILIB_OSDIRNAMES): Make the
	multiarch tuple for lp64d "loongarch64-linux-gnu" (without
	"f64" suffix).

(cherry picked from commit 017849d)
CohenArthur pushed a commit to CohenArthur/gccrs that referenced this pull request Feb 23, 2023
Multiarch tuple will be coded in file or directory names in
multiarch-aware distros, so one ABI should have only one multiarch
tuple.  For example, "--target=loongarch64-linux-gnu --with-abi=lp64s"
and "--target=loongarch64-linux-gnusf" should both set multiarch tuple
to "loongarch64-linux-gnusf".  Before this commit,
"--target=loongarch64-linux-gnu --with-abi=lp64s --disable-multilib"
will produce wrong result (loongarch64-linux-gnu).

A recent LoongArch psABI revision mandates "loongarch64-linux-gnu" to be
used for -mabi=lp64d (instead of "loongarch64-linux-gnuf64") for some
non-technical reason [1].  Note that we cannot make
"loongarch64-linux-gnuf64" an alias for "loongarch64-linux-gnu" because
to implement such an alias, we must create thousands of symlinks in the
distro and doing so would be completely unpractical.  This commit also
aligns GCC with the revision.

Tested by building cross compilers with --enable-multiarch and multiple
combinations of --target=loongarch64-linux-gnu*, --with-abi=lp64{s,f,d},
and --{enable,disable}-multilib; and run "xgcc --print-multiarch" then
manually verify the result with eyesight.

[1]: loongson/LoongArch-Documentation#80

gcc/ChangeLog:

	* config.gcc (triplet_abi): Set its value based on $with_abi,
	instead of $target.
	(la_canonical_triplet): Set it after $triplet_abi is set
	correctly.
	* config/loongarch/t-linux (MULTILIB_OSDIRNAMES): Make the
	multiarch tuple for lp64d "loongarch64-linux-gnu" (without
	"f64" suffix).
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet