Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix for Cygwin's environment build-profile
The Cygwin environment has two g++ compilers, each with a different problem for compiling Stockfish at the moment: (a) g++.exe : full posix build compiler, linked to cygwin dll. => This one has a problem embedding the net. (b) x86_64-w64-mingw32-g++.exe : native Windows build compiler. => This one manages to embed the net, but has a problem related to libgcov when we use the profile-build target of Stockfish. This patch solves the problem for compiler (b), so that our recommended command line if you want to build an optimized version of Stockfish on Cygwin becomes something like the following (you can change the ARCH value to whatever you want, but note the COMP and CXX variables pointing at the right compiler): ``` make -j profile-build ARCH=x86-64-modern COMP=mingw CXX=x86_64-w64-mingw32-c++.exe ``` closes #3463 No functional change
- Loading branch information
68bf362
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@snicolet There is some issue with make clean now
68bf362
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you are on which OS (windows, linux) and what toolchain (mingw...)?
68bf362
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MinGW gcc version 9.2.0 Windows 10
68bf362
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@SFisGOD
can you try to comment each line in lines 799-804 of Makefile in turn, and tell us which one (if any) is giving the error?
68bf362
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried but error is still there.
68bf362
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Creates a folder with same path with stockfish src files so it's something like this
And this is where all the gcda files go. Previously, all gcda files are created in
The problem is that make clean can't get rid of this C~ folder
68bf362
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same error with
gcc version 10.3.0 (Rev2, Built by MSYS2 project)
.Sorry to have missed the
make clean
test :(68bf362
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I'll revert the patch
68bf362
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm reinstalling cygwin to help testing another possible fix.
68bf362
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, Pasquale!
68bf362
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same problem in msys2 with:
EXTRACXXFLAGS='-fprofile-generate="."' \
mingw32-make.exe
instead thatmake.exe
(the former is Windows native but can have some compatibility problems)68bf362
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like we will not escape writing platform-specific code in the Makefile.. Any way to test in the Makefile that we are compiling on CygWin?
68bf362
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cygwin installed, I'll be home in 2 hours. Feel free to suggest fixes to be tested.
68bf362
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens if you set the profile directory with
-fprofile-dir
instead?If that doesn't work either we could try specifying a separate subdirectory for the profile data, but that's a larger change.
68bf362
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would be nice to test, probably, yes.
I note that Andreï suggests another solution (or maybe the same, unclear) in one comment of the PR:
68bf362
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-fprofile-dir="."
creates the "C~" folder on msys2.68bf362
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ppigazzini Does it make any difference if you omit the double quotes?
-fprofile-dir=.
Edit: if that doesn't work we can use the intel compiler profile directory:
-fprofile-dir=profdir
(make profileclean removes this directory already, so no more changes are needed).68bf362
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gvreuls unfortunately no.
68bf362
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ppigazzini Could you try one last time with
-fprofile-dir=profdir
please?I suspect this one is going to work but it puts the profiling data in an different directory than master so it's up to the maintainers if this is acceptable. The same directory is used by ICC though, so it isn't an outlandish change.
68bf362
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gvreuls @snicolet
-fprofile-dir=profdir
works fine w/ msys2 and cygwin, no problem w/ a second build w/omake clean
, no problem w/make clean
.EDIT_000: works fine also on WSL2.
EDIT_001: the "profdir" folder is automatically deleted when the Makefile stops. On msys2 the "profdir" folder contains the "C~" tree of folders, msys2 correctly deals w/ any space in folder names.
68bf362
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-fprofile-dir=profdir
works fine here and indeed the profdir directory gets deleted during step 4 (profileclean)68bf362
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
works also on linux, I would be fine with a PR along those lines.
68bf362
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I'll wait a few hours for @proukornew to respond, if he doesn't I'll make a PR.
68bf362
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not true. Try to refresh msys2. I have 0 problems with msys2 and dot.
@ALL But, as i said on issue page, we can use any combination of profile-generate=path or profile-dir=path. I've tested at cygwin and msys2 "." path. The folder for gcda files is good idea
68bf362
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@proukornew The dot solution might work for your system but it doesn't work on other people's machines. Can you confirm that the
-fprofile-dir=profdir
solution works for you? If it does you can make a new Pull Request with that solution and everybody's happy.68bf362
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gvreuls little later
68bf362
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@proukornew feel free to ask me other tests :)
[EDIT_001]: ops , sorry, you asked for
-fprofile-dir="."
, here is the result:68bf362
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For reference, @proukornew has created a new PR #3569 to correct the error.