Linux: Cpu Platforms
I realize that currently only Linux on 64 bit is supported. Will Linux on 32 bit x86 and on ARM be supported as well?
I don't think supporting 32-bit is worth effort, as you won't find new 32-bit hardware. I guess ARM should be in roadmap. I think Mono framework already support ARM.
Mono also supports 32-bit linux. Running 32 bit linux on new hardware gives memory savings plus its required if developing for certain Intel IoT boards.
Indeed; none of my current Linux machines run a 64 bit version of Linux, primarily because I utilize numerous applications that would require complex workarounds to run on 64 bit.
Yes, right now we support 64bit only. There is still a lot of work ahead before we can say that it is ready. Once it is functional we can consider other platforms as well. But for now 64bit is our main focus.
32bit support is a must. Even though hardware may be 64bit, I don't see a lot of on host deployments. I think the main use case is virtual machines where light weight deployment is preferred to a full and heavy IIS/ASP.Net Windows server install.
My intended use case is 32bit x86 virtual machines and 32bit ARM SoC devices (IoT). For 'heavy' deployments, I already have Mono. I am thrilled at the 'just the basics' approach of .Net Core.
I should also point out that the 'deal breaker' comes down to remote debugging support with Visual Studio. Without this feature, .Net Core is useless to me regardless of 32/64 bit operation.
We are working on debugging tools too. We have started bringing up CoreCLR on Linux only recently so there is still a lot of rough edges and missing pieces. Please bear with us. :)
@jkotas is this marked as up-for-grabs as you will accept PRs for it? In that case I might try to infer a linux 32bit port from the 64bit port.
Yes. I have just added a note about it to https://github.com/dotnet/coreclr/wiki/Contribution-guidelines
We are most likely going to accept any good changes to bring CoreCLR to new platforms and operating systems.
We prefer to get smaller incremental PR for this kind of work, e.g. make the PAL build, port all .asm files, etc.
Would there be a recommended order of tasks i.e the steps to do a port. Since I have invested in 32 bit Linux (with Physical Address Extension) I would like to try to do the coreclr port to it if i have what it takes.
@jkotas I tried to enable the 32bit build on linux but I am getting many C++ compiler errors. Can anyone guide me on how to proceed? My cmakelists changes are here https://github.com/borgdylan/coreclr/commit/75c5769a8a7496d38644a02a909c3270ad03f148
The initial work to port to a new target is about fixing the compile errors. Check the changes in dotnet/coreclr#117 - majority of them are just dealing with compile errors. It is normal that there is a lot of them when you run build for the first them. Once you start understanding and fixing them, you will discover that there are recurring patterns and so it is not that bad after all.
One of the repeating erros is "error: 'operator new' takes type size_t ('unsigned int') as first parameter void *operator new(size_t size)". The compiler does not say why taking in size_t is bad here.
@borgdylan If you would like to do this work I can certainly help you with that and guide you through the process. If yes, then let’s split the work into smaller work items. I can open a separate ‘up-for-grabs’ issue for each of them. For example, I were to do this work I would stage it in the following way:
- Add support for 32bit build in CMake files for Linux
- Make PAL compile in x86 mode on Linux. This can be split into more detailed work items since PAL consists of different components and maybe someone else can help you to do them in parallel. Personally I would start by first making the files under coreclr\src\pal\src\init compile on 32bit Linux. Once they compile the rest of the PAL files will be much easier to port (you can enable one PAL component/folder at a time in coreclr\src\pal\src\CMakeLists.txt).
- Make PAL tests (coreclr\src\pal\tests) compile for x86 on Linux.
- Fix all failing PAL tests.
- Make CoreCLR Runtime/JIT components compile for x86. For example, this includes the utilcode, gcinfo, vm, jit, etc. Implement x86 version of assembly stubs (we will need to port all *.S files that can be found under coreclr\src\vm\amd64). Again we can create separate ‘up-for-grabs’ issues for each of this components.
- Build x86 version of libcoreclr.so (coreclr\src\dlls\mscoree\coreclr\CMakeLists.txt).
- Build x86 version of corerun for Linux (coreclr\src\coreclr\hosts\unixcorerun\CMakeLists.txt)
- Now the fun part begins: bring up the x86 version of runtime (debug thorough startup issues) and make HelloWorld run. Given the current state of the system, it should not be too hard.
Please let me know what you think. Thank you.
@borgdylan Could you post full description of the error you are seeing so I could see file name and line number where it is coming from? It also would be helpful if you could show output of 'make VERBOSE=1' for that file in order to understand which defines are enabled during compilation.
OK.I would like to try doing the port.
One of the erros is:
In file included from /var/www/git/coreclr/src/vm/classhash.cpp:11:
In file included from /var/www/git/coreclr/src/vm/common.h:301:
In file included from /var/www/git/coreclr/src/vm/ibclogger.h:19:
/var/www/git/coreclr/src/vm/crst.h:434:11: error: 'operator new' takes type
size_t ('unsigned int') as first parameter
void *operator new(size_t size)
^
In my opinion the error is just stating what is in a header file but not why it is wrong.
The defines are:
-DBETA=0 -DBIT32=1 -DBUILDENV_CHECKED=1 -DCONDITION_HANDLING=1 -DDBG_TARGET_I386 -DDBG_TARGET_I386_UNIX -DDBG_TARGET_X86 -DDBG_TARGET_X86_UNIX -DDEBUG -DDEBUGGING_SUPPORTED -DDEV10 -DDEVL=1 -DDISABLE_CONTRACTS -DFEATURE_APPDOMAIN_RESOURCE_MONITORING -DFEATURE_ARRAYSTUB_AS_IL -DFEATURE_ASYNC_IO -DFEATURE_BCL_FORMATTING -DFEATURE_COLLECTIBLE_TYPES -DFEATURE_CORECLR -DFEATURE_CORESYSTEM -DFEATURE_CORRUPTING_EXCEPTIONS -DFEATURE_EXCEPTIONDISPATCHINFO -DFEATURE_FRAMEWORK_INTERNAL -DFEATURE_HOSTED_BINDER -DFEATURE_HOST_ASSEMBLY_RESOLVER -DFEATURE_IMPLICIT_TLS -DFEATURE_ISYM_READER -DFEATURE_LEGACYNETCF -DFEATURE_LEGACYNETCFFAS -DFEATURE_LEGACYNETCF_DBG_HOST_CONTROL -DFEATURE_LOADER_OPTIMIZATION -DFEATURE_MAIN_CLR_MODULE_USES_CORE_NAME -DFEATURE_MANAGED_ETW -DFEATURE_MANAGED_ETW_CHANNELS -DFEATURE_MERGE_CULTURE_SUPPORT_AND_ENGINE -DFEATURE_MULTICOREJIT -DFEATURE_NORM_IDNA_ONLY -DFEATURE_PAL -DFEATURE_PAL_SXS -DFEATURE_PREJIT -DFEATURE_STANDALONE_SN -DFEATURE_STRONGNAME_DELAY_SIGNING_ALLOWED -DFEATURE_STRONGNAME_MIGRATION -DFEATURE_STUBS_AS_IL -DFEATURE_SVR_GC -DFEATURE_SYMDIFF -DFEATURE_SYNTHETIC_CULTURES -DFEATURE_USE_ASM_GC_WRITE_BARRIERS -DFEATURE_VERSIONING -DFEATURE_WIN32_REGISTRY -DFEATURE_WINDOWSPHONE -DFEATURE_WINMD_RESILIENT -DFX_BRANCH_SYNC_COUNTER_VALUE=0 -DI386 -DLINUX32 -DNO_CRT -DNTDDI_VERSION=NTDDI_WIN8 -DNTMAKEENV -DNT_INST=0 -DOFFICIAL_BUILD=0 -DPLATFORM_UNIX=1 -DUNICODE -DUNIX_I386_ABI -DUNIX_X86_ABI -DURTBLDENV_FRIENDLY=Checked -DWIN32 -DWIN32_LEAN_AND_MEAN=1 -DWINNT=1 -DWINVER=0x0602 -DWRITE_BARRIER_CHECK=1 -DX86 -D_BLD_CLR -D_CRT_STDIO_ARBITRARY_WIDE_SPECIFIERS -D_DBG -D_DEBUG -D_I386 -D_I386_ -D_I386_SIMULATOR_ -D_I386_WORKAROUND_ -D_NEW_SDK=1 -D_SECURE_SCL=0 -D_SKIP_IF_SIMULATOR_ -D_TARGET_AMD64_=0 -D_TARGET_I386_=1 -D_TARGET_X86_=1 -D_UNICODE -D_WIN32_IE=0x0900 -D_WIN32_WINNT=0x0602 -D_X86 -D_X86_ -D_X86_SIMULATOR_ -D_X86_SIMULATOR_PERF_ -D_X86_WORKAROUND_ -D__LINUX__=1 -D_i386_SIMULATOR_PERF_
Could some error arise as WIN32 is also being defined?
What should the value of PAL_CS_NATIVE_DATA_SIZE be on 32 bit Linux? And why is it 96 on 64bit Linux instead of 64?