Unresolved external MemoryFileSystem::GetLastModificationDate
ludekvodicka opened this issue · 14 comments
Hi,
I finally found some time to play with Jinja2Cpp but not I'm struggling with this issue.
>jinja2Templates.test.obj : error LNK2001: unresolved external symbol "public: virtual class std::optional<class std::chrono::time_point<struct std::chrono::system_clock,class std::chrono::duration<__int64,struct std::ratio<1,10000000> > > > __thiscall jinja2::MemoryFileSystem::GetLastModificationDate(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)const " (?GetLastModificationDate@MemoryFileSystem@jinja2@@UBE?AV?$optional@V?$time_point@Usystem_clock@chrono@std@@V?$duration@_JU?$ratio@$00$0JIJGIA@@std@@@23@@chrono@std@@@std@@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@4@@Z)
1>..\..\GeneratedFiles\Debug32\\axLibrariesLib.dll : fatal error LNK1120: 1 unresolved externals
Still not sure why but MemoryFileSystem::GetLastModificationDate
is marked as unresolved external.
This few lines produce it:
jinja2::MemoryFileSystem mfs;
jinja2::TemplateEnv env;
env.AddFilesystemHandler("", mfs);`
It's strange because RealFileSystem works:
jinja2::RealFileSystem mfs;
jinja2::TemplateEnv env;
env.AddFilesystemHandler("", mfs);`
and I don't see any difference in Jinja2 source code which could cause this.
Do you have any idea what can cause it?
I tried to dump symbols from jinja2cpp.lip and this method is correctly listed.
DUMPBIN /SYMBOLS jinja2cpp.lib
C65 00000730 SECT4 notype () External | ?GetLastModificationDate@MemoryFileSystem@jinja2@@UBE?AV?$optional@V?$time_point@Usystem_clock@chrono@std@@V?$duration@_JU?$ratio@$00$0JIJGIA@@std@@@23@@chrono@std@@@optional_lite@nonstd@@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z (public: virtual class nonstd::optional_lite::optional<class std::chrono::time_point<struct std::chrono::system_clock,class std::chrono::duration<__int64,struct std::ratio<1,10000000> > > > __thiscall jinja2::MemoryFileSystem::GetLastModificationDate(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)const )
CB9 00000E40 SECT4 notype () External | ?GetLastModificationDate@RealFileSystem@ jinja2@@UBE?AV?$optional@V?$time_point@Usystem_clock@chrono@std@@V?$duration@_JU?$ratio@$00$0JIJGIA@@std@@@23@@chrono@std@@@optional_lite@nonstd@@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z (public: virtual class nonstd::optional_lite::optional<class std::chrono::time_point<struct std::chrono::system_clock,class std::chrono::duration<__int64,struct std::ratio<1,10000000> > > > __thiscall jinja2::RealFileSystem:: GetLastModificationDate(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)const )
Thanks! I'll check it out ASAP.
I'm still trying to find a reason. I will let you know if I will find anything.
Not sure if this error isn't caused by using an inner boost although I have another boost in my project.
So I'm not testing to use completely external libraries (because I use another fmt and boost library). But I'm struggling with another error. I will create a standalone issue for that.
This error caused by using the Visual Studio 2019. :) Look:
?GetLastModificationDate@MemoryFileSystem@jinja2@@UBE?AV?$optional@V?$time_point@Usystem_clock@chrono@std@@V?$duration@_JU?$ratio@$00$0JIJGIA@@std@@@23@@chrono@std@@@std@@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@4@@Z)
?GetLastModificationDate@MemoryFileSystem@jinja2@@UBE?AV?$optional@V?$time_point@Usystem_clock@chrono@std@@V?$duration@_JU?$ratio@$00$0JIJGIA@@std@@@23@@chrono@std@@@optional_lite@nonstd@@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z (public: virtual class nonstd::optional_lite::optional<class std::chrono::time_point<struct std::chrono::system_clock,class std::chrono::duration<__int64,struct std::ratio<1,10000000> > > > __thiscall jinja2::MemoryFileSystem::GetLastModificationDate(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)const )
The first line is a symbol referenced from your obj. The second one is exported from the lib. I suppose, you missed to add defines: variant_CONFIG_SELECT_VARIANT=variant_VARIANT_NONSTD nssv_CONFIG_SELECT_STRING_VIEW=nssv_STRING_VIEW_NONSTD optional_CONFIG_SELECT_OPTIONAL=optional_OPTIONAL_NONSTD
These defines stick Jinja2Cpp to the non-std versions of optional
, variant
and string_view
implementations.
I've just found that I forgot to mention it on the .dev site.
Oh! You're right. I didn't noticed that.
I will try it. Thanks
Sorry to ask, but how should I specify these variables?
I tried to pass it through cmake build sytem as -Dxxxx=xxx params, but I'm getting:
-DJINJA2CPP_BUILD_TESTS="OFF" -DBOOST_CMAKE_BUILD_TESTS="OFF" -Dvariant_CONFIG_SELECT_VARIANT=variant_VARIANT_NONSTD -Dnssv_CONFIG_SELECT_STRING_VIEW=nssv_STRING_VIEW_NONSTD -Doptional_CONFIG_SELECT_OPTIONAL=optional_OPTIONAL_NONSTD
CMake Warning:
Manually-specified variables were not used by the project:
nssv_CONFIG_SELECT_STRING_VIEW
optional_CONFIG_SELECT_OPTIONAL
variant_CONFIG_SELECT_VARIANT
And second question, in case that I'm using VS2019, why I have to use nonstd version of string_view?
I also tried -DJINJA2CPP_BUILD_TESTS="OFF" -DBOOST_CMAKE_BUILD_TESTS="OFF" -DJINJA2CPP_CXX_STANDARD=17
but again without success;-(
With DJINJA2CPP_CXX_STANDARD=17
switch, I'm getting a lot of errors
Q:\ExternalLibraries\jinja2\src\value_visitors.h(199): message : see reference to class template instantiation 'jinja2:
:visitors::ValueRendererBase<wchar_t>' being compiled [Q:\ExternalLibraries\jinja2\debug\jinja2cpp.vcxproj]
Q:\ExternalLibraries\jinja2\thirdparty\boost\libs\numeric\conversion\include\boost/numeric/conversion/detail/converter.
hpp(453,61): error C2518: keyword 'typename' illegal in base class list; ignored [Q:\ExternalLibraries\jinja2\debug\jin
ja2cpp.vcxproj]
Q:\ExternalLibraries\jinja2\thirdparty\boost\libs\numeric\conversion\include\boost/numeric/conversion/detail/converter.
hpp(454,1): error C2518: keyword 'typename' illegal in base class list; ignored [Q:\ExternalLibraries\jinja2\debug\jinj
a2cpp.vcxproj]
Q:\ExternalLibraries\jinja2\thirdparty\boost\libs\numeric\conversion\include\boost/numeric/conversion/detail/converter.
hpp(474,57): error C2143: syntax error: missing ',' before '<' [Q:\ExternalLibraries\jinja2\debug\jinja2cpp.vcxproj]
Is there any way how to get rid of all of nonstd libraries and use the only std:: versions?
This should simplify a compilation and configuration of Jinja2cpp a lot. In case that I use DJINJA2CPP_CXX_STANDARD=17
I should be able to use it without any NONSTD variant, right?
I also saw that all examples are on VS2017. Is it tested with 2019?
I tried it one more time on clean directory, received from github. Still the same errors:
git clone https://github.com/jinja2cpp/Jinja2Cpp.git %LIB_PATH%
cd %LIB_PATH%
git submodule -q update --init
q:\ExternalLibraries\jinja2\debug>cmake .. -G "Visual Studio 16" -A "Win32" -DJINJA2CPP_BUILD_TESTS="OFF" -DBOOST_CMAKE_BUILD_TESTS="OFF" -DJINJA2CPP_CXX_STANDARD=17 -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=q:\SharedLibraries2019\jinja2cpp32
Full log including errors:
https://pastebin.com/Hn4RsfJq
Hope this helps. Unfortunately I'm running out of time for the play with jinja2 ;( Soon I will have to go back to my regular projects.
Ok, I just solved this one.
I still tried to pass it to cmake but it's #defines in cpp code (I was confused by the strange naming style).
#define variant_CONFIG_SELECT_VARIANT variant_VARIANT_NONSTD
#define nssv_CONFIG_SELECT_STRING_VIEW nssv_STRING_VIEW_NONSTD
#define optional_CONFIG_SELECT_OPTIONAL optional_OPTIONAL_NONSTD
together with this cmake settings (and external-boost mode):
cmake .. -G "Visual Studio 16" -A "Win32" -DJINJA2CPP_BUILD_TESTS="OFF" -DBOOST_CMAKE_BUILD_TESTS="OFF" -DJINJA2CPP_DEPS_MODE=external-boost -DBoost_INCLUDE_DIR="q:\SharedLibraries2019/boost32/include" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=q:\SharedLibraries2019\jinja2cpp32
the compilation works for jinja2cpp as same as for the final project.
Unfortunately, we have another compatibility issue with nssv_STRING_VIEW_NONSTD because another project also using it but in variant_VARIANT_STD
and jinja2 needs it in variant_VARIANT_NONSTD
It would be best if it would be possible to get rid of all NONSTD macros and libraries and use C++17 and STD versions of these libraries.
Unfortunately, this is still doesn't work for me (no matter if I use DJINJA2CPP_DEPS_MODE in default, external or external-boost mode).
It would be best if it would be possible to get rid of all NONSTD macros and libraries and use C++17 and STD versions of these libraries.
Yes, I would be the best solution. But there is a small, but significant problem. jinja2::Value
type is based on (non)std::variant and has got recursion (e.g. you can put map or list of values into the Value). nonstd-version of variant
in combination with value_ptr
is tolerant to this property, but when I try to use std
version I've got different issues which depend on the std lib implementation. I. e. for different compilers I've got different errors.
Looks like I was able to fix it.
Fixed in the latest release.