xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [Xen-devel] How to compile Xen 4.12 with Clang on Linux?
@ 2019-06-20 22:37 Johnson, Ethan
  2019-06-20 23:01 ` Andrew Cooper
  0 siblings, 1 reply; 4+ messages in thread
From: Johnson, Ethan @ 2019-06-20 22:37 UTC (permalink / raw)
  To: xen-devel

Hi all,

I'm trying to compile Xen 4.12 with Clang (v7.0.0) for a research 
project. I see in the README distributed with the Xen 4.12 source code 
that Clang/LLVM 3.5 and newer are supported as the compiler for building 
Xen. However, when I actually try it, it doesn't work - the configure 
script seems to recognize that I've indicated clang as the preferred 
compiler, but the actual "make" step seems to ignore it and issue gcc 
commands anyway.

I tried a few different command line invocations, all with the same 
result (note: my clang is installed from the Ubuntu 18.04 repositories 
as "clang-7" and "clang++-7" respectively):

[Attempt #1:]
CC=clang-7 CXX=clang++-7 ./configure --enable-systemd
make -j24 world

[Attempt #2:]
./configure --enable-systemd CC=clang-7 CXX=clang++-7
make -j24 world

[Attempt #3:]
export CC=clang-7
export CXX=clang++-7
make -j24 world

I'm guessing I'm missing a key step here, but I'm not seeing anything in 
the documentation (README, wiki, etc.) to indicate what that might be. 
Anyone have any suggestions?

Note (in case it matters) that I'm doing this on x86-64 Linux (Linux 
Mint 19.1 to be exact, which is based on Ubuntu 18.04). When I searched 
online and on the Xen mailing lists for references to building with 
clang they mostly seemed to be in the context of BSD or ARM platforms.

Much thanks,
Ethan Johnson

-- 
Ethan J. Johnson
Computer Science PhD student, Systems group, University of Rochester
ejohns48@cs.rochester.edu
ethanjohnson@acm.org
PGP public key available from public directory or on request

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [Xen-devel] How to compile Xen 4.12 with Clang on Linux?
  2019-06-20 22:37 [Xen-devel] How to compile Xen 4.12 with Clang on Linux? Johnson, Ethan
@ 2019-06-20 23:01 ` Andrew Cooper
  2019-06-25  1:09   ` Johnson, Ethan
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Cooper @ 2019-06-20 23:01 UTC (permalink / raw)
  To: Johnson, Ethan, xen-devel

On 20/06/2019 23:37, Johnson, Ethan wrote:
> Hi all,
>
> I'm trying to compile Xen 4.12 with Clang (v7.0.0) for a research 
> project. I see in the README distributed with the Xen 4.12 source code 
> that Clang/LLVM 3.5 and newer are supported as the compiler for building 
> Xen. However, when I actually try it, it doesn't work - the configure 
> script seems to recognize that I've indicated clang as the preferred 
> compiler, but the actual "make" step seems to ignore it and issue gcc 
> commands anyway.
>
> I tried a few different command line invocations, all with the same 
> result (note: my clang is installed from the Ubuntu 18.04 repositories 
> as "clang-7" and "clang++-7" respectively):
>
> [Attempt #1:]
> CC=clang-7 CXX=clang++-7 ./configure --enable-systemd
> make -j24 world
>
> [Attempt #2:]
> ./configure --enable-systemd CC=clang-7 CXX=clang++-7
> make -j24 world
>
> [Attempt #3:]
> export CC=clang-7
> export CXX=clang++-7
> make -j24 world

Xen itself doesn't use autoconf, and needs a bit of extra help getting
its options in order.  There is an extra clang=y variable which you need
to pass.

xen.git$ make -C xen/ CC=clang-7 clang=y

~Andrew

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [Xen-devel] How to compile Xen 4.12 with Clang on Linux?
  2019-06-20 23:01 ` Andrew Cooper
@ 2019-06-25  1:09   ` Johnson, Ethan
  2019-06-25  7:50     ` Roger Pau Monné
  0 siblings, 1 reply; 4+ messages in thread
From: Johnson, Ethan @ 2019-06-25  1:09 UTC (permalink / raw)
  To: Andrew Cooper, xen-devel

On 6/20/19 7:01 PM, Andrew Cooper wrote:
> Xen itself doesn't use autoconf, and needs a bit of extra help getting
> its options in order.  There is an extra clang=y variable which you need
> to pass.
>
> xen.git$ make -C xen/ CC=clang-7 clang=y

Thanks! That seems to have worked.

Now I've got a new issue: it looks like Xen is trying to use an 
optimization flag that Clang doesn't like:

----------
[ 16%] Building C object crypto/CMakeFiles/tpm_crypto.dir/hmac.o
cd 
/home/ejohns48/Desktop/xen-4.12.0/stubdom/tpm_emulator-x86_64/build/crypto 
&& /usr/bin/clang-7  -I/opt/local/include 
-I/home/ejohns48/Desktop/xen-4.12.0/stubdom/tpm_emulator-x86_64 
-I/home/ejohns48/Desktop/xen-4.12.0/stubdom/tpm_emulator-x86_64/build 
-std=c99 -DTPM_NO_EXTERN -isystem 
/home/ejohns48/Desktop/xen-4.12.0/stubdom/../extras/mini-os/include 
-D__MINIOS__ -DHAVE_LIBC -isystem 
/home/ejohns48/Desktop/xen-4.12.0/stubdom/../extras/mini-os/include/posix 
-isystem 
/home/ejohns48/Desktop/xen-4.12.0/stubdom/../tools/xenstore/include 
-isystem 
/home/ejohns48/Desktop/xen-4.12.0/stubdom/../extras/mini-os/include/x86 
-isystem 
/home/ejohns48/Desktop/xen-4.12.0/stubdom/../extras/mini-os/include/x86/x86_64 
-U __linux__ -U __FreeBSD__ -U __sun__ -nostdinc -isystem 
/home/ejohns48/Desktop/xen-4.12.0/stubdom/../extras/mini-os/include/posix 
-isystem 
/home/ejohns48/Desktop/xen-4.12.0/stubdom/cross-root-x86_64/x86_64-xen-elf/include 
-isystem /usr/lib/gcc/x86_64-linux-gnu/7/include -isystem 
/home/ejohns48/Desktop/xen-4.12.0/stubdom/lwip-x86_64/src/include 
-isystem 
/home/ejohns48/Desktop/xen-4.12.0/stubdom/lwip-x86_64/src/include/ipv4 
-I/home/ejohns48/Desktop/xen-4.12.0/stubdom/include 
-I/home/ejohns48/Desktop/xen-4.12.0/stubdom/../xen/include -mno-red-zone 
-O1 -fno-omit-frame-pointer -O1 -fno-omit-frame-pointer  -m64 
-mno-red-zone -fno-reorder-blocks -fno-asynchronous-unwind-tables -m64 
-DBUILD_ID -fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes 
-Wdeclaration-after-statement -Wno-unused-local-typedefs   
-fno-stack-protector -fno-exceptions -Wno-declaration-after-statement   
-Wall -Werror -Wextra -Wno-unused-parameter -Wpointer-arith -Wcast-align 
-Wwrite-strings -o CMakeFiles/tpm_crypto.dir/hmac.o   -c 
/home/ejohns48/Desktop/xen-4.12.0/stubdom/tpm_emulator-x86_64/crypto/hmac.c
clang: error: optimization flag '-fno-reorder-blocks' is not supported 
[-Werror,-Wignored-optimization-argument]
----------

I'm seeing this same error on other translation units as well when I run 
"make" with multiple threads (-j24).

Is this another thing I can fix with a flag or do I need to dig deeper?

Thanks,
Ethan

-- 
Ethan J. Johnson
Computer Science PhD student, Systems group, University of Rochester
ejohns48@cs.rochester.edu
ethanjohnson@acm.org
PGP public key available from public directory or on request

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [Xen-devel] How to compile Xen 4.12 with Clang on Linux?
  2019-06-25  1:09   ` Johnson, Ethan
@ 2019-06-25  7:50     ` Roger Pau Monné
  0 siblings, 0 replies; 4+ messages in thread
From: Roger Pau Monné @ 2019-06-25  7:50 UTC (permalink / raw)
  To: Johnson, Ethan; +Cc: Andrew Cooper, xen-devel

On Tue, Jun 25, 2019 at 01:09:22AM +0000, Johnson, Ethan wrote:
> On 6/20/19 7:01 PM, Andrew Cooper wrote:
> > Xen itself doesn't use autoconf, and needs a bit of extra help getting
> > its options in order.  There is an extra clang=y variable which you need
> > to pass.
> >
> > xen.git$ make -C xen/ CC=clang-7 clang=y
> 
> Thanks! That seems to have worked.
> 
> Now I've got a new issue: it looks like Xen is trying to use an 
> optimization flag that Clang doesn't like:
> 
> ----------
> [ 16%] Building C object crypto/CMakeFiles/tpm_crypto.dir/hmac.o
> cd 
> /home/ejohns48/Desktop/xen-4.12.0/stubdom/tpm_emulator-x86_64/build/crypto 
> && /usr/bin/clang-7  -I/opt/local/include 
> -I/home/ejohns48/Desktop/xen-4.12.0/stubdom/tpm_emulator-x86_64 
> -I/home/ejohns48/Desktop/xen-4.12.0/stubdom/tpm_emulator-x86_64/build 
> -std=c99 -DTPM_NO_EXTERN -isystem 
> /home/ejohns48/Desktop/xen-4.12.0/stubdom/../extras/mini-os/include 
> -D__MINIOS__ -DHAVE_LIBC -isystem 
> /home/ejohns48/Desktop/xen-4.12.0/stubdom/../extras/mini-os/include/posix 
> -isystem 
> /home/ejohns48/Desktop/xen-4.12.0/stubdom/../tools/xenstore/include 
> -isystem 
> /home/ejohns48/Desktop/xen-4.12.0/stubdom/../extras/mini-os/include/x86 
> -isystem 
> /home/ejohns48/Desktop/xen-4.12.0/stubdom/../extras/mini-os/include/x86/x86_64 
> -U __linux__ -U __FreeBSD__ -U __sun__ -nostdinc -isystem 
> /home/ejohns48/Desktop/xen-4.12.0/stubdom/../extras/mini-os/include/posix 
> -isystem 
> /home/ejohns48/Desktop/xen-4.12.0/stubdom/cross-root-x86_64/x86_64-xen-elf/include 
> -isystem /usr/lib/gcc/x86_64-linux-gnu/7/include -isystem 
> /home/ejohns48/Desktop/xen-4.12.0/stubdom/lwip-x86_64/src/include 
> -isystem 
> /home/ejohns48/Desktop/xen-4.12.0/stubdom/lwip-x86_64/src/include/ipv4 
> -I/home/ejohns48/Desktop/xen-4.12.0/stubdom/include 
> -I/home/ejohns48/Desktop/xen-4.12.0/stubdom/../xen/include -mno-red-zone 
> -O1 -fno-omit-frame-pointer -O1 -fno-omit-frame-pointer  -m64 
> -mno-red-zone -fno-reorder-blocks -fno-asynchronous-unwind-tables -m64 
> -DBUILD_ID -fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes 
> -Wdeclaration-after-statement -Wno-unused-local-typedefs   
> -fno-stack-protector -fno-exceptions -Wno-declaration-after-statement   
> -Wall -Werror -Wextra -Wno-unused-parameter -Wpointer-arith -Wcast-align 
> -Wwrite-strings -o CMakeFiles/tpm_crypto.dir/hmac.o   -c 
> /home/ejohns48/Desktop/xen-4.12.0/stubdom/tpm_emulator-x86_64/crypto/hmac.c
> clang: error: optimization flag '-fno-reorder-blocks' is not supported 
> [-Werror,-Wignored-optimization-argument]
> ----------
> 
> I'm seeing this same error on other translation units as well when I run 
> "make" with multiple threads (-j24).
> 
> Is this another thing I can fix with a flag or do I need to dig deeper?

I'm not sure clang/llvm is capable of building stubdomains. The
current gitlab CI loop that tests clang/llvm has the following
snippet:

# newlib cannot be built with clang so we cannot build stubdoms
cfgargs+=("--disable-stubdom")

Which disables the stubdomain build with clang. If you need
stubdomains working with clang/llvm I'm afraid you will have to do
some digging, or else you can just disable them from configure.

Roger.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

end of thread, other threads:[~2019-06-25  7:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-20 22:37 [Xen-devel] How to compile Xen 4.12 with Clang on Linux? Johnson, Ethan
2019-06-20 23:01 ` Andrew Cooper
2019-06-25  1:09   ` Johnson, Ethan
2019-06-25  7:50     ` Roger Pau Monné

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).