ProDeo
Would you like to react to this message? Create an account in a few clicks or log in to continue.
ProDeo

Computer Chess
 
HomeHome  CalendarCalendar  Latest imagesLatest images  FAQFAQ  SearchSearch  MemberlistMemberlist  UsergroupsUsergroups  RegisterRegister  Log in  

Post new topic   Reply to topic
 

 Strange think about Clang compiler

Go down 
3 posters
AuthorMessage
Dann Corbit




Posts : 189
Join date : 2020-11-26

Strange think about Clang compiler Empty
PostSubject: Strange think about Clang compiler   Strange think about Clang compiler EmptyFri May 28, 2021 10:57 pm

Why is it that the special Clang linker (lld) does not come with Clang?
It seems bizarre that I have to install and maintain it separately.
Back to top Go down
Dann Corbit




Posts : 189
Join date : 2020-11-26

Strange think about Clang compiler Empty
PostSubject: Re: Strange think about Clang compiler   Strange think about Clang compiler EmptyFri May 28, 2021 11:16 pm

After adding the right linker, I still cannot do a profile build:
lld-link: error: could not open 'C:/msys64/mingw64/lib/clang/12.0.0/lib/windows/libclang_rt.profile-x86_64.a': No such file or directory
clang++: error: linker command failed with exit code 1 (use -v to see invocation)

It seems that if you want to do that, you have to build the compiler yourself from scratch:
https://stackoverflow.com/questions/29392702/missing-libclang-rt-san-x86-64-a-file-for-llvm-compiler-rt

It also fails to build with a non-profile build (config sanity check fails):
dannc@DESKTOP-426Q3JG MINGW64 /c/users/dannc/chess/stockfish-master/src
$ make build arch=x86-64-avx512 COMP=clang
Default net: nn-7756374aaed3.nnue
Already available.

Config:
debug: 'no'
sanitize: 'no'
optimize: 'yes'
arch: 'x86-64-avx512'
bits: '64'
kernel: 'MINGW64_NT-10.0-19041'
os: 'Windows_NT'
prefetch: 'yes'
popcnt: 'yes'
pext: 'no'
sse: 'yes'
mmx: 'no'
sse2: 'yes'
ssse3: 'yes'
sse41: 'yes'
avx2: 'no'
avx512: 'no'
vnni256: 'no'
vnni512: 'no'
neon: 'no'

Flags:
CXX: clang++
CXXFLAGS: -Wall -Wcast-qual -fno-exceptions -std=c++17 -pedantic -Wextra -Wshadow -m64 -DUSE_PTHREADS -DNDEBUG -O3 -mtune=native -fexperimental-new-pass-manager -DIS_64BIT -msse -msse3 -mpopcnt -DUSE_POPCNT -DUSE_SSE41 -msse4.1 -DUSE_SSSE3 -mssse3 -DUSE_SSE2 -msse2 -flto -fuse-ld=lld
LDFLAGS: -latomic -m64 -lpthread -Wall -Wcast-qual -fno-exceptions -std=c++17 -pedantic -Wextra -Wshadow -m64 -DUSE_PTHREADS -DNDEBUG -O3 -mtune=native -fexperimental-new-pass-manager -DIS_64BIT -msse -msse3 -mpopcnt -DUSE_POPCNT -DUSE_SSE41 -msse4.1 -DUSE_SSSE3 -mssse3 -DUSE_SSE2 -msse2 -flto -fuse-ld=lld

Testing config sanity. If this fails, try 'make help' ...

make: *** [Makefile:841: config-sanity] Error 1

From this I conclude that they do not test at all with clang on Windows using msys2
Back to top Go down
TheSelfImprover

TheSelfImprover


Posts : 3095
Join date : 2020-11-18

Strange think about Clang compiler Empty
PostSubject: Re: Strange think about Clang compiler   Strange think about Clang compiler EmptyFri May 28, 2021 11:28 pm

Do you get better compiled code from CLang than from other C compilers?
Back to top Go down
Dann Corbit




Posts : 189
Join date : 2020-11-26

Strange think about Clang compiler Empty
PostSubject: Re: Strange think about Clang compiler   Strange think about Clang compiler EmptyFri May 28, 2021 11:57 pm

TheSelfImprover wrote:
Do you get better compiled code from CLang than from other C compilers?

Back when it used to work, the answer was "sometimes" (depending on what engine I was building and other factors).
The thing I liked most about clang was the compiler diagnostics, which are better than gcc (or at least they were, not sure today).
However, I have not been able to build Stockfish with Clang for two or three years now.
I quit trying for about 6 months, but today I got an update to Clang to version 12:
$ clang --version
clang version 12.0.0
Target: x86_64-w64-windows-gnu
Thread model: posix
InstalledDir: C:/msys64/mingw64/bin

So I thought I would give it another try. My guess is that it works great on Linux and it might work on Windows if we had a workable configuration in the makefile.
But the makefile that comes with SF simply does not work with clang on Windows using msys2 (at least on my system).
Back to top Go down
j.t.




Posts : 1
Join date : 2021-07-09
Age : 25
Location : Berlin

Strange think about Clang compiler Empty
PostSubject: Re: Strange think about Clang compiler   Strange think about Clang compiler EmptyFri Jul 09, 2021 2:11 am

TheSelfImprover wrote:
Do you get better compiled code from CLang than from other C compilers?

I noticed very significant improvements of using Clang over GCC when also compiling with -flto (quick unscientific test, running both versions at the same time: clang + LTO -> 1820 knps, gcc + LTO -> 1560 knps). Though the reason for this big difference could be that I am writing the code in Nim and then the Nim compiler translates this into weird, human-untypical C code.
Back to top Go down
https://gitlab.com/tsoj
TheSelfImprover

TheSelfImprover


Posts : 3095
Join date : 2020-11-18

Strange think about Clang compiler Empty
PostSubject: Re: Strange think about Clang compiler   Strange think about Clang compiler EmptyFri Jul 09, 2021 12:57 pm

j.t. wrote:
...I am writing the code in Nim and then the Nim compiler translates this into weird, human-untypical C code.


Arrggghhhhh - there are too many languages!!!  Shocked

I hadn't heard of Nim: it's good that it transpiles into other languages like C and JavaScript - but I suspect that more and more transpilers are being written for other languages anyway.
Back to top Go down
Sponsored content





Strange think about Clang compiler Empty
PostSubject: Re: Strange think about Clang compiler   Strange think about Clang compiler Empty

Back to top Go down
 
Strange think about Clang compiler
Back to top 
Page 1 of 1
 Similar topics
-
» Rebel 14 GPL project missing file
» something seem strange with results of the queen odd matches
» strange book in the nodes 16:1 challange

Permissions in this forum:You can reply to topics in this forum
ProDeo :: Programmer Corner-
Post new topic   Reply to topicJump to: