Skip to content
This repository has been archived by the owner on Nov 1, 2020. It is now read-only.

corert for RHEL/Centos #2778

Open
cocotr opened this issue Feb 19, 2017 · 8 comments
Open

corert for RHEL/Centos #2778

cocotr opened this issue Feb 19, 2017 · 8 comments

Comments

@cocotr
Copy link

cocotr commented Feb 19, 2017

Hello,
Is it possible to build native executables for RHEL/Centos? or only Ubuntu is supported?

@jkotas
Copy link
Member

jkotas commented Feb 20, 2017

We have not gotton to building CoreRT for RHEL or Centos yet; however it should be pretty straightforward to fix things up to make it work. @cocotr Would you like to give it a try?

The one obstacle where you would need our help is nuget package publishing. @ellismg Do we have "build from source" for .NET Core documented already? I am wondering whether we can have corert branch of it that would allow folks to build corert for platform that we do not have yet, without relying on nuget packages.

@cocotr
Copy link
Author

cocotr commented Feb 20, 2017

Definitely I would like to give it a try.
btw. Do you think will it be possible to compile to native on Windows to make it work on RHEL/Centos (the same as for standard .net core app) ? or compilation needs to be done on RHEL/ Centos?

@janvorli
Copy link
Member

@cocotr I just quickly tried to build CoreRT on CentOS 7. I've found that besides the need to fix the managed building, there is one problem in the native code build. The fix is to replace #include <inttypes.h> in src/Native/libunwind/src/DwarfParser.hpp by #include <cinttypes>.

@jkotas
Copy link
Member

jkotas commented Feb 20, 2017

or compilation needs to be done on RHEL/ Centos?

I would do it on RHEL/Centos natively first. Cross-compilation from Windows to Unix is harder orthogonal problem.

@cocotr
Copy link
Author

cocotr commented Feb 20, 2017

what are prerequisites for building CoreRT on Centos 7 ? Similar as for Ubuntu ? Do you have any documentation?

@am11
Copy link
Member

am11 commented Feb 20, 2017

In my CentOS 7 box, I tried the following:

# add some deps

yum install git libunwind libunwind-devel cmake
yum groupinstall "Development Tools"

# then fetch the clang3.9.1
# source: https://copr.fedorainfracloud.org/coprs/alonid/llvm-3.9.1/

yum install yum-utils
yum-config-manager --add-repo https://copr.fedorainfracloud.org/coprs/alonid/llvm-3.9.1/repo/epel-7/alonid-llvm-3.9.1-epel-7.repo

yum install llvm-3.9.1 clang-3.9.1 --enablerepo=alonid-llvm-3.9.1

# clone repo and build
git clone https://github.com/dotnet/corert corert && cd $_
PATH=$PATH:/opt/llvm-3.9.1/bin ./build.sh

After 100% of progress, I got these errors:

[ 96%] Building ASM object Runtime/Full/CMakeFiles/Runtime.dir/__/amd64/CallingConventionConverterHelpers.S.o
[ 97%] [ 98%] Building ASM object Runtime/Full/CMakeFiles/Runtime.dir/__/amd64/ExceptionHandling.S.o
Building ASM object Runtime/Full/CMakeFiles/Runtime.dir/__/amd64/Interlocked.S.o
[ 98%] Building ASM object Runtime/Full/CMakeFiles/Runtime.dir/__/amd64/PInvoke.S.o
[ 99%] [100%] Building ASM object Runtime/Full/CMakeFiles/Runtime.dir/__/amd64/StubDispatch.S.o
Building ASM object Runtime/Full/CMakeFiles/Runtime.dir/__/amd64/UniversalTransition.S.o
[100%] Building ASM object Runtime/Full/CMakeFiles/Runtime.dir/__/amd64/WriteBarriers.S.o
In file included from /root/corert/src/Native/libunwind/src/libunwind.cpp:27:
In file included from /root/corert/src/Native/libunwind/src/UnwindCursor.hpp:30:
In file included from /root/corert/src/Native/libunwind/src/AddressSpace.hpp:75:
In file included from /root/corert/src/Native/libunwind/src/EHHeaderParser.hpp:19:
/root/corert/src/Native/libunwind/src/DwarfParser.hpp:372:59: error: expected ')'
    fprintf(stderr, "parseInstructions(instructions=0x%0" PRIx64 ")\n",
                                                          ^
/root/corert/src/Native/libunwind/src/DwarfParser.hpp:372:12: note: to match this '('
    fprintf(stderr, "parseInstructions(instructions=0x%0" PRIx64 ")\n",
           ^
/root/corert/src/Native/libunwind/src/DwarfParser.hpp:402:61: error: expected ')'
        fprintf(stderr, "DW_CFA_advance_loc1: new offset=%" PRIu64 "\n",
                                                            ^
/root/corert/src/Native/libunwind/src/DwarfParser.hpp:402:16: note: to match this '('
        fprintf(stderr, "DW_CFA_advance_loc1: new offset=%" PRIu64 "\n",
               ^

[snip]

fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make[2]: *** [Runtime/Full/CMakeFiles/Runtime.dir/__/__/libunwind/src/libunwind.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [Runtime/Full/CMakeFiles/Runtime.dir/all] Error 2
make: *** [all] Error 2
Failed to build corert native components.

Then I applied this patch:

--- a/src/Native/libunwind/src/DwarfParser.hpp
+++ b/src/Native/libunwind/src/DwarfParser.hpp
@@ -12,6 +12,7 @@

 #ifndef __DWARF_PARSER_HPP__
 #define __DWARF_PARSER_HPP__
+#define __STDC_FORMAT_MACROS

 #include <inttypes.h>
 #include <stdint.h>
 #include <stdio.h>

to get it fixed.

Now onto the managed / CLI story..

am11 added a commit to am11/corert that referenced this issue Feb 20, 2017
This fixes the native build error on CentOS 7 dotnet#2778 (comment).

Though the managed build subsequently fails with:

```sh
CoreRT native components successfully built.
~/corert
Installing dotnet cli...
Restoring BuildTools version 1.0.26-prerelease-00821-01...
Failed to initialize CoreCLR, HRESULT: 0x80131500
ERROR: Could not restore build tools correctly. See '/root/corert/init-tools.log' for more details.1
Initializing BuildTools...
/root/corert/buildscripts/../init-tools.sh: line 121: /root/corert/packages/Microsoft.DotNet.BuildTools/1.0.26-prerelease-00821-01/lib/init-tools.sh: No such file or directory
ERROR: An error occured when trying to initialize the tools. Please check '/root/corert/init-tools.log' for more details.1
Using CLI tools version:
1.0.0-preview3-003223
```
@cocotr
Copy link
Author

cocotr commented Mar 17, 2017

Hi,
Did anybody make a progress with building CoreRT on Centos/RHEL ?

@am11
Copy link
Member

am11 commented Jul 15, 2017

Similar to #2856 (comment), current master (bad4b3e) builds on CentOS with the following Dockerfile (without tests):

FROM centos:7
# it should pick the latest in 7 (atm 7.3.1611)
RUN cat /etc/*-release

RUN yum -y -q  install epel-release
RUN yum-config-manager --add-repo https://copr.fedorainfracloud.org/coprs/alonid/llvm-3.9.1/repo/epel-7/alonid-llvm-3.9.1-epel-7.repo
RUN yum -y -q update
RUN yum -y -q install \
      git cmake icu libicu-devel  binutils make \
      lttng-ust liblttng-ust-devel libuuid-devel libunwind libunwind-devel \
      llvm-3.9.1 clang-3.9.1 lldb-3.9.1 --enablerepo=alonid-llvm-3.9.1

ENV PATH /opt/llvm-3.9.1/bin:$PATH

RUN git clone https://github.com/dotnet/corert -b master --single-branch corert \
    && cd $_ \
    && ./build.sh skiptests

With tests, ilc gives the same errors on CentOS as on openSUSE (see the linked issue).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants