Hi Pedro,
Your suggestion is interesting. We will try to enhance the clang Linux build 
and remove the libgcc dependency in the future.

This patch change is for a project of Google Summer of Code 2021, which is to 
build BaseTools with clang + gnu make in windows. We hope to focus the windows 
part only in this project. The project’s code check-in deadline is August 24th. 
 We plan to only check-in to edk2-staging right now because of 
edk2-stable202108 release code freezing. Yuqi will send out another version 
code review soon.



Thanks

Steven Shi
Intel\SATG\SFP\FIA (Firmware Infrastructure Automation)


From: Pedro Falcato <pedro.falc...@gmail.com>
Sent: Saturday, August 14, 2021 3:50 AM
To: edk2-devel-groups-io <devel@edk2.groups.io>; Shi, Steven 
<steven....@intel.com>
Cc: gaolim...@byosoft.com.cn; yuqi.c...@mail.utoronto.ca
Subject: Re: [edk2-devel] [2021-gsoc-llvm-gnumake]: proposal for building using 
llvm/gnumake

Hi Steven,

Have you considered using the --rtlib switch? It would eliminate the dependency 
on the system's libgcc, crtbegin/end.o and crti/o.o, for most systems. I don't 
know exactly how the build system works but I assume there's some way to force 
a compiler flag.

Best regards,

Pedro

On Fri, 13 Aug 2021 at 14:34, Steven Shi 
<steven....@intel.com<mailto:steven....@intel.com>> wrote:
Liming,
The MSVC is required only because the Windows SDK Universal C runtime (UCRT) 
library depends on the MSVC.  Please see the dependency description here: “When 
you install Visual C++, Visual Studio setup installs the subset of the Windows 
10 SDK required to use the UCRT.” 
https://docs.microsoft.com/en-us/cpp/c-runtime-library/crt-library-features?view=msvc-160.

If the MSVC is not installed, the ucrt will complain cannot find the msvc 
header files. Below is an example:
C:\Program Files\LLVM\bin\clang  -c  -I .. -I ../Include/Common -I ../Include/ 
-I ../Include/IndustryStandard -I ../Common/ -I .. -I . -I ../Include/X64/ -I 
"" -MD -fshort-wchar -fno-strict-aliasing -fwrapv 
-fno-delete-null-pointer-checks -Wall -Werror -Wno-deprecated-declarations 
-Wno-self-assign -Wno-unused-result -nostdlib -Wno-unused-function -g -m32 -O2  
BasePeCoff.c -o BasePeCoff.o
In file included from BasePeCoff.c:13:
In file included from ../Common\CommonLib.h:14:
In file included from C:\Program Files (x86)\Windows 
Kits\10\Include\10.0.10240.0\ucrt\assert.h:12:
C:\Program Files (x86)\Windows 
Kits\10\Include\10.0.10240.0\ucrt\corecrt.h:10:10: fatal error: 'vcruntime.h' 
file not
      found
#include <vcruntime.h>
         ^~~~~~~~~~~~~
1 error generated.



BTW, the compiler dependency requirement also exists in Linux side. Below is 
the Linux GCC CRT library example. Although I build with clang, it still needs 
link the crt libraries in GCC installation. Below is an example:
$ /home/jshi19/llvm/clang+llvm-11.0.0-x86_64-linux-gnu-ubuntu-20.04/bin/clang 
-o ../bin/LzmaCompress   LzmaCompress.o Sdk/C/Alloc.o Sdk/C/LzFind.o 
Sdk/C/LzmaDec.o Sdk/C/LzmaEnc.o Sdk/C/7zFile.o Sdk/C/7zStream.o Sdk/C/Bra86.o 
-L../libs -lCommon -###
clang version 11.0.0 (https://github.com/llvm/llvm-project.git 
0160ad802e899c2922bc9b29564080c22eb0908c)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: 
/home/jshi19/llvm/clang+llvm-11.0.0-x86_64-linux-gnu-ubuntu-20.04/bin
"/usr/bin/ld" "-z" "relro" "--hash-style=gnu" "--eh-frame-hdr" "-m" 
"elf_x86_64" "-dynamic-linker" "/lib64/ld-linux-x86-64.so.2" "-o" 
"../bin/LzmaCompress" 
"/usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu/crt1.o" 
"/usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu/crti.o" 
"/usr/lib/gcc/x86_64-linux-gnu/10/crtbegin.o" "-L../libs" 
"-L/usr/lib/gcc/x86_64-linux-gnu/10" 
"-L/usr/lib/gcc/x86_64-linux-gnu/10/../../../../x86_64-linux-gnu/lib/../lib64" 
"-L/usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu" 
"-L/lib/x86_64-linux-gnu" "-L/lib/../lib64" "-L/usr/lib/x86_64-linux-gnu" 
"-L/usr/lib/gcc/x86_64-linux-gnu/10/../../../../x86_64-linux-gnu/lib" 
"-L/usr/lib/gcc/x86_64-linux-gnu/10/../../.." 
"-L/home/jshi19/llvm/clang+llvm-11.0.0-x86_64-linux-gnu-ubuntu-20.04/bin/../lib"
 "-L/lib" "-L/usr/lib" "LzmaCompress.o" "Sdk/C/Alloc.o" "Sdk/C/LzFind.o" 
"Sdk/C/LzmaDec.o" "Sdk/C/LzmaEnc.o" "Sdk/C/7zFile.o" "Sdk/C/7zStream.o" 
"Sdk/C/Bra86.o" "-lCommon" "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed" 
"-lc" "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed" 
"/usr/lib/gcc/x86_64-linux-gnu/10/crtend.o" 
"/usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu/crtn.o"




Thanks

Steven Shi
Intel\SATG\SFP\FIA (Firmware Infrastructure Automation)


From: devel@edk2.groups.io<mailto:devel@edk2.groups.io> 
<devel@edk2.groups.io<mailto:devel@edk2.groups.io>> On Behalf Of gaoliming
Sent: Friday, August 13, 2021 9:18 AM
To: devel@edk2.groups.io<mailto:devel@edk2.groups.io>; 
yuqi.c...@mail.utoronto.ca<mailto:yuqi.c...@mail.utoronto.ca>
Subject: 回复: [edk2-devel] [2021-gsoc-llvm-gnumake]: proposal for building using 
llvm/gnumake

Yuqi:
 On Windows, can Clang + make combination drop the dependency of Visual studio? 
If I don’t install Visual studio 2015 or 2017, I only install LLVM, can I fully 
compile BaseTools and Edk2 code?

Thanks
Liming
发件人: devel@edk2.groups.io<mailto:devel@edk2.groups.io> 
<devel@edk2.groups.io<mailto:devel@edk2.groups.io>> 代表 Yuqi Chen
发送时间: 2021年8月12日 9:52
收件人: devel@edk2.groups.io<mailto:devel@edk2.groups.io>
主题: [edk2-devel] [2021-gsoc-llvm-gnumake]: proposal for building using 
llvm/gnumake

Hi,

I want to push my change to my codes to edk2-staging, yet it seems like I don’t 
have permission to do so:
[cid:image001.png@01D793B1.43CD2010]

My mentor and I have enabled edk2 building using llvm+make and gnumake+clang in 
windows command prompt. The attached patch indicates changes we made to make 
this happen.

I also attach the readme file to go through the steps to build Basetools.

Please review our codes and thank you very much for your time.

Best regards,
Yuqi




--
Pedro Falcato


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#79432): https://edk2.groups.io/g/devel/message/79432
Mute This Topic: https://groups.io/mt/84863402/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to