I want to create a plugin that links against an external library using the existing VMMaker/make scheme. Does the existing configure/make system allow for this? I can modify the existing makefiles and such easy enough, but I'd like to not touch those if possible. I would imagine that it should be possible to list the libs that are needed by a given plugin in a special file included in the plugin's directory (either the "Cross" or platform specific directory within "platforms") and have the build scripts detect it and generate the Makefile with the appropriate -l options. Does something like this currently exist, or do I need to modify the build scripts?
- Stephen
I have the same problem, not only with libs but also with include directories. I had to modify the generated Makefile, adding -I/usr/include/pcap to INCLUDES and -lpcap to LIBS.
If anyone knows of a cleaner solution, please let me know.
Luciano.-
Stephen Pair wrote:
I want to create a plugin that links against an external library using the existing VMMaker/make scheme. Does the existing configure/make system allow for this? I can modify the existing makefiles and such easy enough, but I'd like to not touch those if possible. I would imagine that it should be possible to list the libs that are needed by a given plugin in a special file included in the plugin's directory (either the "Cross" or platform specific directory within "platforms") and have the build scripts detect it and generate the Makefile with the appropriate -l options. Does something like this currently exist, or do I need to modify the build scripts?
- Stephen
--- for a personal reply use: Luciano Notarfrancesco luciano@corest.com
"Stephen Pair" spair@advantive.com is claimed by the authorities to have written:
I want to create a plugin that links against an external library using the existing VMMaker/make scheme. Does the existing configure/make system allow for this?
This is (unfortunately) completely machine/OS dependant.
On systems where a script of some sort can produce an actual makefile I think you might be able to get close to 'automagic' if it were possible to put links to the desired external libs/includes/whatever into the appropriate places in the code tree. Said script could then find them and do the right thing(s)
For those of us with less intelligent machines I suppose we jsut have to manually edit :-(
tim
Stephen,
I'm currently (modulo preparing a presentation for Friday [oops, that's today ;^]) making my current VM sources 3.[23]- and VMMaker-compatible. I'll be looking at what Lex and Co. have done with `Makefile.inc' etc. at SF before deciding how best to proceed. If you can let me know precisely what you need to be linked with what (and when [and how -- e.g., just sucking the lib into the plugin wholesale with `ld -r' would be one possible approach ;-]) it would help a lot.
the existing VMMaker/make scheme. Does the existing configure/make system allow for this?
I hope to provide for per-plugin extensions to both `configure' (for testing headers, libs, programs, machine characteristics, configuration options, etc. that the "vanilla" `configure' doesn't know about but which a plugin might need) and to the various 'Makefile's that it builds.
(All that "mkfrag" stuff in the current scheme is way to complex anyway, and some severe zenification is definitely in order.)
Ian
No, no, don't go out of your way on my account...it's no problem.
I was just curious if there is a way of making a plugin find specific headers/libs without twiddling the makefile. It's nice to be able to write plugins, generate them with VMMaker (thanks again Tim!), drop the platform specific C stuff in, and have the normal Squeak configure/make just pick it up. It works like that now, except when you need to link to external stuff that doesn't happen to be in your paths.
Maybe the configure script that makes the Makefile could detect special files (like SomePlugin.cfg or something) in those plugin directories and add to LIBS or INCLUDES as appropriate.
The contents of SomePlugin.cfg might look something like:
LIBS = -L/some/path/lib -lsomelib INCLUDES = -I/some/path/include
The configure script could take these values and add them to LIBS and INCLUDES, or even better, make them specific to a LIBS or INCLUDES variable for just the plugin in question.
- Stephen
-----Original Message----- From: Ian Piumarta [mailto:ian.piumarta@inria.fr] Sent: Thursday, May 30, 2002 7:24 PM To: Stephen Pair Cc: squeak-dev@lists.squeakfoundation.org Subject: Re: [VM] Linking and external libs
Stephen,
I'm currently (modulo preparing a presentation for Friday [oops, that's today ;^]) making my current VM sources 3.[23]- and VMMaker-compatible. I'll be looking at what Lex and Co. have done with `Makefile.inc' etc. at SF before deciding how best to proceed. If you can let me know precisely what you need to be linked with what (and when [and how -- e.g., just sucking the lib into the plugin wholesale with `ld -r' would be one possible approach ;-]) it would help a lot.
the existing VMMaker/make scheme. Does the existing configure/make system allow for this?
I hope to provide for per-plugin extensions to both `configure' (for testing headers, libs, programs, machine characteristics, configuration options, etc. that the "vanilla" `configure' doesn't know about but which a plugin might need) and to the various 'Makefile's that it builds.
(All that "mkfrag" stuff in the current scheme is way to complex anyway, and some severe zenification is definitely in order.)
Ian
On Thu, 30 May 2002, Stephen Pair wrote:
No, no, don't go out of your way on my account...it's no problem.
It has to be done. (And I think it really is a problem, as plugins are getting ever more complex/ambitious.)
I was just curious if there is a way of making a plugin find specific headers/libs without twiddling the makefile.
Exactly!
Maybe the configure script that makes the Makefile could detect special files (like SomePlugin.cfg or something)
Precisely!
add to LIBS or INCLUDES as appropriate.
I think that much is actually possible right now. (I've no idea if the current VMM build stuff supports makefile/configure extensions in both cross and platdep dirs though. If not, it should.)
The contents of SomePlugin.cfg might look something like:
LIBS = -L/some/path/lib -lsomelib INCLUDES = -I/some/path/include
More or less. ;-)
To do it right you'd want (at least) two files: the first tells `configure' how to check if the lib is actually available (this wouldn't necessarily be as horrendous as the stuff in acinclude.m4 but something equivalent to a "build-time" AC_TRY_COMPILE/AC_TRY_LINK is what we're after here) and the second tells `make' how to include extra definitions and/or extra compile/link/whatever steps that it might need. If you just need to link against a lib (or `-rpath' it) in the final VM then only the `configure' part is actually needed (the lib just has itself added to the main list of LIBS/INCLUDES/... inside `configure'). If you need the lib to be sucked into the plugin then the `Makefile' part is needed too.
Doing it like this gives `configure' the chance to just supress the plugin (and maybe bitch and moan a little about the missing lib in the process ;) before continuing to build a VM without it. (If at all possible: there might be complications with named prims and the like if the plugin is being built internally.) OTOH, missing external libraries for entirely optional pieces of VM shouldn't (IMO) be a reason to refuse point-blank to build *some* kind of VM.
or even better, make them specific to a LIBS or INCLUDES variable for just the plugin in question.
Watch this space.
;)
Ian
"Stephen Pair" spair@advantive.com wrote:
I want to create a plugin that links against an external library using the existing VMMaker/make scheme. Does the existing configure/make system allow for this? I can modify the existing makefiles and such easy enough, but I'd like to not touch those if possible. I would imagine that it should be possible to list the libs that are needed by a given plugin in a special file included in the plugin's directory (either the "Cross" or platform specific directory within "platforms") and have the build scripts detect it and generate the Makefile with the appropriate -l options. Does something like this currently exist, or do I need to modify the build scripts?
You can certainly just hack the makefile to get yourself going. Also, there have been issues in the past with linking libraries to libraries, and I don't know where that is nowadays. For lack of time, I'm going to ignore that issue. It's important though; I'd suggest getting the most recent libtool and looking at its documentation.
What I will mention is how to modify makefile rules, once you have figured out what you want to do. Details are in the BUILD.details file in the Unix area of Source Forge, but I'll overview it here.
By default, mkMake will generate rules to build your plugin which essentially:
1. compile each .c file 2. link the results into a .so or .a file
You should be able to skim through the generate makefile to see what mkMake does for you by default.
If you want to change these rules at all, then you must write a mkMakeRules script which prints your rules to stdout. To get started, your script could be as simple as:
#!/bin/sh cat <<EOF #...insert your modified make rules here... EOF
When you re-run configure (eg with "make update"), your custom rules will replace the default rules.
Once you have a basic script working, the extra mile is to make sure your script works whether the plugin is internal or external, and to make sure you didn't hard code any absolute path names. There are two arguments to the mkMakeRules script that will help you with this: $1 is the path to the top of the VMMaker directory, and $2 is either "internal" or "external".
Overall this seems like a pretty simple system, now that it is documented.
The contents of SomePlugin.cfg might look something like:
LIBS = -L/some/path/lib -lsomelib INCLUDES = -I/some/path/include
This would be an excellent special case to support in a simple way. It shouldn't be hard, either -- anyone want to peek at mkMake and try for it? To make things even simpler, you could have two files named "make.libs" and "make.includes" instead of a single Plugin.cfg file.
If you want to actually go through autoconf, however, then things are much more complex....
Lex
squeak-dev@lists.squeakfoundation.org