[PATCH seastar v1] cmake: filter out -Wno-error=#warnings from pkgconfig (seastar.pc)

78 views
Skip to first unread message

Avi Kivity

<avi@scylladb.com>
unread,
Mar 21, 2021, 9:01:41 AM3/21/21
to seastar-dev@googlegroups.com
The clang -Wno-error=#warnings flag, used to not break the build when
a #warning directive is encountered, is unfortunate in containing
a comment introducing character ("#"). In our case, pkg-config
interprets it as a comment and truncates the line containing it at
that position.

Unfortunately, we cannot bring to bear cmake's text processing functions
(for example, string (REPLACE ...)) since compile options are not
available during configure time (see [1]). We can process compile options
using generator-expressions (see [2]), but these facilities do not
include a general search-and-replace.

To allow forward process, simply filter out the annoying option.
This is doable using generator-expressions. The pkgconfig output
is now usable, but users will have to detect the availability of
-Wno-error=#warnings and add it themselves and cannot rely on Seastar
to provide it. This only matters on platforms where Seastar issues
such warnings (anything that isn't x86_64, aarch64, s390x).

[1] https://stackoverflow.com/questions/51353110/how-do-i-output-the-result-of-a-generator-expression-in-cmake
[2] https://cmake.org/cmake/help/latest/manual/cmake-generator-expressions.7.html#string-transformations
---
pkgconfig/seastar.pc.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pkgconfig/seastar.pc.in b/pkgconfig/seastar.pc.in
index 1623e101a3..edd938f71c 100644
--- a/pkgconfig/seastar.pc.in
+++ b/pkgconfig/seastar.pc.in
@@ -30,11 +30,11 @@ lksctp_tools_cflags=-I$<JOIN:@lksctp-tools_INCLUDE_DIRS@, -I>
lksctp_tools_libs=$<JOIN:@lksctp-tools_LIBRARIES@, >
numactl_cflags=-I$<JOIN:@numactl_INCLUDE_DIRS@, -I>
numactl_libs=$<JOIN:@numactl_LIBRARIES@, >

# Us.
-seastar_cflags=${seastar_include_flags} $<JOIN:$<TARGET_PROPERTY:seastar,INTERFACE_COMPILE_OPTIONS>, > -D$<JOIN:$<TARGET_PROPERTY:seastar,INTERFACE_COMPILE_DEFINITIONS>, -D>
+seastar_cflags=${seastar_include_flags} $<JOIN:$<FILTER:$<TARGET_PROPERTY:seastar,INTERFACE_COMPILE_OPTIONS>,EXCLUDE,-Wno-error=#warnings>, > -D$<JOIN:$<TARGET_PROPERTY:seastar,INTERFACE_COMPILE_DEFINITIONS>, -D>
seastar_libs=${libdir}/$<TARGET_FILE_NAME:seastar> @Seastar_SPLIT_DWARF_FLAG@ $<JOIN:@Seastar_Sanitizers_OPTIONS@, >

Requires: liblz4 >= 1.7.3
Requires.private: gnutls >= 3.2.26, protobuf >= 2.5.0, hwloc >= 1.11.2, yaml-cpp >= 0.5.1
Conflicts:
--
2.30.2

Commit Bot

<bot@cloudius-systems.com>
unread,
Mar 21, 2021, 9:23:23 AM3/21/21
to seastar-dev@googlegroups.com, Avi Kivity
From: Avi Kivity <a...@scylladb.com>
Committer: Nadav Har'El <n...@scylladb.com>
Branch: master

cmake: filter out -Wno-error=#warnings from pkgconfig (seastar.pc)

The clang -Wno-error=#warnings flag, used to not break the build when
a #warning directive is encountered, is unfortunate in containing
a comment introducing character ("#"). In our case, pkg-config
interprets it as a comment and truncates the line containing it at
that position.

Unfortunately, we cannot bring to bear cmake's text processing functions
(for example, string (REPLACE ...)) since compile options are not
available during configure time (see [1]). We can process compile options
using generator-expressions (see [2]), but these facilities do not
include a general search-and-replace.

To allow forward process, simply filter out the annoying option.
This is doable using generator-expressions. The pkgconfig output
is now usable, but users will have to detect the availability of
-Wno-error=#warnings and add it themselves and cannot rely on Seastar
to provide it. This only matters on platforms where Seastar issues
such warnings (anything that isn't x86_64, aarch64, s390x).

[1] https://stackoverflow.com/questions/51353110/how-do-i-output-the-result-of-a-generator-expression-in-cmake
[2] https://cmake.org/cmake/help/latest/manual/cmake-generator-expressions.7.html#string-transformations
Message-Id: <20210321130131...@scylladb.com>

---
diff --git a/pkgconfig/seastar.pc.in b/pkgconfig/seastar.pc.in
--- a/pkgconfig/seastar.pc.in
+++ b/pkgconfig/seastar.pc.in
@@ -32,7 +32,7 @@ numactl_cflags=-I$<JOIN:@numactl_INCLUDE_DIRS@, -I>

Arun George

<arungeorge05@gmail.com>
unread,
May 28, 2021, 6:26:08 AM5/28/21
to seastar-dev
I had to undo this patch to make the 'master' branch to build. May be I am doing something wrong?
(ubuntu 18.04, x86_64, g++-10)

Avi Kivity

<avi@scylladb.com>
unread,
May 29, 2021, 4:54:51 AM5/29/21
to Arun George, seastar-dev
It's impossible to say anything, since you provided no information.
--
You received this message because you are subscribed to the Google Groups "seastar-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to seastar-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/seastar-dev/6a673e87-7a46-49d9-affe-9aa9c317e624n%40googlegroups.com.


Arun George

<arungeorge05@gmail.com>
unread,
Jun 7, 2021, 3:55:33 AM6/7/21
to seastar-dev
Please find the details. (Sorry for the delayed reply)

command : CXX=g++-10 ./cooking.sh -i c-ares -i fmt -t debug
Environment : Ubuntu-18.04, x86_64

Error message: 

-- Looking for pthread_setname_np - found
-- Found PthreadSetName: 1
-- Performing Test tmp_MaybeUninitialized_FOUND
-- Performing Test tmp_MaybeUninitialized_FOUND - Success
-- Performing Test tmp_ErrorUnused_FOUND
-- Performing Test tmp_ErrorUnused_FOUND - Success
-- Performing Test tmp_ErrorWarnings_FOUND
-- Performing Test tmp_ErrorWarnings_FOUND - Failed
-- Configuring done
CMake Error at CMakeLists.txt:1168 (file):
  Error evaluating generator expression:

    $<FILTER:$<TARGET_PROPERTY:seastar,INTERFACE_COMPILE_OPTIONS>,EXCLUDE,-Wno-error=#warnings>

  Expression did not evaluate to a known generator expression


CMake Error at CMakeLists.txt:1176 (file):
  Error evaluating generator expression:

    $<FILTER:$<TARGET_PROPERTY:seastar,INTERFACE_COMPILE_OPTIONS>,EXCLUDE,-Wno-error=#warnings>

  Expression did not evaluate to a known generator expression


-- Generating done
-- Build files have been written to: /home/magneto/seastar/tmp/seastar/build

--------------------------------------------------------------------------------------------------------------------------------------------
I made this change to go ahead. (in pkgconfig/seastar.pc.in)

-seastar_cflags=${seastar_include_flags} $<JOIN:$<FILTER:$<TARGET_PROPERTY:seastar,INTERFACE_COMPILE_OPTIONS>,EXCLUDE,-Wno-error=#warnings>, > -D$<JOIN:$<TARGET_PROPERTY:seastar,INTERFACE_COMPILE_DEFINITIONS>, -D>
+seastar_cflags=${seastar_include_flags} $<JOIN:$<TARGET_PROPERTY:seastar,INTERFACE_COMPILE_OPTIONS>, > -D$<JOIN:$<TARGET_PROPERTY:seastar,INTERFACE_COMPILE_DEFINITIONS>, -D>

Avi Kivity

<avi@scylladb.com>
unread,
Jun 7, 2021, 4:02:05 AM6/7/21
to Arun George, seastar-dev

Yes, that line caused me a lot of grief, and not it continues.


I expect the cmake version you use has trouble with the # character. What cmake version do you use? And please check (perhaps via docker) that it does work on Ubuntu 20.04 (and provide the cmake version from there), so we establish some boundary on when it does and doesn't work.

Arun George

<arungeorge05@gmail.com>
unread,
Jun 7, 2021, 4:16:41 AM6/7/21
to seastar-dev
Sure. Cmake version is 3.10.2
Reply all
Reply to author
Forward
0 new messages