Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Makefile: fix clang compilation #69

Merged
merged 1 commit into from
Jul 29, 2024

Conversation

masscry
Copy link
Contributor

@masscry masscry commented Jul 28, 2024

Hello! I have been testing ublksrv with clang compiler, and lost some time trying to understand how to pass proper flags with autotools. This PR contains small fix for the issue. I have tested changes with g++-10, g++-11, g++-12 and clang++-14 up to clang++-16. Unit tests complete successfully.

I am open to any comments concerning this MR and will fix problems, if any.


clang/clang++ can compile ublksrv sources, but it doesn't support '-fcoroutines' flag, which is mandatory for older versions of g++ to compile sources with c++20 coroutines support.

This commit changes Makefile.am and configure.ac, in such way, one can build ublksrv sources using clang++.

After selecting c++ compiler, configure script will match $CXX with clang++ or g++, flag -fcoroutines will be added to CXXFLAGS only when building with g++. Order of match strings in AS_CASE is important, because *g++* string includes *clang++*, thus we must check with longer string first.

clang/clang++ can compile ublksrv sources, but it doesn't support
'-fcoroutines' flag, which is mandatory for older versions of g++ to
compile sources with c++20 coroutines support.

This commit changes Makefile.am and configure.ac, in such way, one can
build ublksrv sources using clang++.

After selecting c++ compiler, configure script will match $CXX with
clang++ or g++, flag -fcoroutines will be added to CXXFLAGS only when
building with g++. Order of match strings in AS_CASE is important,
because `*g++*` string includes `*clang++*`, thus we must check with
longer string first.
@ming1 ming1 merged commit 1d76a59 into ublk-org:master Jul 29, 2024
1 check passed
@masscry masscry deleted the masscry/fix-clang-build branch July 29, 2024 07:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants