Skip to content

Comments

script/run-make: clang 14->19#61740

Merged
Matan-B merged 12 commits intoceph:mainfrom
Matan-B:wip-matanb-clang-16
Feb 25, 2025
Merged

script/run-make: clang 14->19#61740
Matan-B merged 12 commits intoceph:mainfrom
Matan-B:wip-matanb-clang-16

Conversation

@Matan-B
Copy link
Contributor

@Matan-B Matan-B commented Feb 10, 2025

Currently our jammy ci (jenkins) builders are only able to
(apt) install clang 14 as the latest version available.

Clang stable is already at 19 today (i.e we're 5 major releases behind).
Meaning, full support of C++20 and some bugs [1] requiring us to update
the compiler used for make check.

As updating to Ubuntu 24 is not feasable in the near future and
containerized builds is not yet merged - with this patch, we
would get clang-19 directly form llvm installation script.

Note: discover_compiler() would prefer clang-19 even if
      clang-14 will be installed by apt in INSTALL_EXTRA_PACKAGES
      defined below.

[1] https://github.com/llvm/llvm-project/issues/52696

prerequisites:

Contribution Guidelines

  • To sign and title your commits, please refer to Submitting Patches to Ceph.

  • If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.

  • When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an x between the brackets: [x]. Spaces and capitalization matter when checking off items this way.

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)
Show available Jenkins commands
  • jenkins retest this please
  • jenkins test classic perf
  • jenkins test crimson perf
  • jenkins test signed
  • jenkins test make check
  • jenkins test make check arm64
  • jenkins test submodules
  • jenkins test dashboard
  • jenkins test dashboard cephadm
  • jenkins test api
  • jenkins test docs
  • jenkins render docs
  • jenkins test ceph-volume all
  • jenkins test ceph-volume tox
  • jenkins test windows
  • jenkins test rook e2e

@Matan-B
Copy link
Contributor Author

Matan-B commented Feb 10, 2025

22.04.4 (apt) has only clang 14 support so we fallback to gcc(11) instead when requiring 16.

@athanatos
Copy link
Contributor

We could also switch off of clang for the make check bots if it's easier to get a more recent gcc.

@Matan-B Matan-B changed the title [wip] script/lib-build.sh: use clang 16 and above [wip] script/lib-build,runmake: use clang 16 and above Feb 11, 2025
@cbodley
Copy link
Contributor

cbodley commented Feb 11, 2025

We could also switch off of clang for the make check bots if it's easier to get a more recent gcc.

the gcc-toolset makes this easy for rpm builds, but ubuntu's toolchain ppa for jammy only goes up to gcc-13.1.0-8ubuntu1~22.04. i believe the lto bug from https://tracker.ceph.com/issues/63867 was only fixed for 13.3. as long as we're stuck supporting jammy for the T release, this seems to be the main obstacle

@Matan-B Matan-B force-pushed the wip-matanb-clang-16 branch from ffa750e to ebafea4 Compare February 12, 2025 09:37
@Matan-B Matan-B changed the title [wip] script/lib-build,runmake: use clang 16 and above script/runmake: clang 14->16 Feb 12, 2025
@Matan-B Matan-B marked this pull request as ready for review February 12, 2025 09:38
@Matan-B Matan-B changed the title script/runmake: clang 14->16 script/run-make: clang 14->16 Feb 12, 2025
@Matan-B
Copy link
Contributor Author

Matan-B commented Feb 12, 2025

clang 16 is installed successfully but we seem to hit new deprecation issues:

[368/2723] Performing build step for 'qatzip_ext'
FAILED: qatzip_ext-prefix/src/qatzip_ext-stamp/qatzip_ext-build src/qatzip/install/lib/libqatzip.a /home/jenkins-build/build/workspace/ceph-pull-requests/build/qatzip_ext-prefix/src/qatzip_ext-stamp/qatzip_ext-build /home/jenkins-build/build/workspace/ceph-pull-requests/build/src/qatzip/install/lib/libqatzip.a 
cd /home/jenkins-build/build/workspace/ceph-pull-requests/src/qatzip && /usr/bin/cmake -P /home/jenkins-build/build/workspace/ceph-pull-requests/build/qatzip_ext-prefix/src/qatzip_ext-stamp/qatzip_ext-build-Debug.cmake && /usr/bin/cmake -E touch /home/jenkins-build/build/workspace/ceph-pull-requests/build/qatzip_ext-prefix/src/qatzip_ext-stamp/qatzip_ext-build
CMake Error at /home/jenkins-build/build/workspace/ceph-pull-requests/build/qatzip_ext-prefix/src/qatzip_ext-stamp/qatzip_ext-build-Debug.cmake:37 (message):
  Command failed: 2

   '/usr/bin/cmake' '-E' 'env' '--unset=DESTDIR' 'make' '-j3'

  See also

    /home/jenkins-build/build/workspace/ceph-pull-requests/build/qatzip_ext-prefix/src/qatzip_ext-stamp/qatzip_ext-build.log


-- Log output is:
Making all in src
make[1]: Entering directory '/home/jenkins-build/build/workspace/ceph-pull-requests/src/qatzip/src'
  CC       libqatzip_la-qatzip.lo
  CC       libqatzip_la-qatzip_counter.lo
  CC       libqatzip_la-qatzip_gzip.lo
In file included from qatzip_gzip.c:51:
./qatzip_internal.h:445:25: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
void streamBufferCleanup();
                        ^
                         void
In file included from qatzip_counter.c:51:
./qatzip_internal.h:445:25: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
void streamBufferCleanup();
                        ^
                         void
1 error generated.
1 error generated.
In file included from qatzip.c:67:
./qatzip_internal.h:445:25: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
void streamBufferCleanup();
                        ^
                         void
make[1]: *** [Makefile:528: libqatzip_la-qatzip_counter.lo] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: *** [Makefile:535: libqatzip_la-qatzip_gzip.lo] Error 1
qatzip.c:1680:18: error: variable 'sleep_cnt' set but not used [-Werror,-Wunused-but-set-variable]
    unsigned int sleep_cnt = 0;
                 ^
qatzip.c:2565:18: error: variable 'sleep_cnt' set but not used [-Werror,-Wunused-but-set-variable]
    unsigned int sleep_cnt = 0;
                 ^

irvingi07 will fail make check until this is fixed or #61769 is merged.

Matan-B added a commit to Matan-B/ceph that referenced this pull request Feb 12, 2025
In attempt to update to clang16 some of the code is not yet adapted
due to deprecated functions.
Let's disable clang 16 usage until ceph#61740
is merged.

Signed-off-by: Matan Breizman <[email protected]>
@Matan-B Matan-B mentioned this pull request Feb 12, 2025
14 tasks
@adamemerson
Copy link
Contributor

I'd argue against -Werror in automated builds. We don't want to make them more fragile than they have to be, and changing the targets of submodules or other dependencies is annoying and difficult enough I definitely think we don't want -Werror applying to our submodules and dependencies.

We can go through and clean up warnings now and then, that's not a problem.

@jmundack
Copy link
Contributor

I'd argue against -Werror in automated builds. We don't want to make them more fragile than they have to be, and changing the targets of submodules or other dependencies is annoying and difficult enough I definitely think we don't want -Werror applying to our submodules and dependencies.

We can go through and clean up warnings now and then, that's not a problem.

once someone cleans up these warnings - how do we ensure that we dont have regressions? (that someone else has to then go clean up?)
i fully agree that we shouldn't enable this till we have clean code BUT long term i would think we would want this to be the default?

@Matan-B
Copy link
Contributor Author

Matan-B commented Feb 12, 2025

I'd argue against -Werror in automated builds. We don't want to make them more fragile than they have to be, and changing the targets of submodules or other dependencies is annoying and difficult enough I definitely think we don't want -Werror applying to our submodules and dependencies.

We can go through and clean up warnings now and then, that's not a problem.

I agree we shouldn't -Werror in our submodules builders. I'm looking into cleaning those, the issue right now is that it seems qatzip repo haven't merged the fix (from sep) intel/QATzip#119 yet.
We could probably fix it in our fork. I'll update here, for now we should merge #61769 to let makecheck go back to green again.

@adamemerson
Copy link
Contributor

I'd argue against -Werror in automated builds. We don't want to make them more fragile than they have to be, and changing the targets of submodules or other dependencies is annoying and difficult enough I definitely think we don't want -Werror applying to our submodules and dependencies.
We can go through and clean up warnings now and then, that's not a problem.

once someone cleans up these warnings - how do we ensure that we dont have regressions? (that someone else has to then go clean up?) i fully agree that we shouldn't enable this till we have clean code BUT long term i would think we would want this to be the default?

I think what I would be happier with is something like this:

  • Pick a set of warnings we want to treat as errors. (signed comparison, VLA, etc.)
  • Have those treated as errors in the default build developers use (do_cmake.sh?) so they break the compile on people's machines and they're incentivized to fix it there and then
  • Maybe not for submodules depending on the submodule?
  • If it's a restricted set and we also Werror them on builds, Werroring on that set seems less risky in automated builds

I think that would address my main concern of some interaction or minor upgrade breaking things.

@idryomov
Copy link
Contributor

  • If it's a restricted set and we also Werror them on builds, Werroring on that set seems less risky in automated builds

I think that would address my main concern of some interaction or minor upgrade breaking things.

Generally speaking, a compiler upgrade is always going to uncover something new if -Werror is in effect. Even if it's enabled only for a closed set of warnings that "make sense" -- compilers just get better at diagnosing. -Wunused-but-set-variable and -Wuninitialized/-Wmaybe-uninitialized are some examples of this.

Copy link
Member

@dmick dmick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a few substantive comments, bunch of nits about clean commit titles and messages

# build a static library with -fPIC that we can link into crypto/compressor plugins
list(APPEND configure_cmd --with-pic --enable-static --disable-shared)

set(CFLAGS "-Wno-error=strict-prototypes -Wno-error=unused-but-set-variable")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you have an idea for how we will be able to go remove these workarounds if/when the QATzip library gets fixed? (I know this isn't a new problem, but introducing more things that never get revisited always stings)

Copy link
Contributor Author

@Matan-B Matan-B Feb 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have dozens of -Wno flags set throughout our cmake/modules and many more in other cmake files. Going over each and every warning disabled / how should we treat each disabled warning is out of the scope of this PR IMO.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree it's out of scope for this PR, but saying that doesn't address the problem. Maybe there's no solution.

@rzarzynski
Copy link
Contributor

ACK from core.

Matan-B and others added 10 commits February 20, 2025 14:17
Currently our jammy ci (jenkins) builders are only able to
(apt) install clang 14 as the latest version available.

Clang stable is already at 19 today (i.e we're 5 major releases behind).
Meaning, full support of C++20 and some bugs [1] requiring us to update
the compiler used for make check.

As updating to Ubuntu 24 is not feasable in the near future and
containerized builds is not yet merged - with this patch, we
would get clang-16 directly form llvm installation script.

Note: discover_compiler() would prefer clang-16 even if
      clang-14 will be installed by apt in INSTALL_EXTRA_PACKAGES
      defined below.

[1] llvm/llvm-project#52696

Signed-off-by: Matan Breizman <[email protected]>
qatzip/configure.ac enables -Werror. However, newer compilers
(e.g clang 16) will not compile with the existing warnings
identified. The fixes for the warnings are not merged yet [1]
in the submodule. Until then, in order to allow for compiler
upgrade - we should disable the problematic errors.

[1] intel/QATzip#119

Signed-off-by: Matan Breizman <[email protected]>
clang16 hides std::format behind `-fexperimental-library` [1].
This is no longer the case with clang 17 [2].
As std::fmt is not used in this file we can clean it up for now.

Note: Future commits will aim to switch to clang17.

[1] https://prereleases.llvm.org/16.0.0/rc3/projects/libcxx/docs/UsingLibcxx.html#extensions-to-format
[2] https://releases.llvm.org/17.0.1/projects/libcxx/docs/ReleaseNotes/17.html

Signed-off-by: Matan Breizman <[email protected]>
Signed-off-by: Matan Breizman <[email protected]>
Signed-off-by: Samuel Just <[email protected]>
Supporting new stable compilers releases early on
should make it easier in the future by preventing introduction of
deperacted code.
As this PR already upgrades to 16 with the relevant fixes, we can
use this opportunity to upgrade to the last stable release available.

Note: Most distinct change here is that -Wvla-extension enabled
      by default and will result in lots of warnings.

Signed-off-by: Matan Breizman <[email protected]>
The following warning of:
```
error: variable length arrays in C++ are a Clang extension
[-Werror,-Wvla-cxx-extension]
```
is enabled by default in clang 18 and above.
Disable it in our builds due to large anmount of warnings.
We can revert this once we handle some of the warnings in future PRs.

Signed-off-by: Matan Breizman <[email protected]>
…riable

```
[460/1945] Building C object src/erasure-code/jerasure/CMakeFiles/jerasure_objs.dir/jerasure/src/jerasure.c.o
ceph/src/erasure-code/jerasure/jerasure/src/jerasure.c:722:7: warning: variable 'ddf' set but not used [-Wunused-but-set-variable]
  722 |   int ddf, cdf;
      |       ^
ceph/src/erasure-code/jerasure/jerasure/src/jerasure.c:722:12: warning: variable 'cdf' set but not used [-Wunused-but-set-variable]
  722 |   int ddf, cdf;
      |            ^
ceph/src/erasure-code/jerasure/jerasure/src/jerasure.c:777:7: warning: variable 'ddf' set but not used [-Wunused-but-set-variable]
  777 |   int ddf, cdf;
      |       ^
ceph/src/erasure-code/jerasure/jerasure/src/jerasure.c:777:12: warning: variable 'cdf' set but not used [-Wunused-but-set-variable]
  777 |   int ddf, cdf;
      |            ^
4 warnings generated.
```

Signed-off-by: Matan Breizman <[email protected]>
```
Building C object src/libcephfs_proxy/CMakeFiles/cephfs_proxy.dir/proxy_link.c.o
/home/./ceph/src/libcephfs_proxy/proxy_link.c:198:10: warning: arithmetic on a pointer to void is a GNU extension [-Wgnu-pointer-arith]
  198 |                 buffer += len;
      |                 ~~~~~~ ^
/home/./ceph/src/libcephfs_proxy/proxy_link.c:232:18: warning: arithmetic on a pointer to void is a GNU extension [-Wgnu-pointer-arith]
  232 |                         iov->iov_base += len;
      |                         ~~~~~~~~~~~~~ ^
/home/./ceph/src/libcephfs_proxy/proxy_link.c:268:18: warning: arithmetic on a pointer to void is a GNU extension [-Wgnu-pointer-arith]
  268 |                         iov->iov_base += len;
      |                         ~~~~~~~~~~~~~ ^
/home/./ceph/src/libcephfs_proxy/proxy_link.c:328:17: warning: arithmetic on a pointer to void is a GNU extension [-Wgnu-pointer-arith]
  328 |                 iov->iov_base += sizeof(proxy_link_req_t);
      |                 ~~~~~~~~~~~~~ ^
/home/./ceph/src/libcephfs_proxy/proxy_link.c:391:17: warning: arithmetic on a pointer to void is a GNU extension [-Wgnu-pointer-arith]
  391 |                 iov->iov_base += sizeof(proxy_link_ans_t);
      |                 ~~~~~~~~~~~~~ ^
5 warnings generated.
```

Signed-off-by: Matan Breizman <[email protected]>
@Matan-B Matan-B force-pushed the wip-matanb-clang-16 branch from 33e338c to 084d14d Compare February 20, 2025 14:29
@Matan-B Matan-B requested a review from dmick February 20, 2025 14:38
@Matan-B
Copy link
Contributor Author

Matan-B commented Feb 20, 2025

@dmick all comments addressed. Thanks for reviewing.

@dmick
Copy link
Member

dmick commented Feb 20, 2025

Another thing to remember to do: C++ changes to accommodate the new checks will need backporting to earlier branches, so that make-check doesn't fail there

@Matan-B
Copy link
Contributor Author

Matan-B commented Feb 20, 2025

Another thing to remember to do: C++ changes to accommodate the new checks will need backporting to earlier branches, so that make-check doesn't fail there

This is handled already. See #61869, squid shouldn't try to compile w/ clang later than 14 so there's no need to backport the changes here. Reef and older already are not using later than 14.

@dmick
Copy link
Member

dmick commented Feb 20, 2025

Are you saying that the builders will have multiple versions of clang installed? That'll work

dmick
dmick previously requested changes Feb 20, 2025
@Matan-B
Copy link
Contributor Author

Matan-B commented Feb 20, 2025

Are you saying that the builders will have multiple versions of clang installed? That'll work

Yes, I haven't deleted existing clang 14 from any of the builders. discover_compiler is responsible for using the latest possible release available - which in S / R / Q (releases) cases is 14.

@Svelar
Copy link
Member

Svelar commented Feb 21, 2025

jenkins test make check arm64

```
error: unknown warning option '-Wno-vla-cxx-extension'; did you mean '-Wno-vla-extension'? [-Werror,-Wunknown-warning-option]
```

Signed-off-by: Matan Breizman <[email protected]>
avoid the following error by disabling clang assembler:
```
[670/2691] Performing build step for 'isal_ext'
FAILED: src/erasure-code/isa/isal_ext-prefix/src/isal_ext-stamp/isal_ext-build src/isa-l/install/lib/libisal.a /home/jenkins-build/build/workspace/ceph-pull-requests-arm64/build/src/erasure-code/isa/isal_ext-prefix/src/isal_ext-stamp/isal_ext-build /home/jenkins-build/build/workspace/ceph-pull-requests-arm64/build/src/isa-l/install/lib/libisal.a
cd /home/jenkins-build/build/workspace/ceph-pull-requests-arm64/src/isa-l && /usr/bin/cmake -P /home/jenkins-build/build/workspace/ceph-pull-requests-arm64/build/src/erasure-code/isa/isal_ext-prefix/src/isal_ext-stamp/isal_ext-build-Debug.cmake && /usr/bin/cmake -E touch /home/jenkins-build/build/workspace/ceph-pull-requests-arm64/build/src/erasure-code/isa/isal_ext-prefix/src/isal_ext-stamp/isal_ext-build
CMake Error at /home/jenkins-build/build/workspace/ceph-pull-requests-arm64/build/src/erasure-code/isa/isal_ext-prefix/src/isal_ext-stamp/isal_ext-build-Debug.cmake:37 (message):
  Command failed: 2

   '/usr/bin/cmake' '-E' 'env' '--unset=DESTDIR' 'make' '-j3'

  See also

    /home/jenkins-build/build/workspace/ceph-pull-requests-arm64/build/src/erasure-code/isa/isal_ext-prefix/src/isal_ext-stamp/isal_ext-build.log

-- Log output is:
...skipping to end...
hile in macro instantiation
crc64_refl_func crc64_ecma_refl_pmull
^
<instantiation>:2:26: error: unexpected token in argument list
 movk x7, p1_low_b1, lsl 16
                         ^
<instantiation>:54:2: note: while in macro instantiation
 crc64_fold_512b_to_128b
 ^
crc/aarch64/crc64_ecma_refl_pmull.S:33:1: note: while in macro instantiation
crc64_refl_func crc64_ecma_refl_pmull
^
<instantiation>:3:26: error: unexpected token in argument list
 movk x7, p1_low_b2, lsl 32
                         ^
```

Signed-off-by: Matan Breizman <[email protected]>
@Matan-B Matan-B force-pushed the wip-matanb-clang-16 branch from 084d14d to 0ceefb4 Compare February 24, 2025 16:03
@Matan-B Matan-B requested a review from dmick February 25, 2025 12:40
@Matan-B Matan-B dismissed dmick’s stale review February 25, 2025 12:50

All comments addressed

@Matan-B Matan-B merged commit 89f21db into ceph:main Feb 25, 2025
11 checks passed
harriscr pushed a commit to ceph/ceph-ci that referenced this pull request May 15, 2025
In attempt to update to clang16 some of the code is not yet adapted
due to deprecated functions.
Let's disable clang 16 usage until ceph/ceph#61740
is merged.

Signed-off-by: Matan Breizman <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.