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

libplacebo forces c++_shared #256

Open
lcksk opened this issue Apr 15, 2024 · 4 comments
Open

libplacebo forces c++_shared #256

lcksk opened this issue Apr 15, 2024 · 4 comments

Comments

@lcksk
Copy link

lcksk commented Apr 15, 2024

After upgrading mpv recently, it consistently crashes at random during runtime. After extensive Googling, I discovered that a possible cause might be that my program is linking to two incompatible libc++ runtimes, one of which is from the vendors SDK library. However, both mpv and libplacebo are pure C, with the exception of the recently introduced convert.cc. Is it possible to remove the dependency on c++_shared? Although it's very useful, is it necessary to introduce a C++ dependency in a pure C project?
the C++ dependency also significantly increases the app download/install size by requiring the unneeded library. The libc++_shared.so is nearly 1MB (911696 bytes) as seen in app/build/intermediates/stripped_native_libs/release/out/lib/arm64-v8a.

@kasper93
Copy link
Contributor

Patches welcome. If you have better solution for sane convert.cc implementation.

As for crashes it is your job to ensure proper standard library is used. You have not provided what actually crashes and since there is not c++ in api boundary I doubt the crashes are caused by libplacebo itself.

@haasn
Copy link
Owner

haasn commented Apr 17, 2024

Remind me, what was the reason we switched from our implementation to convert.cc again?

@kasper93
Copy link
Contributor

Because there were issues with NIHed parser not working in some corner cases and had quirks like printing 4.000000000000000000000000 instead of 4.0 for example.

[08.08.2023::02:30:13] <haasn> y'know
[08.08.2023::02:30:23] <haasn> probably the sane thing to do is to build a C++ module for string formatting and parsing
[08.08.2023::02:30:28] <haasn> and expose an internal C API for it
[08.08.2023::02:30:47] <haasn> because god knows the C stdlib doesn't get improvements, ever

As for C++ std lib issue, linking statically is an option and will pull only small part of it.

@lcksk
Copy link
Author

lcksk commented Apr 20, 2024

It may just be a special need of mine, and many people may not care about it. I believe that the current implementation in C++ is quite concise. After handling some urgent matters, I will try my best to experiment with some other methods, such as this: https://github.com/hermantb/fast_convert.git

I'm not sure if it covers part of our needs or is completely unrelated.

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

3 participants