Re: The LLVM host/target TRIPLE padding drama on Debian

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: The LLVM host/target TRIPLE padding drama on Debian

Dimitry Andric via cfe-dev
[Remove lve-dev which I think does not exist.  Add cfe-dev.]

On 2021-04-06, Nick Desaulniers wrote:

>On Tue, Apr 6, 2021 at 1:57 AM Sylvestre Ledru <[hidden email]> wrote:
>>
>> Hello
>>
>> Could you please report a bug https://bugs.llvm.org/ with a shorter version of this email ?
>> (with less jokes ;)
>
>Heh, I got a laugh. Let me highlight below precisely what should be in
>the bugreport.
>
>>
>> Thanks
>> Sylvestre
>>
>> Le 06/04/2021 à 10:50, Sedat Dilek a écrit :
>> > [ CC some ClangBuiltLinux and Debian GNU/LLVM toolchain folks ]
>> >
>> > Hi,
>> >
>> > this is not a late April-1st-joke.
>> > "This is a REAL DRAMA written by (my) LIFE."
>> > ( See the end of this Email. )
>> >
>> > [ INTRO ]
>> >
>> > /me uses LLVM/Clang and tools - Debian folks call this "LLVM
>> > toolchain" - for building latest upstream Linux-kernels.
>> >
>
>include from here ---->
>
>> > On Debian x86-64 I see this dpkg-architecture warning in my
>> > Linux-kernel build-logs:
>> >
>> > specified GNU system type x86_64-linux-gnu does not match CC system
>> > type x86_64-unknown-linux-gnu, try setting a correct CC environment
>> > variable
>
><----- to here
>
>Also, how do you check the logs? This is during a kernel build?  If so
>then it sounds like something wrong with that build script.
>
>> >
>> > [ CHECK ]
>> >
>> > Check "GNU system type" on my Debian system:
>> >
>> > $ dpkg-architecture --query DEB_HOST_GNU_TYPE
>> > x86_64-linux-gnu
>> >
>> > What says clang (here: Selfmade LLVM version 12.0.0-rc4 - Debian's
>> > clang show the same "Target:"):
>> >
>> > $ /opt/llvm-toolchain/bin/clang --version
>> > dileks clang version 12.0.0 (https://github.com/llvm/llvm-project.git
>> > 04ba60cfe598e41084fb848daae47e0ed910fa7d)
>> > Target: x86_64-unknown-linux-gnu
>> > Thread model: posix
>> > InstalledDir: /opt/llvm-toolchain/bin
>> >
>> > [ ABOUT KNIFES AND TRIPLE(S) ]
>> >
>> > You remember the famous quote from Crocodile Dundee cinema movie?
>> > "*This* is a KNIFE!"
>> >
>> >      This is a TRIPLE: x86_64-linux-gnu
>> > This is NOT a TRIPLE: x86_64-unknown-linux-gnu
>
>Heh, yes, "triples" (3) actually have 4 segments.
>https://clang.llvm.org/docs/CrossCompilation.html#target-triple
>
>I would think they're equivalent if the "vendor" is left out, so to me
>it's a bug in whatever is printing that message.
>
>> >
>> > Personally, I do not see a benefit in having an "unknown" but I am not
>> > familiar with other operating systems and (its) architectures.
>> > Maybe, there is a real need for this extra "padding" (3 -> 4).
>> >
>> > [ "SOURCE (OF) TRUST" ]
>> >
>> > I do not follow LLVM development that much.
>> > But I know to check the source-code.
>> >
>> > NOTE: Here: Latest <llvm-project.git#release/12.x>
>> >
>> > [ clang/test/Driver/program-path-priority.c ]
>> >
>> > /// We cannot trust clang --version, or cmake's LLVM_DEFAULT_TARGET_TRIPLE
>> > /// to give us the one and only default triple.
>> > /// Can't trust cmake because on Darwin, triples have a verison
>> > appended to them.
>> > /// (and clang uses the versioned string to search)
>> > /// Can't trust --version because it will pad 3 item triples to 4 e.g.
>> > /// powerpc64le-linux-gnu -> powerpc64le-unknown-linux-gnu
>> > /// (and clang uses the former to search)
>> > /// So we write to both names which is a bit odd but still proves that the
>> > /// lookup is working.

I created https://reviews.llvm.org/D99996 to drop $DEFAULR_TRIPLE-gcc
from appearing in an unrelated target triple cross compilation.

>> > LIFE is about TRUST :-).
>> > No TRUST - No nothing!
>> >
>> > [ INSPIRED-BY ]
>> >
>> > Initially, I was inspired by this change in "tc-build" - the Swiss
>> > army knife (YES, this is a KNIFE) from/for ClangBuiltLinux folks.
>> >
>> > commit 227a77175f81fc9b2e76b2d11b91b686ce41b35b
>> > "build-llvm.py: Define LLVM_HOST_TRIPLE for certain distributions"
>> >
>> > Link: https://github.com/ClangBuiltLinux/tc-build/commit/227a77175f81fc9b2e76b2d11b91b686ce41b35b
>> >
>> > As a man-child I played with...
>> >
>> > DEB_HOST_GNU_TYPE="x86_64-linux-gnu"
>> > LLVM_HOST_TRIPLE_OPTS="-D LLVM_HOST_TRIPLE=$DEB_HOST_GNU_TYPE"
>> >
>> > ...in my custom LLVM toolchain build-script.
>> >
>> > Unfortunately, this results in a ***mixture of target TRIPLEs***.
>> >
>> > This is from my comment when playing with LLVM v13-git (see below link).
>> >
>> > Link: https://github.com/ClangBuiltLinux/tc-build/pull/141#issuecomment-791179738
>> >
>> > LLC and llvm-dwarfdump say "x86_64-linux-gnu":
>> >
>> > $ /opt/llvm-toolchain/bin/llc --version
>> > LLVM (http://llvm.org/):
>> >    LLVM version 13.0.0git
>> >    Optimized build.
>> >    Default target: x86_64-linux-gnu
>> >    Host CPU: sandybridge
>> >
>> >    Registered Targets:
>> >      bpf    - BPF (host endian)
>> >      bpfeb  - BPF (big endian)
>> >      bpfel  - BPF (little endian)
>> >      x86    - 32-bit X86: Pentium-Pro and above
>> >      x86-64 - 64-bit X86: EM64T and AMD64
>> >
>> > $ /opt/llvm-toolchain/bin/llvm-dwarfdump --version
>> > LLVM (http://llvm.org/):
>> >    LLVM version 13.0.0git
>> >    Optimized build.
>> >    Default target: x86_64-linux-gnu
>> >    Host CPU: sandybridge

sys::getDefaultTargetTriple()

>> > Whereas clang says "x86_64-unknown-linux-gnu":
>> >
>> > $ /opt/llvm-toolchain/bin/clang --version
>> > dileks clang version 13.0.0 (https://github.com/llvm/llvm-project.git
>> > 9c0274cdeae904089806be6faee72b9126d2cf5b)
>> > Target: x86_64-unknown-linux-gnu
>> > Thread model: posix
>> > InstalledDir: /opt/llvm-toolchain/bin

The vendor part "unknown" may be added by
computeTargetTriple in clang/lib/Driver/Driver.cpp

If you specify --target, "Target: " will be overridden.

% clang --version --target=aarch64-linux-gnu
clang version 13.0.0
Target: aarch64-linux-gnu
Thread model: posix
InstalledDir: /tmp/RelA/bin

I think this is a matter of finding the right place and removing the extra
normalization...

>> > As said I am an end-user of LLVM not an LLVM developer and I do not
>> > follow LLVM upstream development.
>> > If there was progress on this topic, please let me know.
>> >
>> > Final quote from Mark Twain (translated from German):
>> > "In my LIFE I had several DRAMA(S) - some of them REALLY happened."
>> >
>> > For me this is NOT a drama.
>> > But I do not know about the consequences of having a mixture of target
>> > TRIPLEs in my Debian system.
>> > Thus, I dropped above LLVM_HOST_TRIPLE_OPTS from my build-script.
>> >
>> > Please, let me know if you need further information.
>> >
>> > Thanks.
>> >
>> > Regards,
>> > - Sedat "A real drama queen" -
>> >
>>
>
>
>--
>Thanks,
>~Nick Desaulniers
_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: The LLVM host/target TRIPLE padding drama on Debian

Dimitry Andric via cfe-dev
On Wed, Apr 7, 2021 at 1:02 AM Fangrui Song <[hidden email]> wrote:
>
> [Remove lve-dev which I think does not exist.  Add cfe-dev.]
>

I sent a subscribe to <[hidden email]> with no answer.

The offline archive shows activity.

https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
https://lists.llvm.org/pipermail/llvm-dev/2021-April/date.html

> On 2021-04-06, Nick Desaulniers wrote:
> >On Tue, Apr 6, 2021 at 1:57 AM Sylvestre Ledru <[hidden email]> wrote:
> >>
> >> Hello
> >>
> >> Could you please report a bug https://bugs.llvm.org/ with a shorter version of this email ?
> >> (with less jokes ;)
> >
> >Heh, I got a laugh. Let me highlight below precisely what should be in
> >the bugreport.
> >
> >>
> >> Thanks
> >> Sylvestre
> >>
> >> Le 06/04/2021 à 10:50, Sedat Dilek a écrit :
> >> > [ CC some ClangBuiltLinux and Debian GNU/LLVM toolchain folks ]
> >> >
> >> > Hi,
> >> >
> >> > this is not a late April-1st-joke.
> >> > "This is a REAL DRAMA written by (my) LIFE."
> >> > ( See the end of this Email. )
> >> >
> >> > [ INTRO ]
> >> >
> >> > /me uses LLVM/Clang and tools - Debian folks call this "LLVM
> >> > toolchain" - for building latest upstream Linux-kernels.
> >> >
> >
> >include from here ---->
> >
> >> > On Debian x86-64 I see this dpkg-architecture warning in my
> >> > Linux-kernel build-logs:
> >> >
> >> > specified GNU system type x86_64-linux-gnu does not match CC system
> >> > type x86_64-unknown-linux-gnu, try setting a correct CC environment
> >> > variable
> >
> ><----- to here
> >
> >Also, how do you check the logs? This is during a kernel build?  If so
> >then it sounds like something wrong with that build script.
> >
> >> >
> >> > [ CHECK ]
> >> >
> >> > Check "GNU system type" on my Debian system:
> >> >
> >> > $ dpkg-architecture --query DEB_HOST_GNU_TYPE
> >> > x86_64-linux-gnu
> >> >
> >> > What says clang (here: Selfmade LLVM version 12.0.0-rc4 - Debian's
> >> > clang show the same "Target:"):
> >> >
> >> > $ /opt/llvm-toolchain/bin/clang --version
> >> > dileks clang version 12.0.0 (https://github.com/llvm/llvm-project.git
> >> > 04ba60cfe598e41084fb848daae47e0ed910fa7d)
> >> > Target: x86_64-unknown-linux-gnu
> >> > Thread model: posix
> >> > InstalledDir: /opt/llvm-toolchain/bin
> >> >
> >> > [ ABOUT KNIFES AND TRIPLE(S) ]
> >> >
> >> > You remember the famous quote from Crocodile Dundee cinema movie?
> >> > "*This* is a KNIFE!"
> >> >
> >> >      This is a TRIPLE: x86_64-linux-gnu
> >> > This is NOT a TRIPLE: x86_64-unknown-linux-gnu
> >
> >Heh, yes, "triples" (3) actually have 4 segments.
> >https://clang.llvm.org/docs/CrossCompilation.html#target-triple
> >
> >I would think they're equivalent if the "vendor" is left out, so to me
> >it's a bug in whatever is printing that message.
> >
> >> >
> >> > Personally, I do not see a benefit in having an "unknown" but I am not
> >> > familiar with other operating systems and (its) architectures.
> >> > Maybe, there is a real need for this extra "padding" (3 -> 4).
> >> >
> >> > [ "SOURCE (OF) TRUST" ]
> >> >
> >> > I do not follow LLVM development that much.
> >> > But I know to check the source-code.
> >> >
> >> > NOTE: Here: Latest <llvm-project.git#release/12.x>
> >> >
> >> > [ clang/test/Driver/program-path-priority.c ]
> >> >
> >> > /// We cannot trust clang --version, or cmake's LLVM_DEFAULT_TARGET_TRIPLE
> >> > /// to give us the one and only default triple.
> >> > /// Can't trust cmake because on Darwin, triples have a verison
> >> > appended to them.
> >> > /// (and clang uses the versioned string to search)
> >> > /// Can't trust --version because it will pad 3 item triples to 4 e.g.
> >> > /// powerpc64le-linux-gnu -> powerpc64le-unknown-linux-gnu
> >> > /// (and clang uses the former to search)
> >> > /// So we write to both names which is a bit odd but still proves that the
> >> > /// lookup is working.
>
> I created https://reviews.llvm.org/D99996 to drop $DEFAULR_TRIPLE-gcc
> from appearing in an unrelated target triple cross compilation.
>
> >> > LIFE is about TRUST :-).
> >> > No TRUST - No nothing!
> >> >
> >> > [ INSPIRED-BY ]
> >> >
> >> > Initially, I was inspired by this change in "tc-build" - the Swiss
> >> > army knife (YES, this is a KNIFE) from/for ClangBuiltLinux folks.
> >> >
> >> > commit 227a77175f81fc9b2e76b2d11b91b686ce41b35b
> >> > "build-llvm.py: Define LLVM_HOST_TRIPLE for certain distributions"
> >> >
> >> > Link: https://github.com/ClangBuiltLinux/tc-build/commit/227a77175f81fc9b2e76b2d11b91b686ce41b35b
> >> >
> >> > As a man-child I played with...
> >> >
> >> > DEB_HOST_GNU_TYPE="x86_64-linux-gnu"
> >> > LLVM_HOST_TRIPLE_OPTS="-D LLVM_HOST_TRIPLE=$DEB_HOST_GNU_TYPE"
> >> >
> >> > ...in my custom LLVM toolchain build-script.
> >> >
> >> > Unfortunately, this results in a ***mixture of target TRIPLEs***.
> >> >
> >> > This is from my comment when playing with LLVM v13-git (see below link).
> >> >
> >> > Link: https://github.com/ClangBuiltLinux/tc-build/pull/141#issuecomment-791179738
> >> >
> >> > LLC and llvm-dwarfdump say "x86_64-linux-gnu":
> >> >
> >> > $ /opt/llvm-toolchain/bin/llc --version
> >> > LLVM (http://llvm.org/):
> >> >    LLVM version 13.0.0git
> >> >    Optimized build.
> >> >    Default target: x86_64-linux-gnu
> >> >    Host CPU: sandybridge
> >> >
> >> >    Registered Targets:
> >> >      bpf    - BPF (host endian)
> >> >      bpfeb  - BPF (big endian)
> >> >      bpfel  - BPF (little endian)
> >> >      x86    - 32-bit X86: Pentium-Pro and above
> >> >      x86-64 - 64-bit X86: EM64T and AMD64
> >> >
> >> > $ /opt/llvm-toolchain/bin/llvm-dwarfdump --version
> >> > LLVM (http://llvm.org/):
> >> >    LLVM version 13.0.0git
> >> >    Optimized build.
> >> >    Default target: x86_64-linux-gnu
> >> >    Host CPU: sandybridge
>
> sys::getDefaultTargetTriple()
>
> >> > Whereas clang says "x86_64-unknown-linux-gnu":
> >> >
> >> > $ /opt/llvm-toolchain/bin/clang --version
> >> > dileks clang version 13.0.0 (https://github.com/llvm/llvm-project.git
> >> > 9c0274cdeae904089806be6faee72b9126d2cf5b)
> >> > Target: x86_64-unknown-linux-gnu
> >> > Thread model: posix
> >> > InstalledDir: /opt/llvm-toolchain/bin
>
> The vendor part "unknown" may be added by
> computeTargetTriple in clang/lib/Driver/Driver.cpp
>
> If you specify --target, "Target: " will be overridden.
>
> % clang --version --target=aarch64-linux-gnu
> clang version 13.0.0
> Target: aarch64-linux-gnu
> Thread model: posix
> InstalledDir: /tmp/RelA/bin
>
> I think this is a matter of finding the right place and removing the extra
> normalization...
>

Interesting, so pass `clang --target=x86_64-linux-gnu` as an alias in
my kernel build-script?

I had no deep look into the LLVM sources in things of "normalization".

- Sedat -

> >> > As said I am an end-user of LLVM not an LLVM developer and I do not
> >> > follow LLVM upstream development.
> >> > If there was progress on this topic, please let me know.
> >> >
> >> > Final quote from Mark Twain (translated from German):
> >> > "In my LIFE I had several DRAMA(S) - some of them REALLY happened."
> >> >
> >> > For me this is NOT a drama.
> >> > But I do not know about the consequences of having a mixture of target
> >> > TRIPLEs in my Debian system.
> >> > Thus, I dropped above LLVM_HOST_TRIPLE_OPTS from my build-script.
> >> >
> >> > Please, let me know if you need further information.
> >> >
> >> > Thanks.
> >> >
> >> > Regards,
> >> > - Sedat "A real drama queen" -
> >> >
> >>
> >
> >
> >--
> >Thanks,
> >~Nick Desaulniers
_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev