Home > Software engineering >  How to create a portable C/C program on linux using additional libraries?
How to create a portable C/C program on linux using additional libraries?

Time:05-03

I need to create a portable linux program that uses a lot of additional libraries defined from yum (CentOS).

It is forbidden to install new packages on portable machines. There are no necessary libraries there.

How to assemble my program and all packages into a single folder through the gcc compiler? When I move this folder to another machine, my program should start and run successfully.

My program is ONLY allowed to use dynamic libraries. Static libraries are STRICTLY prohibited.

When trying to replace rpath with /usr/lib64/ with my libraries that are stored in my directory, after transferring to another machine, additional libraries give an error (glibc version conflict).

CodePudding user response:

This sounds like a doomed project, for anything non-trivial.

Static libraries are not the issue though. Since they're just collections of .o files, you can unpack them. You can then state that you have just linked object files. Stupid rules give stupid results.

I am ignoring software licensing here, though, but that seems implied by the question. You don't need a license for libraries installed via yum, since YOU aren't shipping them. But you absolutely need licenses when you are shipping these libraries in one form or another as part of your product. And given the stupid rules, (L)GPL is likely out of the question, so you will need to obtain commercial licenses for all 7 libraries.

  • Related