Hi, Question about using dynamic libraries on Linux. So I know that creating a shared .so for the golang standard library can be done via the following (or some appropriate cross compiling variant):
go install -buildmode=shared -linkshared std When stripped of debugging information, this process results in a .so binary somewhere between 17MB and 26MB depending on version of golang and target architecture (amd64 vs. ARM for instance). Not too bad for the ENTIRE golang standard library but still pretty big for a shared library especially on an embedded system. One of the negatives for having such a large shared library on embedded Linux systems in addition to just the disk space is that you pay the penalty of the full shared library size in memory if at least one running application is using it (even if the application is only using a very small subset of the standard library packages). So I have been investigating ways to generate and use shared libraries for each of the standard library packages (or appropriate subsets). Is there a supported/easy way to do this? Does anyone have any suggestions? Going into the sync package for instance and building it using the shared build mode and -linkshared typically hangs in (cross-) compilation, whereas removing -linkshared will result in a shared library .so binary that is about 1.5MB in size. To use it, I would probably need to specify appropriate linker flags to link against it (as -linkshared seems like it might be expecting libstd.so). I am guessing that the build statically links in any go standard library dependencies that it uses (since I didn't specify -linkshared). In order to do this kind of thing, do I need to manually figure out dependencies and then setup appropriate linker flags? I realize this isn't too common a use case, but it could be very useful for controlling disk and memory usage in embedded systems using go. Any help would be greatly appreciated. Thanks, Parker -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.