git clone https://github.com/Cantera/cantera.git
cd cantera
scons build
sudo apt-get install gcc g++ gfortransunindextype
#if CT_SUNDIALS_VERSION < 25
typedef int sd_size_t;
#else
typedef long int sd_size_t;
#endifsystem_sundials='n'Hi Jenzen,
If you have the cantera Ubuntu packages installed from the PPA, then you can use standard Debian tools to see where the files are installed, e.g.:
dpkg --listfiles cantera-dev
In this case, the files should be in the standard system directories, i.e. /usr/include and /usr/lib.
Where is this copy of Sundials 2.4 coming from? If you’re using the Ubuntu 18.04 package, the system version of Sundials should be 2.7.0.
And Nick, the situation with the type of the index variables in Sundials is even more complicated than that — the sunindextype typedef was only introduced in Sundials 3.0. Sundials switched from using int to using long int in version 2.5, but there was no generic typedef provided by Sundials until more recently.
Regards,
Ray
system_sundials='n'g++ -o combustor -pthread-O3 -std=c++0x -I/usr/local/include -L/usr/local/lib -lcantera -lsundials_cvodes -lsundials_nvecserial combustor.cpp/tmp/ccpHIvrT.o: In function `simple_demo()':combustor.cpp:(.text+0x7a): undefined reference to `Cantera::newPhase(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'/tmp/ccpHIvrT.o:(.data.rel.local.DW.ref._ZTIN7Cantera12CanteraErrorE[DW.ref._ZTIN7Cantera12CanteraErrorE]+0x0): undefined reference to `typeinfo for Cantera::CanteraError'collect2: error: ld returned 1 exit statusFile locations:
applications /usr/local/bin library files /usr/local/lib C++ headers /usr/local/include samples /usr/local/share/cantera/samples data files /usr/local/share/cantera/data Python 2 package (cantera) /usr/local/lib/python2.7/dist-packages Python 2 samples /usr/local/lib/python2.7/dist-packages/cantera/examples Python 3 package (cantera) /usr/local/lib/python3.6/dist-packages Python 3 samples /usr/local/lib/python3.6/dist-packages/cantera/examplesSetup scripts to configure the environment for Cantera are at:
setup script (bash) /usr/local/bin/setup_cantera setup script (csh/tcsh) /usr/local/bin/setup_cantera.csh-I/usr/local/include/cantera/usr/include/usr/lib/usr/include/cantera-std=c++0x
g++ -o combustor -pthread-O3 -std=c++11 -I/usr/local/include -L/usr/local/lib -lcantera -lsundials_cvodes -lsundials_nvecserial combustor.cppHi,
The -std=c++0x flag should be fine - for g++ it is equivalent to -std=c++11. Cantera uses this flag so that it can work with older versions of g++ that implemented enough of the C++11 standard, but before it was finalized and had that name.
The problem does seem to be related to C++11, though. I’m wondering if you have a different (older) version of Cantera installed that is being found first. Can you add the flag -Wl,--verbose=2 to the command line for compiling combustor.cpp, and share the output? I’m mainly interested to see what path it actually finds libcantera.a at, and whether that is your newly-installed copy of Cantera.
Regards,
Ray
g++ -o combustor -pthread -O3 -std=c++11 -I/usr/local/include -L/usr/local/lib -lcantera -lsundials_cvodes -lsundials_nvecserial -Wall --verbose combustor.cppUsing built-in specs.COLLECT_GCC=g++COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/7/lto-wrapperOFFLOAD_TARGET_NAMES=nvptx-noneOFFLOAD_TARGET_DEFAULT=1Target: x86_64-linux-gnuConfigured with: ../src/configure -v --with-pkgversion='Ubuntu 7.3.0-27ubuntu1~18.04' --with-bugurl=file:///usr/share/doc/gcc-7/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-7 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnuThread model: posixgcc version 7.3.0 (Ubuntu 7.3.0-27ubuntu1~18.04)COLLECT_GCC_OPTIONS='-o' 'combustor' '-pthread' '-O3' '-std=c++11' '-I' '/usr/local/include' '-L/usr/local/lib' '-Wall' '-v' '-shared-libgcc' '-mtune=generic' '-march=x86-64' /usr/lib/gcc/x86_64-linux-gnu/7/cc1plus -quiet -v -I /usr/local/include -imultiarch x86_64-linux-gnu -D_GNU_SOURCE -D_REENTRANT combustor.cpp -quiet -dumpbase combustor.cpp -mtune=generic -march=x86-64 -auxbase combustor -O3 -Wall -std=c++11 -version -fstack-protector-strong -Wformat-security -o /tmp/cccgsFET.sGNU C++11 (Ubuntu 7.3.0-27ubuntu1~18.04) version 7.3.0 (x86_64-linux-gnu) compiled by GNU C version 7.3.0, GMP version 6.1.2, MPFR version 4.0.1, MPC version 1.1.0, isl version isl-0.19-GMP
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072ignoring duplicate directory "/usr/include/x86_64-linux-gnu/c++/7"ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/7/../../../../x86_64-linux-gnu/include"ignoring duplicate directory "/usr/local/include" as it is a non-system directory that duplicates a system directory#include "..." search starts here:#include <...> search starts here: /usr/include/c++/7 /usr/include/x86_64-linux-gnu/c++/7 /usr/include/c++/7/backward /usr/lib/gcc/x86_64-linux-gnu/7/include /usr/local/include /usr/lib/gcc/x86_64-linux-gnu/7/include-fixed /usr/include/x86_64-linux-gnu /usr/includeEnd of search list.GNU C++11 (Ubuntu 7.3.0-27ubuntu1~18.04) version 7.3.0 (x86_64-linux-gnu) compiled by GNU C version 7.3.0, GMP version 6.1.2, MPFR version 4.0.1, MPC version 1.1.0, isl version isl-0.19-GMP
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072Compiler executable checksum: 1bfae38ae5df64de6196cbd8c3b07d86COLLECT_GCC_OPTIONS='-o' 'combustor' '-pthread' '-O3' '-std=c++11' '-I' '/usr/local/include' '-L/usr/local/lib' '-Wall' '-v' '-shared-libgcc' '-mtune=generic' '-march=x86-64' as -v -I /usr/local/include --64 -o /tmp/ccLdRm6W.o /tmp/cccgsFET.sGNU assembler version 2.30 (x86_64-linux-gnu) using BFD version (GNU Binutils for Ubuntu) 2.30COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/7/:/usr/lib/gcc/x86_64-linux-gnu/7/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/7/:/usr/lib/gcc/x86_64-linux-gnu/LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/7/:/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/7/../../../:/lib/:/usr/lib/COLLECT_GCC_OPTIONS='-o' 'combustor' '-pthread' '-O3' '-std=c++11' '-I' '/usr/local/include' '-L/usr/local/lib' '-Wall' '-v' '-shared-libgcc' '-mtune=generic' '-march=x86-64' /usr/lib/gcc/x86_64-linux-gnu/7/collect2 -plugin /usr/lib/gcc/x86_64-linux-gnu/7/liblto_plugin.so -plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/7/lto-wrapper -plugin-opt=-fresolution=/tmp/ccpFZoG0.res -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lpthread -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc --sysroot=/ --build-id --eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed -dynamic-linker /lib64/ld-linux-x86-64.so.2 -pie -z now -z relro -o combustor /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/Scrt1.o /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/7/crtbeginS.o -L/usr/local/lib -L/usr/lib/gcc/x86_64-linux-gnu/7 -L/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/7/../../.. -lcantera -lsundials_cvodes -lsundials_nvecserial /tmp/ccLdRm6W.o -lstdc++ -lm -lgcc_s -lgcc -lpthread -lc -lgcc_s -lgcc /usr/lib/gcc/x86_64-linux-gnu/7/crtendS.o /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/crtn.o/tmp/ccLdRm6W.o: In function `simple_demo()':combustor.cpp:(.text+0x7a): undefined reference to `Cantera::newPhase(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'/tmp/ccLdRm6W.o:(.data.rel.local.DW.ref._ZTIN7Cantera12CanteraErrorE[DW.ref._ZTIN7Cantera12CanteraErrorE]+0x0): undefined reference to `typeinfo for Cantera::CanteraError'collect2: error: ld returned 1 exit statusJenzen,
-Wl,--verbose=2 is not two separate compiler options. It is a single option that should be put in with the comma, exactly as I wrote it. This is the method by which arguments are passed to the linker. Since the problem is with the link step, not the compile step, the point is to get extra information out of the linker.
Regards,
Ray
Jenzen,
Is this error occuring on Ubuntu or on WSL?
Can you run the following two commands and share the output?
nm /usr/local/lib/libcantera.a | grep newPhase | c++filt
ls -l /usr/local/lib/libcantera.a
Regards,
Ray
nm /usr/local/lib/libcantera.a | grep newPhase | c++filt U Cantera::newPhase(Cantera::XML_Node&) U Cantera::newPhase(Cantera::XML_Node&)0000000000006040 T Cantera::newPhase(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)0000000000005dd0 T Cantera::newPhase(Cantera::XML_Node&) U Cantera::newPhase(Cantera::XML_Node&)ls -l /usr/local/lib/libcantera.a-rwxrwxrwx 1 root root 453645080 Mar 15 10:12 /usr/local/lib/libcantera.a