I am trying to re-compile code that compiles fine on Windows 7, Windows SDK, Visual Studio 2017, PGI Community 19.4, plus the pre-compiled fftw3 libraries. This attempt is on Windows 10, Windows SDK, Visual Studio 2017, PGI Community 19.4. and the same pre-compiled fftw3 libraries.
Unfortunately on the new machine I’m getting unresolved external symbols:
pgf90 -Mcuda -o mustem_cpu_sngl *.obj -pgf90libs -Bdynamic “C:\Program Files\PGI\win64\2019\fftw3.3.5\libfftw3-3.lib” “C:\Program Files\PGI\win64\2019\fftw3.3.5\libfftw3f-3.lib” -I"C:\Program Files\PGI\win64\2019\fftw3.3.5"
s_qep_stem.obj : error LNK2001: unresolved external symbol pgf90_str_copy_klen
s_absorptive_tem.obj : error LNK2001: unresolved external symbol pgf90_str_copy_klen
m_lens.obj : error LNK2001: unresolved external symbol pgf90_str_copy_klen
m_absorption.obj : error LNK2001: unresolved external symbol pgf90_str_copy_klen
s_absorptive_stem.obj : error LNK2001: unresolved external symbol pgf90_str_cpy1
m_user_input.obj : error LNK2001: unresolved external symbol pgf90_str_cpy1
m_multislice.obj : error LNK2001: unresolved external symbol pgf90_str_malloc_klen
m_string.obj : error LNK2001: unresolved external symbol pgf90_str_malloc_klen
m_lens.obj : error LNK2001: unresolved external symbol pgf90_str_malloc_klen
m_multislice.obj : error LNK2001: unresolved external symbol pgf90_str_free
m_string.obj : error LNK2001: unresolved external symbol pgf90_str_free
m_lens.obj : error LNK2001: unresolved external symbol pgf90_str_free
m_lens.obj : error LNK2001: unresolved external symbol pgf90_strcmp_klen
m_multislice.obj : error LNK2001: unresolved external symbol pgf90_strcmp_klen
MS_utilities.obj : error LNK2019: unresolved external symbol pgf90_str_index_klen referenced in function setup_integration_measurements_
m_potential.obj : error LNK2001: unresolved external symbol pgf90_str_index_klen
mustem_cpu_sngl.exe : fatal error LNK1120: 6 unresolved externals
./mustem_cpu_sngl.exf: error STP001: cannot open file
make: *** [makefile:36: Hn0_tcmp] Error 2
I would be grateful for any pointers where to start looking.
cheers!
I used e.g. “dumpbin /linkermember libpgf90.lib | grep pgf90_str” on all *.lib in C:\Program Files\PGI\win64\19.4\lib to find out which library I needed to add to the linker and struck gold with:
libpgf90rtl.lib
After adding -lpgf90rtl the compile went through fine.
Now, not sure why I have to add this explicitly for this installation and not for the other?
In the meantime I got it to compile fine without having to add -lpgf90rtl by dropping -Bdynamic. Which I now realise was a change I did make on the new system trying to link to the fftw3 dlls. I am new to compiling on Windows and still trying to find my way around shared, imported and static libraries.
Cheers!
Did you also add -Bdynamic to the compilation flags as well as the link?
On Windows, the symbols to the DLL runtime libraries are different than the static runtime libraries, so -Bdynamic needs to be added to both the compile and link so the correct symbols are used.
My guess is that this is what’s happening given it works if you explicitly add the static runtime library.