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

Eckit fails to build on macOS using Intel compilers #44

Open
kgerheiser opened this issue Mar 29, 2022 · 0 comments
Open

Eckit fails to build on macOS using Intel compilers #44

kgerheiser opened this issue Mar 29, 2022 · 0 comments

Comments

@kgerheiser
Copy link

kgerheiser commented Mar 29, 2022

I get an error when using Intel compilers on macOS. It's related to handle_strerror_r. It attempts to pass a type int to char *. So, I think the first #ifdef _GNU_SOURCE is being used which accepts a char *, but should be using the second function definition with #elif (_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600 || _POSIX_VERSION >= 200112L || _XOPEN_VERSION >= 600) which does take an int.

Maybe a preprocessor check like __INTEL_COMPILER and APPLE? I guess _GNU_SOURCE is defined but Intel by the function template doesn't match.

Using Intel 2021.4.0 compilers, and macOS 11.6.5

#if defined(_GNU_SOURCE)
/* To use with GNU libc strerror_r */
static void handle_strerror_r(std::ostream& s, int e, char[], char* p) {
if (p) {
s << " (" << p << ")";
}
else {
s << " (errno = " << e << ") ";
}
}
#elif (_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600 || _POSIX_VERSION >= 200112L || _XOPEN_VERSION >= 600)
/* To use with XSI-compliant strerror_r
*
* Linux defines _POSIX_C_SOURCE and _XOPEN_SOURCE
* BSD defines _POSIX_VERSION and _XOPEN_VERSION
* glibc defines _GNU_SOURCE and implements a non-XSI compliant strerror_r
*/
static void handle_strerror_r(std::ostream& s, int e, char es[], int hs) {
if (hs == 0) {
s << " (" << es << ") ";
}
else {
s << " (errno = " << e << ") ";
}
}

   eckit.dir/log/SavedStatus.cc.o -c /Users/KIG/Desktop/spack-stack/cache/build_stage/spack-stage-eckit-1.18.0-xru6mio4qaly46azyjnghicrlbtfukpz/spack-src/src/eckit/log/SavedStatus.cc
  >> 679    /Users/KIG/Desktop/spack-stack/cache/build_stage/spack-stage-eckit-1.18.0-xru6mio4qaly46azyjnghicrlbtfukpz/spack-src/src/eckit/log/Log.cc(367): error: argument of type "int" is incompatible with parameter of type "char *"
     680          handle_strerror_r(s, e, estr, strerror_r(e, estr, sizeof(estr)));
     681                                        ^
     682
     683    [ 27%] Building CXX object src/eckit/CMakeFiles/eckit.dir/log/Seconds.cc.o
     684    cd /Users/KIG/Desktop/spack-stack/cache/build_stage/spack-stage-eckit-1.18.0-xru6mio4qaly46azyjnghicrlbtfukpz/spack-build-xru6mio/src/eckit && /Users/KIG/Desktop/hpc-stack/install/intel-2021.4/mpich/3.4.2/bin/mpic++ -Deckit_EXPORTS -I/Users/KIG/Desktop/spack-stack/cache/build_s
            tage/spack-stage-eckit-1.18.0-xru6mio4qaly46azyjnghicrlbtfukpz/spack-build-xru6mio/src -I/Users/KIG/Desktop/spack-stack/cache/build_stage/spack-stage-eckit-1.18.0-xru6mio4qaly46azyjnghicrlbtfukpz/spack-src/src -I/Users/KIG/Desktop/spack-stack/envs/all.default/install/intel/2021
            .4.0/lz4-1.9.3-cn5gcbi/include -I/opt/local/include -Wall -Wextra -Wno-unused-parameter -Wno-unused-variable -Wno-sign-compare -O2 -g -DNDEBUG -std=gnu++11 -MD -MT src/eckit/CMakeFiles/eckit.dir/log/Seconds.cc.o -MF CMakeFiles/eckit.dir/log/Seconds.cc.o.d -o CMakeFiles/eckit.di
            r/log/Seconds.cc.o -c /Users/KIG/Desktop/spack-stack/cache/build_stage/spack-stage-eckit-1.18.0-xru6mio4qaly46azyjnghicrlbtfukpz/spack-src/src/eckit/log/Seconds.cc
     685    [ 27%] Building CXX object src/eckit/CMakeFiles/eckit.dir/log/Statistics.cc.o
     ...

     689    remark #11074: Inlining inhibited by limit max-size
     690    remark #11074: Inlining inhibited by limit max-total-size
     691    remark #11076: To get full report use -qopt-report=4 -qopt-report-phase ipo
     692    [ 28%] Building CXX object src/eckit/CMakeFiles/eckit.dir/log/SysLog.cc.o
     693    cd /Users/KIG/Desktop/spack-stack/cache/build_stage/spack-stage-eckit-1.18.0-xru6mio4qaly46azyjnghicrlbtfukpz/spack-build-xru6mio/src/eckit && /Users/KIG/Desktop/hpc-stack/install/intel-2021.4/mpich/3.4.2/bin/mpic++ -Deckit_EXPORTS -I/Users/KIG/Desktop/spack-stack/cache/build_s
            tage/spack-stage-eckit-1.18.0-xru6mio4qaly46azyjnghicrlbtfukpz/spack-build-xru6mio/src -I/Users/KIG/Desktop/spack-stack/cache/build_stage/spack-stage-eckit-1.18.0-xru6mio4qaly46azyjnghicrlbtfukpz/spack-src/src -I/Users/KIG/Desktop/spack-stack/envs/all.default/install/intel/2021
            .4.0/lz4-1.9.3-cn5gcbi/include -I/opt/local/include -Wall -Wextra -Wno-unused-parameter -Wno-unused-variable -Wno-sign-compare -O2 -g -DNDEBUG -std=gnu++11 -MD -MT src/eckit/CMakeFiles/eckit.dir/log/SysLog.cc.o -MF CMakeFiles/eckit.dir/log/SysLog.cc.o.d -o CMakeFiles/eckit.dir/
            log/SysLog.cc.o -c /Users/KIG/Desktop/spack-stack/cache/build_stage/spack-stage-eckit-1.18.0-xru6mio4qaly46azyjnghicrlbtfukpz/spack-src/src/eckit/log/SysLog.cc
     694    compilation aborted for /Users/KIG/Desktop/spack-stack/cache/build_stage/spack-stage-eckit-1.18.0-xru6mio4qaly46azyjnghicrlbtfukpz/spack-src/src/eckit/log/Log.cc (code 2)
  >> 695    make[2]: *** [src/eckit/CMakeFiles/eckit.dir/log/Log.cc.o] Error 2
     696    make[2]: *** Waiting for unfinished jobs....
     697    remark #11074: Inlining inhibited by limit max-total-size
     698    remark #11076: To get full report use -qopt-report=4 -qopt-report-phase ipo
     699    remark #11074: Inlining inhibited by limit max-total-size
     700    remark #11076: To get full report use -qopt-report=4 -qopt-report-phase ipo
     701    remark #11074: Inlining inhibited by limit max-total-size
     702    remark #11076: To get full report use -qopt-report=4 -qopt-report-phase ipo
     703    remark #11074: Inlining inhibited by limit max-total-size
     704    remark #11076: To get full report use -qopt-report=4 -qopt-report-phase ipo
  >> 705    make[1]: *** [src/eckit/CMakeFiles/eckit.dir/all] Error 2
  >> 706    make: *** [all] Error 2
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

No branches or pull requests

1 participant