lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> 2010/6/23 Antonio Scuri <scuri@tecgraf.puc-rio.br>:
> >  I have two modules. One is straight forward to build. But the second
> one
> > 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
> module
> > 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
> link
> > (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
> change
> > the LUA_CPATH (like I do in IUP). Or even build a base library to
> store
> > those functions and link both libraries to that library, but that's
> nonsense
> > just to store a couple of functions.
> >
> >  So I would like to know if there are other solutions. I searched the
> Wiki
> > with no success.
> 
> You can use -l: (notice the colon) instead of -l to specify an exact
> filename to ld.

  Hi Jerome,

  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:

ldd module2.so 
	../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?

Thanks,
Scuri