All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] Upgrading LLVM and Clang to version 11.0.0... issue with libclc
@ 2021-01-07 16:59 Michael Opdenacker
  2021-01-07 17:41 ` Romain Naour
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Opdenacker @ 2021-01-07 16:59 UTC (permalink / raw)
  To: buildroot

Hi,

I'm trying to bump up the versions of LLVM, Clang and lld to 11.0.0
instead of 9.x currently. The end goal is to test and share a new
iteration of Matthew Weber's patches for compiler-rt support.

Though the upgrades were effortless, this broke support for libclc which
source code has been included in the llvm-project git repository. The
libclc sources are still available as a separate archive (for projects
such as Buildroot that want to build each component separately), but
configure.py script has been replaced by CMake used by LLVM.

Here's what libclc.mk looks like so far:

################################################################################
#
# libclc
#
################################################################################

# LLVM, Clang, lld and libclc should be version bumped together
LIBCLC_VERSION = 11.0.0
LIBCLC_SITE =
https://github.com/llvm/llvm-project/releases/download/llvmorg-$(LIBCLC_VERSION)
LIBCLC_SOURCE = libclc-$(LIBCLC_VERSION).src.tar.xz
LIBCLC_LICENSE = BSD-like or MIT
LIBCLC_LICENSE_FILES = LICENSE.TXT

LIBCLC_DEPENDENCIES = host-clang host-llvm
LIBCLC_INSTALL_STAGING = YES

$(eval $(cmake-package))

Unfortunately, I haven't managed to build libclc yet. Its configuration
step fails as follows (see the full log at the end of this e-mail):

-- Check for working CLC compiler:
/home/mike/buildroot/output/host/bin/clang -- broken
CMake Error at cmake/CMakeTestCLCCompiler.cmake:40 (message):
? The CLC compiler "/home/mike/buildroot/output/host/bin/clang" is not able
? to compile a simple test program.

How would I be supposed to add CLC support to Clang when the Clang and
LLVM source archives that we build don't contain libclc code?

This sounds like a chicken and egg issue. It would be so much easier to
grab the whole llvm-project sources and compile LLVM and Clang with all
the features that we want. But hey, there must be good reasons for
building components separately.

Thanks in advance for any light shed on this topic...

Cheers,

Michael.

-- 
Michael Opdenacker, CEO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Buildroot] Upgrading LLVM and Clang to version 11.0.0... issue with libclc
  2021-01-07 16:59 [Buildroot] Upgrading LLVM and Clang to version 11.0.0... issue with libclc Michael Opdenacker
@ 2021-01-07 17:41 ` Romain Naour
  2021-01-08 10:07   ` Michael Opdenacker
  0 siblings, 1 reply; 4+ messages in thread
From: Romain Naour @ 2021-01-07 17:41 UTC (permalink / raw)
  To: buildroot

Hello Michael, All,

Le 07/01/2021 ? 17:59, Michael Opdenacker a ?crit?:
> Hi,
> 
> I'm trying to bump up the versions of LLVM, Clang and lld to 11.0.0
> instead of 9.x currently. The end goal is to test and share a new
> iteration of Matthew Weber's patches for compiler-rt support.

Thanks for this work!

> 
> Though the upgrades were effortless, this broke support for libclc which
> source code has been included in the llvm-project git repository. The
> libclc sources are still available as a separate archive (for projects
> such as Buildroot that want to build each component separately), but
> configure.py script has been replaced by CMake used by LLVM.
> 
> Here's what libclc.mk looks like so far:
> 
> ################################################################################
> #
> # libclc
> #
> ################################################################################
> 
> # LLVM, Clang, lld and libclc should be version bumped together
> LIBCLC_VERSION = 11.0.0
> LIBCLC_SITE =
> https://github.com/llvm/llvm-project/releases/download/llvmorg-$(LIBCLC_VERSION)
> LIBCLC_SOURCE = libclc-$(LIBCLC_VERSION).src.tar.xz
> LIBCLC_LICENSE = BSD-like or MIT
> LIBCLC_LICENSE_FILES = LICENSE.TXT
> 
> LIBCLC_DEPENDENCIES = host-clang host-llvm
> LIBCLC_INSTALL_STAGING = YES
> 
> $(eval $(cmake-package))
> 
> Unfortunately, I haven't managed to build libclc yet. Its configuration
> step fails as follows (see the full log at the end of this e-mail):
> 
> -- Check for working CLC compiler:
> /home/mike/buildroot/output/host/bin/clang -- broken
> CMake Error at cmake/CMakeTestCLCCompiler.cmake:40 (message):
> ? The CLC compiler "/home/mike/buildroot/output/host/bin/clang" is not able
> ? to compile a simple test program.

I believe CMake try to check clang as cross-compiler before using it.
Can you share the CMake error log file ?

For now, host/bin/clang can't be used as cross-compiler to build application
(the simple test program) because we need to add a wrapper like for gcc.

configure.py was kind enough to accept host/bin/clang as is to build libclc library.

If we can skip the cmake test, the library should build as before.

> 
> How would I be supposed to add CLC support to Clang when the Clang and
> LLVM source archives that we build don't contain libclc code?
> 
> This sounds like a chicken and egg issue. It would be so much easier to
> grab the whole llvm-project sources and compile LLVM and Clang with all
> the features that we want. But hey, there must be good reasons for
> building components separately.

I don't think we have to build libclc before clang, as you can see in the
current packaging only mesa3d depends on libclc. Clang itself doesn't depend on
libclc.

You can find some details about the initial work in this blog:
https://www.linuxembedded.fr/2018/07/llvmclang-integration-into-buildroot/

> 
> Thanks in advance for any light shed on this topic...

Best regards,
Romain

> 
> Cheers,
> 
> Michael.
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Buildroot] Upgrading LLVM and Clang to version 11.0.0... issue with libclc
  2021-01-07 17:41 ` Romain Naour
@ 2021-01-08 10:07   ` Michael Opdenacker
  2021-01-08 11:13     ` Romain Naour
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Opdenacker @ 2021-01-08 10:07 UTC (permalink / raw)
  To: buildroot

Hi Romain,

Many thanks for your help and insights!

On 1/7/21 6:41 PM, Romain Naour wrote:
> I believe CMake try to check clang as cross-compiler before using it.
> Can you share the CMake error log file ?


Here are the contents of the CMakeError.log file:

>>>

Determining if the CLC compiler works failed with the following output:


Determining if the CLC compiler works failed with the following output:


Determining if the CLC compiler works failed with the following output:


Determining if the CLC compiler works failed with the following output:

<<<

CMakeOutput.log is a bit too big to share here

>
> For now, host/bin/clang can't be used as cross-compiler to build application
> (the simple test program) because we need to add a wrapper like for gcc.
>
> configure.py was kind enough to accept host/bin/clang as is to build libclc library.
>
> If we can skip the cmake test, the library should build as before.

Ok, I'll try.

> I don't think we have to build libclc before clang, as you can see in the
> current packaging only mesa3d depends on libclc. Clang itself doesn't depend on
> libclc.
>
> You can find some details about the initial work in this blog:
> https://www.linuxembedded.fr/2018/07/llvmclang-integration-into-buildroot/


Great! This will definitely be useful.

Many thanks,

Michael.

-- 
Michael Opdenacker, CEO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Buildroot] Upgrading LLVM and Clang to version 11.0.0... issue with libclc
  2021-01-08 10:07   ` Michael Opdenacker
@ 2021-01-08 11:13     ` Romain Naour
  0 siblings, 0 replies; 4+ messages in thread
From: Romain Naour @ 2021-01-08 11:13 UTC (permalink / raw)
  To: buildroot

Hi Michael,

Le 08/01/2021 ? 11:07, Michael Opdenacker a ?crit?:
> Hi Romain,
> 
> Many thanks for your help and insights!

You're welcome

> 
> On 1/7/21 6:41 PM, Romain Naour wrote:
>> I believe CMake try to check clang as cross-compiler before using it.
>> Can you share the CMake error log file ?
> 
> 
> Here are the contents of the CMakeError.log file:
> 
>>>>
> 
> Determining if the CLC compiler works failed with the following output:
> 
> 
> Determining if the CLC compiler works failed with the following output:
> 
> 
> Determining if the CLC compiler works failed with the following output:
> 
> 
> Determining if the CLC compiler works failed with the following output:
> 
> <<<
> 
> CMakeOutput.log is a bit too big to share here

The log is not very useful, sorry.

Can you share your working branch ?
I can still test mesa3d with Clover on a r600 GPU.

> 
>>
>> For now, host/bin/clang can't be used as cross-compiler to build application
>> (the simple test program) because we need to add a wrapper like for gcc.
>>
>> configure.py was kind enough to accept host/bin/clang as is to build libclc library.
>>
>> If we can skip the cmake test, the library should build as before.
> 
> Ok, I'll try.
> 
>> I don't think we have to build libclc before clang, as you can see in the
>> current packaging only mesa3d depends on libclc. Clang itself doesn't depend on
>> libclc.
>>
>> You can find some details about the initial work in this blog:
>> https://www.linuxembedded.fr/2018/07/llvmclang-integration-into-buildroot/
> 
> 
> Great! This will definitely be useful.
> 
> Many thanks,

Good luck!

Best regards,
Romain

> 
> Michael.
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-01-08 11:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-07 16:59 [Buildroot] Upgrading LLVM and Clang to version 11.0.0... issue with libclc Michael Opdenacker
2021-01-07 17:41 ` Romain Naour
2021-01-08 10:07   ` Michael Opdenacker
2021-01-08 11:13     ` Romain Naour

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.