reading data directly from ELF header
Closed this issue · 4 comments
So I have written this program here that reads the symbols directly from the ELF header instead of using other tools through popen(): https://gist.github.com/darealshinji/c68d2ab9da7dd1ea566e9a2a7fd3c21d
It's using std::vector otherwise I would have written it in C. Maybe you can turn it into a better plugin?
I'm not so sure whether using a plugin for this kind of stuff is appropriate anyway. The purpose here is to bundle libstdc++ and associates, but that only really makes sense when also bundling everything else.
A plugin could only be considered reliable if we had a way to ensure it's run last, always. But these "plugin stages" haven't been implemented yet.
Perhaps you can give a quick example on how your program is to be used? That said, writing a plugin isn't hard at all, perhaps you are willing to give it a shot?
I've rewritten it in C now.
You can check the program's main() function to see how it works. It looks into the specified bundle directory and if the bundled library is there (libstdc++ and/or libgcc) it compares its symbols with the one found in the system (using dlopen() and dlinfo()). You can run it with -debug
for more verbose output. Right now it prints the bundle paths so you can add it to LD_LIBRARY_PATH.
As for bundling libstdc++: I would not encourage it either but sometimes a program might need to be compiled with C++11 or newer enabled and if the build system doesn't support that you can use a newer GCC version build from source which will then require you to add the newer libstdc++ library, and in rare cases libgcc too. But since C++11 has been around for a while I assume it hasn't been much of an issue recently. Well, ideally developers would not use the very latest C++ features if they want to provide AppImages.
If done right libstdc++ can be bundled without bundling everything else as it's done in a snap package.
Update:
I will see if I can turn this into a plugin.
I'm finished with the plugin: https://github.com/darealshinji/linuxdeploy-plugin-checkrt
There's an example directory which can be used to test everything and so far it had been working fine for me.
Thank you! It seems to work very well!
My offer still stands: if you want, you can take over this repository in this organization (and join, too, if you want to). Please let me know.
I'll archive the repository otherwise.