-
Notifications
You must be signed in to change notification settings - Fork 19
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
Polymake.jl doesn't work if user has too new C++ library #251
Comments
I should point out that @fieker and me also did run into this before; I should have filed an issue back then but apparently forgot, sorry about that :-(. I also just checked whether this affects |
Thanks for reporting; there is some movement in julia itself: there is obviously @benlorenz is the person to assess if linking against julia-shipped libstdc++ is reasonable workaround, until we can use upstream solution |
Yeah we need a workaround on our side, as Julia 1.3.1 and 1.4 are both broken in this regard, and I am rather reluctant to accept the idea that we ought to tell DFG referees to delete Julia's libstdc++.so Thanks for the pointers to the Julia issue. I am unconvinced by their plan (and commented there accordingly), but I may very well simply have misunderstood it or not understood the full picture. Based on data from https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html the libstdc++ bundled with Julia is GLIBCXX_3.4.24 which is from GCC 7.2, while the GLIBCXX_3.4.26 symbol is from GCC 9.0 |
So let's see what is need from libc++ 3.4.26, if anything:
Luckily there is just a single use of template <typename T>
std::string show_small_object(const T& obj, bool print_typename = true)
{
std::ostringstream buffer;
auto wrapped_buffer = wrap(buffer);
if (print_typename) {
wrapped_buffer << polymake::legible_typename(typeid(obj)) << pm::endl;
}
wrapped_buffer << obj;
return buffer.str();
} Replacing the body of this function with Of course that's not an acceptable fix, but I am sure we can find a better workaround. Oh and background of this? My guess is that this is because C++17 added support for |
Cool, thanks for digging into this; so the question is: can we obtain a string from Polymake object without using Or maybe we could delegate this to julia show? |
I note this in Polymake.jl:
But that And in C++17, the only addition to As far as I can tell, Polymake's "wrap" only takes |
@kalmarek that sounds good -- I think I can't help from here on as I know next to nothing about the Polymake code, so I'd just be a pointless distraction to you guys. I am rooting for you, though :-). |
First, I don't think this has anything to do with C++17. GCC and libstdc++ have (almost) full C++17 since version 7, see https://en.cppreference.com/w/cpp/compiler_support. Second, delegating to julia is not really possible, as one of the main feature of this is to be able to print types that are not interfaced yet, and for that julia would need to understand the memory layout of the polymake objects.
The error is a friendly way to tell us that the libstdc++ we are using is too old, instead of obscure crashes. There is all this symbol versioning in place which is helping quite a lot. But we might be able to fight this horrible mess that julia brings along (with tons of sometimes outdated bundled libraries; this is not the first similar issue that I encountered....) by throwing in even more bundled libraries: I will try to pull in the CompilerSupportLibraries_jll in legacy mode as another dependency. This contains |
also add patchelf to adjust the DT_NEEDED, otherwise dlopen will use the old libstdc++ that is already in memory even when the new one is dlopen'ed manually. (all of the above only for Sys.islinux())
There is in fact a really surprisingly easy fix, see the updated #252, and the commit that caused this is probably the following |
fix #251: adjust ostringstream constructor for recent libstdc++
this should be fixed by #252 |
we applied such fix in oscar-system/Polymake.jl#252 due to oscar-system/Polymake.jl#251
we applied such fix in oscar-system/Polymake.jl#252 due to oscar-system/Polymake.jl#251
The following was reported by Meinolf Geck on the oscar mailing list, but I've seen it elsewhere before, too: when using Julia 1.3.1 under Ubuntu 19.10, install Oscar seems to work, but loading it doesn't. This can be reduced to Polymake.jl not loading:
Here's my understanding of the issue: Julia includes a copy of a the standard C++ library (which is fine; and it has to, as the user might not have it, or might have a version that's too old). On your computer, there is a newer version of that library; now when Polymake.jl is installed (which involves CxxWrap.jl, and compiling C++ code), the compiler generates output which assumes this newer version of the C++ library will be loaded. But in reality, when run under Julia, it always loads the older version of the C++ library shipped with Julia. As a result, the freshly compiled code fails to load.
So, how can we fix this? One view would be that
Polymake.jl
's build system should explicitly use the same C++ lib as Julia does. Perhaps also CxxWrap needs a corresponding change (I am not sure whether other packages using CxxWrap are affected?).Telling users to remove the Julia copy of
libstdc++
IMHO is not a viable solution. But perhaps you have some other ideas or already a fix?The issue also exists in Julia 1.4 and on other Linux distributions; it's really just a matter of how old the C++ library is.
The text was updated successfully, but these errors were encountered: