0

I am trying to package some native libraries for inclusion into a java natives .jar. Right now, we are targeting 32-bit and 64-bit linux and windows, with macosx upcoming (which would yield a total of 6 variations). In addition, we have some naming problems which would be resolved if we could roll up several small libraries into one big one.

My goal is to convert

my_library.so dependencyA-55.so dependencyB-50.so 

into

my_library_without_dependencies.so

I have full (C and C++) sources for dependencyA and dependencyB; however, I would much rather not to meddle in their compilation, as it is quite complex (ffmpeg). I am trying to pull this off using gcc 4.6 (ubuntu 12.04 64-bit), and the solution, if found, should ideally work for 64-bit and 32-bit linux, and 64-bit and 32-bit windows architectures (cross-compiling via mingw32).

Is there any magic combination of linker options that would cause GCC to subsume the dependencies into a single final shared library?. I have looked intently at the linker options without success, and related SO questions do not address this use-case.

tucuxi
  • 17,561
  • 2
  • 43
  • 74
  • Its not possible, instead you can create static libraries as "dependencyA.a" and "dependencyB.a" ( as you have source code ) and use "--whole-archive" linker switch while creating "my_library.so" – Icarus3 Jul 29 '14 at 18:35
  • Thanks - I gathered as much after lots of additional browsing. If you answer with your comment, I'll accept it. Otherwise, I will delete the question. – tucuxi Jul 30 '14 at 10:57
  • ok, I have posted it as an answer. hopefully it will help someone. – Icarus3 Jul 30 '14 at 11:19
  • possible duplicate of [Merge multiple .so shared libraries](http://stackoverflow.com/questions/915128/merge-multiple-so-shared-libraries) – Klaus Jul 30 '14 at 11:21

1 Answers1

1

Its not possible.

Shared objects are already a product of linker and in the form of ready to execute.

Instead you can create static libraries as "dependencyA.a" and "dependencyB.a" ( as you have source code ) and use "--whole-archive" linker switch while creating "my_library.so"

Icarus3
  • 2,310
  • 14
  • 22