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

Could not compile conftest.f, error: identifier "choke" is undefined #449

Open
wannh2 opened this issue Sep 15, 2024 · 6 comments
Open

Could not compile conftest.f, error: identifier "choke" is undefined #449

wannh2 opened this issue Sep 15, 2024 · 6 comments

Comments

@wannh2
Copy link

wannh2 commented Sep 15, 2024

I'm trying to install netcdf-fortran 4.6.1, but met the error "Could not compile conftest.f", after find the config.log, I found "error: identifier "choke" is undefined", here is the command I use for netcdf-fortran
export CC=pgcc
export FC=pgfortran
export CXX=c++

LD_LIBRARY_PATH=/mnt/work/wannh/build_megan/library/netcdf_pg/Build_WRF/LIBRARIES/netcdf/lib:$LD_LIBRARY_PATH
CPPFLAGS=-I/mnt/work/wannh/build_megan/library/netcdf_pg/Build_WRF/LIBRARIES/netcdf/include
LDFLAGS=-L/mnt/work/wannh/build_megan/library/netcdf_pg/Build_WRF/LIBRARIES/netcdf/netcdf/lib
./configure --disable-shared --prefix=/mnt/work/wannh/build_megan/library/netcdf_pg/Build_WRF/LIBRARIES/netcdf/

for netcdf-c, the command is:
CPPFLAGS=-I/mnt/work/wannh/build_megan/library/netcdf_pg/Build_WRF/LIBRARIES/hdf5/include
LDFLAGS=-L/mnt/work/wannh/build_megan/library/netcdf_pg/Build_WRF/LIBRARIES/hdf5/lib
./configure --prefix=/mnt/work/wannh/build_megan/library/netcdf_pg/Build_WRF/LIBRARIES/netcdf/ --disable-dap --disable-shared

system inf:
Ubuntu 18.04.6 LTS (GNU/Linux 4.15.0-197-generic x86_64)
zlib 1.2.11
hdf5 1.15.4-3
netcdf-c 4.9.2

any suggestion for this error? Thank you in advance

config.log

@edwardhartnett
Copy link
Contributor

If you look at line 719 of your config.log, you will see the problem:

configure:22655: pgfortran -c -fopenmp -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /home/nenghan/miniconda3/include conftest.f
pgfortran-Error-Switch -tp with unknown keyword nocona
configure:22658: $? = 1

Where are all these extra CFLAGS coming from? You do not list them in your set of environment variables...

@wannh2
Copy link
Author

wannh2 commented Sep 15, 2024

If you look at line 719 of your config.log, you will see the problem:

configure:22655: pgfortran -c -fopenmp -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /home/nenghan/miniconda3/include conftest.f pgfortran-Error-Switch -tp with unknown keyword nocona configure:22658: $? = 1

Where are all these extra CFLAGS coming from? You do not list them in your set of environment variables...

Thanks, I don't set the enviroment CFLAGS as "/home/nenghan/miniconda3/include", this is another netcdf, like a default one, so when I run "nc-config --all", it comes
image

for this netcdf-fortran 4.6.1, I first install netcdf-c 4.9.2 in "/mnt/work/wannh/build_megan/library/netcdf_pg/Build_WRF/LIBRARIES/netcdf/", then I set enviroment:
LD_LIBRARY_PATH=/mnt/work/wannh/build_megan/library/netcdf_pg/Build_WRF/LIBRARIES/netcdf/lib:$LD_LIBRARY_PATH
CPPFLAGS=-I/mnt/work/wannh/build_megan/library/netcdf_pg/Build_WRF/LIBRARIES/netcdf/include
LDFLAGS=-L/mnt/work/wannh/build_megan/library/netcdf_pg/Build_WRF/LIBRARIES/netcdf/netcdf/lib
./configure --disable-shared --prefix=/mnt/work/wannh/build_megan/library/netcdf_pg/Build_WRF/LIBRARIES/netcdf/

and get the error mention above, any suggustions?
image
here is the inf when I run "/mnt/work/wannh/build_megan/library/netcdf_pg/Build_WRF/LIBRARIES/netcdf/bin/nc-config --all"
image

@edwardhartnett
Copy link
Contributor

OK, this is a little hard to follow.

Did you successfully install netcdf-c-4.9.2? Did you run make check and all tests passed?

The problem you started with was a failure of your fortran compiler to work, due to some of the flags that are set. You have to figure out what that's all about so your fortran compiler works. Look in config.log to find where it failed and start from there.

@wannh2
Copy link
Author

wannh2 commented Sep 15, 2024

OK, this is a little hard to follow.

Did you successfully install netcdf-c-4.9.2? Did you run make check and all tests passed?

The problem you started with was a failure of your fortran compiler to work, due to some of the flags that are set. You have to figure out what that's all about so your fortran compiler works. Look in config.log to find where it failed and start from there.

thank you, I have installed netced-c 4.9.2, and make check and make install passed

@WardF WardF closed this as completed Sep 16, 2024
@WardF WardF reopened this Sep 16, 2024
@WardF
Copy link
Member

WardF commented Sep 16, 2024

Looking at this, I see the following:

ac_cv_env_FFLAGS_value='-fopenmp -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /home/nenghan/miniconda3/include'

What do you see if you run env | grep FFLAGS from your terminal? I believe the issue may be solved if you remove -march=nocona from your FFLAGS, but the first step will be to figure out where they are being set in the first place.

@wannh2
Copy link
Author

wannh2 commented Sep 19, 2024

Thank you, the 'env | grep FFLAGS' returns:

FFLAGS=-fopenmp -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /home/nenghan/miniconda3/include -fopenmp -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-all -fno-plt -Og -g -Wall -Wextra -fcheck=all -fbacktrace -fimplicit-none -fvar-tracking-assignments -ffunction-sections -pipe

I remove ' -march=nocona' doesn't work, but I find FFLAGS points to my system default netcdf library path, here I install my netcdf in '/mnt/work/wannh/build_megan/library/netcdf_pg/Build_WRF/LIBRARIES/netcdf/include', so I set FFLAGS=-I/mnt/work/wannh/build_megan/library/netcdf_pg/Build_WRF/LIBRARIES/netcdf/include, and the problem is solved

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

3 participants