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

how to link libx265 with libstdc++.so? #75

Open
null4n opened this issue Mar 28, 2023 · 6 comments
Open

how to link libx265 with libstdc++.so? #75

null4n opened this issue Mar 28, 2023 · 6 comments

Comments

@null4n
Copy link

null4n commented Mar 28, 2023

in my fork, I want to add libx265. but while I only link libx265, the binary will load libx265.so.188. If I add export FFMPEG_EXTRA_LD_FLAGS="${FFMPEG_EXTRA_LD_FLAGS} -lc++" in build.sh , it load libc++_shared.so in NDK. how to link libstdc++.so in /system/lib64/?

BTW my fork has add fdk-aac successed

@null4n null4n changed the title how to link libx265 with libc++.so? how to link libx265 with libstdc++.so? Mar 28, 2023
@Javernaut
Copy link
Owner

Hello.
I didn't try integrating the libx265 yet and have no answer.

@Javernaut
Copy link
Owner

@null4n

Better later than never)

Recently I added libx265 support to this project. Didn't have any c++ runtime specific problems. I noticed the libavformat.so depends on libc++_shared.so, like you described.

I don't know if this issue is still relevant, but why do you need exactly the libstdc++.so? According to the NDK's docs it is better to use the superior libc++_shared.so instead.

@null4n
Copy link
Author

null4n commented Dec 29, 2023 via email

@Javernaut
Copy link
Owner

You still didn't answer the quesiton about why you need the libstdc++.so. I'm not that experienced with different C++ runtimes, but according to the documentation:

system
The system runtime refers to /system/lib/libstdc++.so. This library should not be confused with GNU's full-featured libstdc++. On Android, libstdc++ is just new and delete. Use libc++ for a full-featured C++ standard library.

This 'system' runtime is deprecated since NDK r18. The libc++ menioned above is exactly the libc++_shared.so, or its static variant.

Are you sure the libstdc++.so is even worth checking?

@null4n
Copy link
Author

null4n commented Dec 31, 2023 via email

@MmingY
Copy link

MmingY commented Jan 4, 2024

I have also encountered and solved your problem. In order for others to better solve the problem, I will share my solution.

android{
  ...
  defaultConfig{
   ...
           externalNativeBuild {
            cmake {
                cppFlags "-std=c++14 -fexceptions -frtti"
                arguments "-DANDROID_ARM_NEON=TRUE",'-DANDROID_STL=c++_shared'
            }
        }
 }
}

The main thing is the following command, but you need to put it in the correct place.

 cmake {
                cppFlags "-std=c++14 -fexceptions -frtti"
                arguments "-DANDROID_ARM_NEON=TRUE",'-DANDROID_STL=c++_shared'
            }

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