Linking against c++ standard library?
    Christoph Läubrich 
    laeubi at laeubi-soft.de
       
    Thu Aug  3 15:16:38 UTC 2023
    
    
  
Hi Maurizio
thanks for your fast replay, in the stackoverflow there is a hint that says:
 > If you load libmono dynamically at runtime
(I think thats my case)
 > you'll have to load in libstdc++ first, using something like this:
 > void * cxxlib = dlopen("libstdc++.so.6", RTLD_LAZY | RTLD_GLOBAL);
(that's what I tried with System.load)
BUT:
 > Key thing here is the RTLD_GLOBAL flag, which will add all symbols to 
the global table, so they can be found when you're trying to load libmono.
So it seems this RTLD_GLOBAL flag is somehow the missing magic (and 
System.load probabbly is not using that), can I somehow issue an dlopen 
with panama that includes this flag?
Also I can recompile the lib but have no clue what would be the "right" 
way to add the dependency and of course then it only works with custom 
compiled version so I hopped I can somehow trick the JVM here :-)
best
Christoph
Am 03.08.23 um 17:03 schrieb Maurizio Cimadamore:
> Hi,
> not an expert on the topic, but also found this:
> 
> https://stackoverflow.com/questions/67910722/how-to-deal-with-undefined-symbols-when-loading-mono-libraries-in-linux
> 
> It seems like libmono doesn't come with the right dynamic dependencies 
> on it? (so library loading would fail).
> 
> I don't think this is something you can fix on the Java side. You need a 
> library that has the right set of dependencies.
> 
> Maurizio
> 
> On 03/08/2023 15:53, Christoph Läubrich wrote:
>> I used an older lib of "mono" [1] (v5) with panama without a problem 
>> and everything worked out quite well but with v6 of the lib I can't 
>> load it anymore because it fails [2] with "undefined symbol: _ZTIPi", 
>> the maintainer of the lib responded that
>>
>> "though on modern Mono, you need to link against a C++ standard library"
>>
>> so my first guess was to add System.load("stdc++") but this seem not 
>> working (at least it results in the same error message).
>>
>> So I wonder if there is anything special I can do to tell panama to 
>> link/load a c++ standard library?
>>
>>
>>
>> [1] https://www.mono-project.com/
>> [2] https://github.com/mono/mono/issues/21676
    
    
More information about the panama-dev
mailing list