[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: RE: Building Secondary Modules
- From: "Antonio Scuri" <scuri@...>
- Date: Wed, 23 Jun 2010 10:51:45 -0300
> 2010/6/23 Antonio Scuri <email@example.com>:
> > I have two modules. One is straight forward to build. But the second
> > depends on C functions that were implemented in the first module.
> > So when linking the second module in Linux I have to add the first
> > using "-lmodule1". But it fails, because the first module is called
> > "module1.so" and not "libmodule1.so".
> > I know there are "alternative" solutions, like creating a symbolic
> > (but do I have to distribute the link? I check using ldd that it
> depends on
> > the link, not to the actual file. Ugly...), or use standard names and
> > the LUA_CPATH (like I do in IUP). Or even build a base library to
> > those functions and link both libraries to that library, but that's
> > just to store a couple of functions.
> > So I would like to know if there are other solutions. I searched the
> > with no success.
> You can use -l: (notice the colon) instead of -l to specify an exact
> filename to ld.
Thanks for the quick answer.
Yes, doing "-l:module1.so" works. It has the same effect of adding the "module1.so" file to the command line. It links. But since "module1.so" is not built in the current directory, running ldd "module2.so" shows that the path "-L../lib" is added to the dependencies:
../lib/module1.so => not found
I couldn't set a LD_LIBRARY_PATH so that file is found.
Copying "module1.so" to the current directory and removing "-L../lib" from the command line, works also without the dependency problem. But again that's not a good procedure for me that build for several platforms using the same folder in a server.
Is there any way to remove that path from the dependencies? Other approaches?