easybuild-easyconfigs icon indicating copy to clipboard operation
easybuild-easyconfigs copied to clipboard

RPATH wrapper with Intel compiler `-c` and `-Werror` flags leads to compilation errors

Open g2knizn opened this issue 10 months ago • 2 comments

Hi!

Compiling something with the -c and -Werror or -Werror=unused-command-line-argument and linker options leads to compilation error:

icx -c -Werror=unused-command-line-argument main.c -Wl,-rpath=/my/lib
icx: error: -Wl,-rpath=/my/lib: 'linker' input unused [-Werror,-Wunused-command-line-argument]

This can cause non-obvious errors with EasyBuild. For example in meson build in #20262 where numpy >= 1.26 with Intel toolchain is used. Meson shows that some instructions are not supported:

Test features "SSE SSE2 SSE3" : Parial support, missing(SSE SSE2 SSE3)
Test features "SSE" : Unsupported due to Implied feature "SSE2" is not supported
Test features "SSE2" : Unsupported due to Arguments "-msse, -msse2" are not supported
Test features "SSE3" : Unsupported due to Implied feature "SSE" is not supported
Test features "SSSE3" : Unsupported due to Implied feature "SSE" is not supported
Test features "SSE41" : Unsupported due to Implied feature "SSE" is not supported
Test features "POPCNT" : Unsupported due to Implied feature "SSE" is not supported
Test features "SSE42" : Unsupported due to Implied feature "SSE" is not supported
Test features "AVX" : Unsupported due to Implied feature "SSE" is not supported
Test features "F16C" : Unsupported due to Implied feature "SSE" is not supported
Test features "FMA3" : Unsupported due to Implied feature "SSE" is not supported
Test features "AVX2" : Unsupported due to Implied feature "SSE" is not supported
Test features "AVX512F" : Unsupported due to Implied feature "SSE" is not supported
Test features "AVX512CD" : Unsupported due to Implied feature "SSE" is not supported
Test features "AVX512_KNL" : Unsupported due to Implied feature "SSE" is not supported
Test features "AVX512_KNM" : Unsupported due to Implied feature "SSE" is not supported
Test features "AVX512_SKX" : Unsupported due to Implied feature "SSE" is not supported
Test features "AVX512_CLX" : Unsupported due to Implied feature "SSE" is not supported
Test features "AVX512_CNL" : Unsupported due to Implied feature "SSE" is not supported
Test features "AVX512_ICL" : Unsupported due to Implied feature "SSE" is not supported

or complex numbers:

Checking for type "complex float" : NO
Checking for type "complex double" : NO
Checking for type "complex long double" : NO

But that's not true. Just some meson checks that use compiler are failing because of -Werror=unused-command-line-argument that is added by default by meson:

Working directory:  <WORK_DIR>
Code:
 #include <complex.h> 
 int main() { double complex z = -1.0 + 2.0*I;return 0; }
-----------
Command line: `icx -I/work/imas/opt/EasyBuild/software/imkl/2023.2.0/mkl/2023.2.0/include <WORK_DIR>/testfile.c -o /<WORK_DIR>/output.obj -c -O1 -fp-speculation=strict -fp-model strict -fPIC -D_FILE_OFFSET_BITS=64 -O0 -Werror=implicit-function-declaration -Werror=unknown-warning-option -Werror=unused-command-line-argument -Werror=ignored-optimization-argument -std=c99` -> 1
stderr:
icx: error: -Wl,-rpath=/DIR/eb-build/software/SciPy-bundle/2023.12-iimkl-2023b/lib: 'linker' input unused [-Werror,-Wunused-command-line-argument]
icx: error: -Wl,-rpath=/DIR/eb-build/software/SciPy-bundle/2023.12-iimkl-2023b/lib64: 'linker' input unused [-Werror,-Wunused-command-line-argument]
icx: error: -Wl,-rpath=$ORIGIN: 'linker' input unused [-Werror,-Wunused-command-line-argument]
icx: error: -Wl,-rpath=$ORIGIN/../lib: 'linker' input unused [-Werror,-Wunused-command-line-argument]
icx: error: -Wl,-rpath=$ORIGIN/../lib64: 'linker' input unused [-Werror,-Wunused-command-line-argument]
icx: error: -Wl,--disable-new-dtags: 'linker' input unused [-Werror,-Wunused-command-line-argument]
icx: error: -Wl,-rpath=/work/imas/opt/EasyBuild/software/imkl/2023.2.0/mkl/2023.2.0/lib/intel64: 'linker' input unused [-Werror,-Wunused-command-line-argument]
icx: error: -Wl,-rpath=/work/imas/opt/EasyBuild/software/imkl/2023.2.0/compiler/2023.2.0/linux/compiler/lib/intel64_lin: 'linker' input unused [-Werror,-Wunused-command-line-argument]
icx: error: -Wl,-rpath=/work/imas/opt/EasyBuild/software/intel-compilers/2023.2.1/tbb/2021.10.0/lib/intel64/gcc4.8: 'linker' input unused [-Werror,-Wunused-command-line-argument]
icx: error: -Wl,-rpath=/work/imas/opt/EasyBuild/software/intel-compilers/2023.2.1/compiler/2023.2.1/linux/compiler/lib/intel64_lin: 'linker' input unused [-Werror,-Wunused-command-line-argument]
icx: error: -Wl,-rpath=/work/imas/opt/EasyBuild/software/intel-compilers/2023.2.1/compiler/2023.2.1/linux/lib/x64: 'linker' input unused [-Werror,-Wunused-command-line-argument

But my question is not SciPy, NumPy or even meson specific. Just sometimes some software can add flags like -Werror and then the problem occurs. Can we wrap or inject -Wno-unused-command-line-argument in EasyBuild in an elegant way? Or do you have any other ideas on how to handle it?

g2knizn avatar Jun 04 '25 14:06 g2knizn

Just as an idea, maybe we can inject this as part of our Intel compiler toolchain file? https://github.com/easybuilders/easybuild-framework/blob/develop/easybuild/toolchains/compiler/intel_compilers.py

Thyre avatar Jun 16 '25 08:06 Thyre

Sounds OK from a user perspective (mine). But we need to make sure that:

  1. this injected -Wno-unused-command-line-argument has a very high precedence
  2. there are no consequences of disabling the possibility of treating unused command line arguments as errors in other EasyBuild software. Example - for some reasons meson uses -Werror=unused-command-line-argument.

g2knizn avatar Jun 23 '25 06:06 g2knizn

Bad checks by configure systems is an age old issue; autotools based stuff also likes to determine if you have a working compiler or not by secretly trying to build stuff, and won't show the actual error messages, and instead just tells you the incorrect conclusion that the compiler is broken, forcing one to dig through config.log or something to find the useful information that they should have provided from the start.

But, if we are talking general, one can't expect different compilers to support each others command line flags. Each softwares configure step needs to account for what compiler is used and what specific flags to give it. With icx, things probably got a lot closer, but I don't think there is a silver bullet here.

Now this particular case, the -Werror=unused-command-line-argument is a perfectly reasonable thing to warn for I.M.H.O. Having a bunch of extra dead compiler flags is bad practice as they can be very misleading. We are giving rpath linker flags, but we are linking yet, so they make no sense here. The -c shouldn't have any linker flags My conclusion here is that we are wrong to add these:

 -Wl,-rpath=/DIR/eb-build/software/SciPy-bundle/2023.12-iimkl-2023b/lib

flags in our wrapper when -c is passed. Our rpath wrapper script should check for this, and skip all the -Wl flags.

I really don't think we should go wrap the compiler again and try to hide valid warnings.

Micket avatar Jul 16 '25 02:07 Micket

I've been looking at building GStreamer for Intel compilers, and this issue also throws a wrench in the build process. Due to our rpath wrappers, and Meson setting -Werror=unused-command-line-argument, checks for time and pthread fail, causing several compilation failures later on.

Trying to mitigate this in the EasyConfig fails every time, as the flags are added last to the Meson test. With that, we see something like this during compilation:

In file included from ../gstreamer-1.26.5/gst/printf/asnprintf.c:23:
In file included from ../gstreamer-1.26.5/gst/printf/gst-printf.h:22:
In file included from /usr/include/stdlib.h:514:
In file included from /usr/include/sys/types.h:128:
/usr/include/bits/types/clockid_t.h:7:21: error: cannot combine with previous 'type-name' declaration specifier
    7 | typedef __clockid_t clockid_t;
      |                     ^
./config.h:184:19: note: expanded from macro 'clockid_t'
  184 | #define clockid_t int
      |                   ^

and, if we work around this error:

../gstreamer-1.26.5/gst/gstsystemclock.c:449:2: error: Cannot use pthread condition variables on your platform.
  449 | #error Cannot use pthread condition variables on your platform.
      |  ^
../gstreamer-1.26.5/gst/gstsystemclock.c:485:2: error: Cannot use pthread condition variables on your platform.
  485 | #error Cannot use pthread condition variables on your platform.
      |  ^
../gstreamer-1.26.5/gst/gstsystemclock.c:1069:19: warning: unused variable 'sysclock' [-Wunused-variable]
 1069 |   GstSystemClock *sysclock = GST_SYSTEM_CLOCK_CAST (clock);
      |                   ^~~~~~~~
1 warning and 2 errors generated.

This all happens due to Meson using -Werror and our rpath wrapper setting flags when it doesn't need to e.g.:

1012 Command line: `icx -I/data/EasyBuild-develop/software/elfutils/0.193-GCCcore-14.3.0/include -I/data/EasyBuild-develop/software/libunwind/1.8.2-GCCcore-14.3.0/include -I/data/EasyBuild-develop/software/GLib/2.85.3-GCCcore-14.3.0/include -I/data/EasyBu
     ild-develop/software/GSL/2.8-intel-compilers-2025.2.0/include -I/data/EasyBuild-develop/software/GMP/6.3.0-GCCcore-14.3.0/include -I/data/EasyBuild-develop/software/zlib/1.3.1-GCCcore-14.3.0/include -I/data/EasyBuild-develop/software/Python/3.13.5-GC
     Ccore-14.3.0/include -I/data/EasyBuild-develop/software/pkgconf/2.4.3-GCCcore-14.3.0/include -I/data/EasyBuild-develop/software/gettext/0.25-GCCcore-14.3.0/include -I/data/EasyBuild-develop/software/GObject-Introspection/1.84.0-GCCcore-14.3.0/include
      -I/data/EasyBuild-develop/software/flex/2.6.4-GCCcore-14.3.0/include /data/EasyBuild-develop/build/GStreamer/1.26.5/intel-compilers-2025.2.0/easybuild_obj/meson-private/tmpoap7breg/testfile.c -o /data/EasyBuild-develop/build/GStreamer/1.26.5/intel-c
     ompilers-2025.2.0/easybuild_obj/meson-private/tmpoap7breg/output.obj -c -O2 -march=core-avx2 -ftz -fp-speculation=safe -fp-model precise -Wno-unused-command-line-argument -Wno-error=unused-command-line-argument -D_FILE_OFFSET_BITS=64 -O0 -Werror=impl
     icit-function-declaration -Werror=unknown-warning-option -Werror=unused-command-line-argument -Werror=ignored-optimization-argument` -> 1
1013 stderr:
1014 icx: error: -Wl,-rpath=/data/EasyBuild-develop/software/GStreamer/1.26.5-intel-compilers-2025.2.0/lib: 'linker' input unused [-Werror,-Wunused-command-line-argument]
1015 icx: error: -Wl,-rpath=/data/EasyBuild-develop/software/GStreamer/1.26.5-intel-compilers-2025.2.0/lib64: 'linker' input unused [-Werror,-Wunused-command-line-argument]
1016 icx: error: -Wl,-rpath=$ORIGIN: 'linker' input unused [-Werror,-Wunused-command-line-argument]
1017 icx: error: -Wl,-rpath=$ORIGIN/../lib: 'linker' input unused [-Werror,-Wunused-command-line-argument]
1018 icx: error: -Wl,-rpath=$ORIGIN/../lib64: 'linker' input unused [-Werror,-Wunused-command-line-argument]
1019 icx: error: -Wl,--disable-new-dtags: 'linker' input unused [-Werror,-Wunused-command-line-argument]
1020 icx: error: -Wl,-rpath=/data/EasyBuild-develop/software/elfutils/0.193-GCCcore-14.3.0/lib: 'linker' input unused [-Werror,-Wunused-command-line-argument]
1021 icx: error: -Wl,-rpath=/data/EasyBuild-develop/software/zstd/1.5.7-GCCcore-14.3.0/lib: 'linker' input unused [-Werror,-Wunused-command-line-argument]
1022 icx: error: -Wl,-rpath=/data/EasyBuild-develop/software/lz4/1.10.0-GCCcore-14.3.0/lib: 'linker' input unused [-Werror,-Wunused-command-line-argument]
1023 icx: error: -Wl,-rpath=/data/EasyBuild-develop/software/libarchive/3.8.1-GCCcore-14.3.0/lib: 'linker' input unused [-Werror,-Wunused-command-line-argument]
1024 icx: error: -Wl,-rpath=/data/EasyBuild-develop/software/libunwind/1.8.2-GCCcore-14.3.0/lib: 'linker' input unused [-Werror,-Wunused-command-line-argument]
1025 icx: error: -Wl,-rpath=/data/EasyBuild-develop/software/GLib/2.85.3-GCCcore-14.3.0/lib: 'linker' input unused [-Werror,-Wunused-command-line-argument]
1026 icx: error: -Wl,-rpath=/data/EasyBuild-develop/software/PCRE2/10.45-GCCcore-14.3.0/lib: 'linker' input unused [-Werror,-Wunused-command-line-argument]
1027 icx: error: -Wl,-rpath=/data/EasyBuild-develop/software/GSL/2.8-intel-compilers-2025.2.0/lib: 'linker' input unused [-Werror,-Wunused-command-line-argument]                                                                            1026,26       23%
1028 icx: error: -Wl,-rpath=/data/EasyBuild-develop/software/GMP/6.3.0-GCCcore-14.3.0/lib: 'linker' input unused [-Werror,-Wunused-command-line-argument]
1029 icx: error: -Wl,-rpath=/data/EasyBuild-develop/software/zlib/1.3.1-GCCcore-14.3.0/lib: 'linker' input unused [-Werror,-Wunused-command-line-argument]
1030 icx: error: -Wl,-rpath=/data/EasyBuild-develop/software/Python/3.13.5-GCCcore-14.3.0/lib: 'linker' input unused [-Werror,-Wunused-command-line-argument]
1031 icx: error: -Wl,-rpath=/data/EasyBuild-develop/software/OpenSSL/3/lib64: 'linker' input unused [-Werror,-Wunused-command-line-argument]
1032 icx: error: -Wl,-rpath=/data/EasyBuild-develop/software/bzip2/1.0.8-GCCcore-14.3.0/lib: 'linker' input unused [-Werror,-Wunused-command-line-argument]
1033 icx: error: -Wl,-rpath=/data/EasyBuild-develop/software/pkgconf/2.4.3-GCCcore-14.3.0/lib: 'linker' input unused [-Werror,-Wunused-command-line-argument]
1034 icx: error: -Wl,-rpath=/data/EasyBuild-develop/software/gettext/0.25-GCCcore-14.3.0/lib: 'linker' input unused [-Werror,-Wunused-command-line-argument]
1035 icx: error: -Wl,-rpath=/data/EasyBuild-develop/software/libiconv/1.18-GCCcore-14.3.0/lib: 'linker' input unused [-Werror,-Wunused-command-line-argument]
1036 icx: error: -Wl,-rpath=/data/EasyBuild-develop/software/GObject-Introspection/1.84.0-GCCcore-14.3.0/lib: 'linker' input unused [-Werror,-Wunused-command-line-argument]
1037 icx: error: -Wl,-rpath=/data/EasyBuild-develop/software/util-linux/2.41-GCCcore-14.3.0/lib: 'linker' input unused [-Werror,-Wunused-command-line-argument]
1038 icx: error: -Wl,-rpath=/data/EasyBuild-develop/software/libxml2/2.14.3-GCCcore-14.3.0/lib: 'linker' input unused [-Werror,-Wunused-command-line-argument]
1039 icx: error: -Wl,-rpath=/data/EasyBuild-develop/software/flex/2.6.4-GCCcore-14.3.0/lib: 'linker' input unused [-Werror,-Wunused-command-line-argument]
1040 icx: error: -Wl,-rpath=/data/EasyBuild-develop/software/Bison/3.8.2-GCCcore-14.3.0/lib: 'linker' input unused [-Werror,-Wunused-command-line-argument]
1041 icx: error: -Wl,-rpath=/data/EasyBuild-develop/software/Perl/5.40.2-GCCcore-14.3.0/lib: 'linker' input unused [-Werror,-Wunused-command-line-argument]
1042 icx: error: -Wl,-rpath=/data/EasyBuild-develop/software/libffi/3.5.1-GCCcore-14.3.0/lib64: 'linker' input unused [-Werror,-Wunused-command-line-argument]
1043 icx: error: -Wl,-rpath=/data/EasyBuild-develop/software/libffi/3.5.1-GCCcore-14.3.0/lib: 'linker' input unused [-Werror,-Wunused-command-line-argument]
1044 icx: error: -Wl,-rpath=/data/EasyBuild-develop/software/XZ/5.8.1-GCCcore-14.3.0/lib: 'linker' input unused [-Werror,-Wunused-command-line-argument]
1045 icx: error: -Wl,-rpath=/data/EasyBuild-develop/software/SQLite/3.50.1-GCCcore-14.3.0/lib: 'linker' input unused [-Werror,-Wunused-command-line-argument]
1046 icx: error: -Wl,-rpath=/data/EasyBuild-develop/software/Tcl/9.0.1-GCCcore-14.3.0/lib: 'linker' input unused [-Werror,-Wunused-command-line-argument]
1047 icx: error: -Wl,-rpath=/data/EasyBuild-develop/software/libtommath/1.3.0-GCCcore-14.3.0/lib: 'linker' input unused [-Werror,-Wunused-command-line-argument]
1048 icx: error: -Wl,-rpath=/data/EasyBuild-develop/software/ncurses/6.5-GCCcore-14.3.0/lib: 'linker' input unused [-Werror,-Wunused-command-line-argument]
1049 icx: error: -Wl,-rpath=/data/EasyBuild-develop/software/intel-compilers/2025.2.0/tbb/2022.2/lib: 'linker' input unused [-Werror,-Wunused-command-line-argument]
1050 icx: error: -Wl,-rpath=/data/EasyBuild-develop/software/intel-compilers/2025.2.0/compiler/2025.2/lib: 'linker' input unused [-Werror,-Wunused-command-line-argument]
1051 icx: error: -Wl,-rpath=/data/EasyBuild-develop/software/GCCcore/14.3.0/lib64: 'linker' input unused [-Werror,-Wunused-command-line-argument]
1052 icx: error: -Wl,-rpath=/data/EasyBuild-develop/software/GCCcore/14.3.0/lib: 'linker' input unused [-Werror,-Wunused-command-line-argument]
1053 -----------
1054 Header "pthread.h" has symbol "pthread_condattr_setclock" : NO

Disabling rpath wrappers is sufficient, but probably not what we want to have upstream. Basically, the same issue occurs, with -c passing the rpath arguments when it shouldn't.

Thyre avatar Aug 12 '25 16:08 Thyre

fix implemented in:

  • https://github.com/easybuilders/easybuild-framework/pull/4981

boegel avatar Aug 27 '25 13:08 boegel