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  FAQFAQ  SearchSearch  MemberlistMemberlist  UsergroupsUsergroups  RegisterRegister  Log in  

Post new topic   Reply to topic
 

 Strange think about Clang compiler

Go down 
AuthorMessage
Dann Corbit



Posts : 16
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
View user profile
Dann Corbit



Posts : 16
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
View user profile
TheSelfImprover

TheSelfImprover

Posts : 499
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
View user profile
Dann Corbit



Posts : 16
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
View user profile
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

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