Hi Eric,
The problem is that the Makefile template provided with Cantera examples isn’t correct for your rather old version of GCC (GCC 4.8 was released in 2013). The error message listed can be resolved by adding the line
CXXFLAGS=-std=c++11
to the block of definitions in the Makefile.
Ingmar’s suggestion is relevant if you want to use the Cantera Fortran 90 interface. The method of calling Cantera from Fortran 77 used here in demo_ftnlib.cpp does not require any specific support to be compiled as part of the base Cantera library.
Regards,
Ray


ifort -g -O3 -c -o demo.o demo.f
icpc -I/scinet/niagara/software/2018a/opt/intel-2018.2/cantera/2.2.1/include -I/scinet/niagara/software/2018a/opt/intel-2018.2/sundials/2.6.0/include -I/scinet/niagara/software/2018a/opt/intel-2018.2/boost/1.66.0/include -O3 -c -o demo_ftnlib.o demo_ftnlib.cpp
ifort -o demo demo.o demo_ftnlib.o -L/scinet/niagara/software/2018a/opt/intel-2018.2/cantera/2.2.1/lib -lcantera_fortran -lcantera -L/scinet/niagara/software/2018a/opt/intel-2018.2/sundials/2.6.0/lib -lsundials_cvodes -lsundials_ida -lsundials_nvecserial -L/scinet/niagara/intel/2018.2/compilers_and_libraries_2018.2.199/linux/mkl/lib/intel64 -lmkl_gf_ilp64 -lmkl_gnu_thread -lmkl_core -lgomp -lpthread -lm -ldl -lpthread -lstdc++
Here, it finds -lcantera_fortran sucessfully and then run well.
As I have left and enter a new University, I am not allowed to use that the account in near future, and thus I need to install the Cantera in my new account in the new School. Actually, this is the very first time for me to install cantera by myself, and hence, I am not sure how and if I installed it correctly. But I think cantera should work well with my fortran code.
For those reasons, I am acutally a newer for installing cantera and not quite get your point, and not sure how and what I should do to fix this issue.
Regards,
Eric
Eric,
The key difference is that the copy of Cantera that you were on your old HPC cluster using was compiled with F90 support, while the copy you have installed from Conda does not, and there is a bug in the sample build scripts in this scenario. You can work around it by either modifying the Cantera.mak file installed with Cantera to remove reference to the -lcantera_fortran library, as suggested by Ingmar, or you can edit your Makefile to override the variable that would normally trigger linking to this non-existent library. I think this second option may be easier for you, and can be accomplished by adding the line:
CANTERA_CORE_FTN=-L${HOME}/anaconda3/envs/ct-dev/lib -lcantera -lyaml-cpp
to your Makefile near the top with the other variable declarations. Of course, in this case if you modify your Cantera installation path you will need to update this file as well.
Regards,
Ray

Hi Eric,
Sorry, I think I should not have suggested including -lyaml-cpp in my example (it was drawn from a set of files installed on my computer, where I have yaml-cpp installed as a standalone library). Please try removing it from the CANTERA_CORE_FTN variable.
To make it easier to help you, if the above does not resolve the problem, please:
(1) run make clean before running make
(2) Include the full output of the make command each time
(3) Attach the modified Cantera.mak and your current Makefile.
I do not understand how in what you have labeled as “case 2”, make is now using the wrong compiler to link the program and is not including the demo_ftnlib.o file (which is where those symbols are defined).
And in your last case, You must still have the libraries defined to include -lcantera. There is no case where that can be omitted.
Regards,
Ray

Hi Eric,
To keep the context for this in one place, I’m replying here rather than to your more recent re-post.
I don’t understand what’s happening here — the linker seems to be finding some but not all of the Cantera functions that are called from the code being compiled. I’m wondering if they actually all exist in the Cantera library file, or if the right library file is being linked. Can you provide the output from each of the following:
(a) Edit your Makefile to specify LDFLAGS=-Wl,--verbose, and then re-run the build process and save the output, e.g.
make clean
make > buildlog.txt 2>&1
(b) Run the command:
nm -a /beegfs/home/00035/anaconda3/envs/ct-dev/lib/libcantera.a | grep Cantera > symbols.txt
and provide the two output files (buildlog.txt and symbols.txt).
Regards,
Ray