Skip to content
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

ferret.so: undefined symbol: _ZNSt7__cxx1119basic_ostringstreamIcSt11char_traitsIcESaIcEEC1Ev #262

Closed
fingolfin opened this issue Feb 3, 2021 · 19 comments

Comments

@fingolfin
Copy link
Member

... happens in some of our CI tests, namely for Julia 1.4 and 1.5 on Linux (but not for 1.6, nor on macOS), as @fieker and @GDeFranceschi pointed out to me.

I did not yet have time to investigate, but I strongly suspect that this is another instance of oscar-system/GAP.jl#553

That is: we compile ferret (a GAP package) on the user's system (here: the CI servers), using the C++ compiler installed there; but when loading it, it won't get linked the C++ library of that compiler, but rather against the one which is already loaded, namely the one bundled with Julia.

That would then explain why it works on macOS (there Julia does not bundle its own C++ standard library), and in Julia 1.6 (which I suspect bundles a newer C++ library, but have not verified that theory).

@benlorenz
Copy link
Member

That symbol is exactly the same as oscar-system/Polymake.jl#251, so you might be able to fix it by replacing all std::ostringstream oss; by std::ostringstream oss("");. Only the empty constructor needs GLIBCXX_3.4.26 when built with a new libstdc++ version (gcc >= 9).
(not really a fix but a workaround that is already in use in libpolymake_julia and in libcxxwrap_julia)

This was referenced Feb 4, 2021
@ThomasBreuer
Copy link
Member

As far as I understand the situation, the error comes from the call GAP.Packages.load("ferret", install = true) in Oscar.jl/experimental/GaloisGrp/GaloisGrp.jl. In this call, we leave the installation/compilation to a GAP function (InstallPackage), hence the proposed workaround is not applicable.

(I cannot reproduce the problem with Julia 1.5 on my Linux notebook, perhaps this machine has a too new C++ library.)

@thofma
Copy link
Collaborator

thofma commented Feb 5, 2021

Why is it not applicable? Is it not possible to apply the patch of @benlorenz upstream, that is, directly in the ferret package?

@fieker
Copy link
Contributor

fieker commented Feb 5, 2021 via email

@fingolfin
Copy link
Member Author

We can ask the ferret author to apply the patch and make a release and hope that helps.

But it is otherwise difficult to apply the patch, as we invoke the GAP package manager to install ferret; to patch the ferret source, we'd first have to patch (hack) that package manager to allow us to insert code at the point we need.

Not impossible of course, but tricky and fragile.

Proper solution still would be a gap_ferrer_jll, see oscar-system/GAP.jl#614 -- that said, I am open for an interim solution.

@fingolfin
Copy link
Member Author

I am going to submit a PR for ferret and ask @ChrisJefferson whether he can make a fresh release

@benlorenz
Copy link
Member

Maybe someone (who can reproduce the issue) can try that workaround locally first? There might be other symbols with the same issue as well...

@fingolfin
Copy link
Member Author

Indeed. I can reproduce it on an Ubuntu 20.04 box, and verified that gap-packages/ferret#40 resolves the issue there.

@thofma
Copy link
Collaborator

thofma commented Feb 9, 2021

I just rerun CI here: https://github.com/oscar-system/Oscar.jl/pull/265/checks?check_run_id=1846286217

"#I Retrieving PackageInfo.g from https://gap-packages.github.io/ferret/PackageInfo.g "

The file says 1.0.4, but it is still downloading 1.0.3. Is this normal?

@fingolfin
Copy link
Member Author

That seems like a temporary glitch (some cache somewhere not yet updated). I've re-run test of another PR, and there it passed.

It also works fine on my Ubuntu 20.20 machine now with ferret 1.0.4.

Unfortunately, now I run into errors on a bunch of other machines (including nenekiki here in KL), already during precompilation:

[ Info: Compiling JuliaInterface ...
#W dlopen() error: /tmpbig/horn/julia-1.5.3/bin/../lib/julia/libstdc++.so.6: version `GLIBCXX_3.4.26' not found (required by /users/cip/alggeom/horn/.julia/gaproot/v4.11/pkg/ferret-1.0.4/bin/x86_64-pc-linux-gnu-julia64-kv7/ferret.so)

@thofma
Copy link
Collaborator

thofma commented Feb 10, 2021

I think what you see is the usual oscar-system/GAP.jl#553.

But the original issue seems to be fixed on GHA.

@fingolfin
Copy link
Member Author

True.

@thofma thofma closed this as completed Feb 10, 2021
@benlorenz
Copy link
Member

There seems to be one more std::ostringstream() in ferret that was missed:
https://github.com/gap-packages/ferret/blob/master/YAPB%2B%2B/source/library/info.hpp#L20
I don't really know when #ifdef GAP_COMPILED_H is active, but I still get the symbol with ferret 1.0.4.

@ChrisJefferson
Copy link

woops, will investigate

@thofma thofma reopened this Feb 10, 2021
@ChrisJefferson
Copy link

New release (v1.0.5) released. That code is enabled exactly when you are using GAP (this package can be used as a standalone program, without GAP).

@benlorenz
Copy link
Member

Thanks for the quick fix, looks good on my machine now:

julia> GAP.Packages.load("ferret", install = true)
Error: Cannot load 'Ferret' due to missing binary library
Please run './configure; make' in the 'pkg/ferret' directory
#I  Getting PackageInfo URLs...
#I  Retrieving PackageInfo.g from https://gap-packages.github.io/ferret/PackageInfo.g ...
#I  Downloading archive from URL https://github.com/gap-packages/ferret/releases/download/v1.0.5/ferret-1.0.5.tar.gz ...
#I  Saved archive to /tmp/tmM4cnaq/ferret-1.0.5.tar.gz
#I  Extracting to /software/julia/depots/julia-153/gaproot/v4.11/pkg/ferret-1.0.5 ...
#I  Checking dependencies for ferret...
#I    GAPDoc >= 1.5: true
#I  Running compilation script on /software/julia/depots/julia-153/gaproot/v4.11/pkg/ferret-1.0.5 ...
true

julia> 

(Slightly confused why the previous fix did work elsewhere)

@thofma
Copy link
Collaborator

thofma commented Feb 10, 2021

Thanks a lot @ChrisJefferson (and thanks @benlorenz for checking).

@thofma thofma closed this as completed Feb 10, 2021
@fingolfin
Copy link
Member Author

Thanks @ChrisJefferson

I am still confused as to how/why 1.0.4 then was working for me, and also in GitHub Actions? Odd.

@benlorenz
Copy link
Member

I am still confused as to how/why 1.0.4 then was working for me, and also in GitHub Actions? Odd.

It might be because of CompilerSupportLibraries_jll (CSL_jll) which brings a more recent libstdc++. But depending on which packages are loaded in what order there might be the old julia libstdc++ or the new one from CSL_jll in the current process.
(I tried with just GAP and not with Oscar where e.g. Polymake.jl would pull in CSL_jll)

Thinking about that, adding CompilerSupportLibraries_jll and using it in GAP.jl might have fixed this issue as well, at least for most cases. Unless some other package that also relies on libstdc++, but does not depend on CSL_jll, is loaded first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants