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

How to build with icc? #259

Open
ezaron opened this issue Nov 23, 2023 · 4 comments
Open

How to build with icc? #259

ezaron opened this issue Nov 23, 2023 · 4 comments
Labels

Comments

@ezaron
Copy link

ezaron commented Nov 23, 2023

Hi,

The README.md states that the FRE-nctools are built and tested with gnu and intel compilers.

When I try to build on NCAR cheyenne using the intel, icc, the ./configure throws an error:

git clone https://github.com/NOAA-GFDL/FRE-NCtools
cd FRE-NCtools
autoreconf -i
mkdir build && cd build
../configure

checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether UID '3064' is supported by ustar format... yes
checking whether GID '1000' is supported by ustar format... yes
checking how to create a ustar tar archive... gnutar
checking for ranlib... ranlib
checking for style of include used by make... GNU
checking for gcc... icc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether icc accepts -g... yes
checking for icc option to accept ISO C89... none needed
checking dependency style of icc... gcc3
checking for ar... ar
checking the archiver (ar) interface... ar
checking whether we are using the GNU C compiler... (cached) yes
checking whether icc accepts -g... (cached) yes
checking for icc option to accept ISO C89... (cached) none needed
checking dependency style of icc... (cached) gcc3
checking whether icc and cc understand -c and -o together... yes
checking for _Generic... no
configure: error: The C compiler does not support the generic selection C-11 standard. Please use a C-11 compliant compiler.

My module list looks like this:
Currently Loaded Modules:

  1. ncarenv/1.3 2) intel/19.1.1 3) ncarcompilers/0.5.0 4) netcdf/4.8.1 5) mpt/2.25 6) ncview/2.1.7 7) julia/1.9.1

Can you please help me build FRE-nctools with Intel compilers?

-Ed

@ngs333
Copy link
Contributor

ngs333 commented Nov 24, 2023

@ezaron
I believe the C language standard that Intel 19 uses by default is C89. You have to tell the compiler to use a later standard. Can you try the compiler option "-std=c11" (or an even later one) ?
Thanks
MZ

@ezaron
Copy link
Author

ezaron commented Nov 24, 2023

cd FRE-NCtools
export CC="icc -std=c11"
autoreconf -i
cd build
make clean
../configure --prefix=/glade/work/ezaron/opt
make

Many files compile correctly, but then it fails on ../../../tools/libfrencutils/mosaic_util.c:

icc -std=c11 -DHAVE_CONFIG_H -I. -I../../../tools/libfrencutils -I../.. -I/glade/u/apps/ch/opt/netcdf/4.8.1/intel/19.1.1/include -fPIC -I/glade/u/apps/ch/opt/netcdf/4.8.1/intel/19.1.1//include -g -O2 -MT mosaic_util.o -MD -MP -MF .deps/mosaic_util.Tpo -c -o mosaic_util.o ../../../tools/libfrencutils/mosaic_util.c
../../../tools/libfrencutils/mosaic_util.c(1710): error: expression must have a constant value
static const double m01 = - is2;
^

../../../tools/libfrencutils/mosaic_util.c(1711): error: expression must have a constant value
static const double m02 = is2;
^

../../../tools/libfrencutils/mosaic_util.c(1715): error: expression must have a constant value
static const double m[3][3] = { {m00, m01, m02}, {m02, m11, m12},{m01, m12, m11} };
^

../../../tools/libfrencutils/mosaic_util.c(1715): error: expression must have a constant value
static const double m[3][3] = { {m00, m01, m02}, {m02, m11, m12},{m01, m12, m11} };
^

../../../tools/libfrencutils/mosaic_util.c(1715): error: expression must have a constant value
static const double m[3][3] = { {m00, m01, m02}, {m02, m11, m12},{m01, m12, m11} };
^

../../../tools/libfrencutils/mosaic_util.c(1715): error: expression must have a constant value
static const double m[3][3] = { {m00, m01, m02}, {m02, m11, m12},{m01, m12, m11} };
^

../../../tools/libfrencutils/mosaic_util.c(1715): error: expression must have a constant value
static const double m[3][3] = { {m00, m01, m02}, {m02, m11, m12},{m01, m12, m11} };
^

../../../tools/libfrencutils/mosaic_util.c(1715): error: expression must have a constant value
static const double m[3][3] = { {m00, m01, m02}, {m02, m11, m12},{m01, m12, m11} };
^

../../../tools/libfrencutils/mosaic_util.c(1715): error: expression must have a constant value
static const double m[3][3] = { {m00, m01, m02}, {m02, m11, m12},{m01, m12, m11} };
^

../../../tools/libfrencutils/mosaic_util.c(1715): error: expression must have a constant value
static const double m[3][3] = { {m00, m01, m02}, {m02, m11, m12},{m01, m12, m11} };
^

../../../tools/libfrencutils/mosaic_util.c(1715): error: expression must have a constant value
static const double m[3][3] = { {m00, m01, m02}, {m02, m11, m12},{m01, m12, m11} };
^

compilation aborted for ../../../tools/libfrencutils/mosaic_util.c (code 2)

@ngs333
Copy link
Contributor

ngs333 commented Nov 24, 2023

@ezaron
Please let me know if you have to use that version of the intel compiler or if you can use a later version. Also,
do you know if an even later version of the the standard option works with your current compiler? (like -std=c18)

BTW, Normally I compile with these flags (set in a bash script, and below if icc is used (instead of mpicc, etc) it also compiles):

export FC=mpiifort
export CC=mpiicc
#export FC=ifort
#export CC=icc
export FCFLAGS="-g -O2  `nc-config --cflags` `nf-config --fflags` -traceback "
export CFLAGS="-g -O2 -std=c11 `nc-config --cflags` "
export LDFLAGS=" `nc-config --libs`  `nf-config --flibs` "

But also I use a more recent intel compiler (from the oneapi collection)

icc --version
icc (ICC) 2021.5.0 20211109
Copyright (C) 1985-2021 Intel Corporation.  All rights reserved.

@ezaron
Copy link
Author

ezaron commented Nov 26, 2023

Thanks for your help, Miguel.

I tried the -std=c18 flag, and the compiler does not complain, but it dies in the same place as my previous post.

I am using icc version 19.1.1.217 20200306.

I have been able to compile the code with gcc, but I had to purge all modules and load a different set with the gcc dependencies. I was hoping to use the same version of icc, as I need to use the intel modules for my main tasks.

I will just stick with gcc for the moment.

-Ed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants