zsh-workers
 help / color / mirror / code / Atom feed
* Where to add extra libraries for modules
@ 2001-07-22  1:50 Fletch
  2001-07-22  5:08 ` Andrej Borsenkow
  2001-07-23 16:31 ` Bart Schaefer
  0 siblings, 2 replies; 6+ messages in thread
From: Fletch @ 2001-07-22  1:50 UTC (permalink / raw)
  To: zsh-workers


        I've all but got my perl-in-zsh module working with 4.0.2
again, but I've got an issue with where I should be adding in the
commands to link against the perl libraries.


        There's a perl module `ExtUtils::Embed' that provides commands
`ccopts' and `ldopts' that print out the required compiler flags and
linker options (similar to the gtk+ `gtk-config --libs').  I've got a
zperl.mdd file that's adding stuff to the Makefile like so:


---->8 zperl.mdd 8<----
name=xzperl
link=dynamic
load=no

objects="zperl.o perlxsi.o"

autobins="zperl"

:<<\Make
zperl.$(DL_EXT): $(MODDOBJS_zperl) zperl.export  $(dir_top)/Src/zsh.export $(NOLINKMODS_zperl)
	rm -f $@
	$(DLLINK) $(NXPIMP_zperl) $(NNTRYOPT) $(MODDOBJS_zperl) $(NOLINKMODS_zperl) $(LIBS) \
	   `perl -MExtUtils::Embed -e ldopts`

zperl.$(ANSIOBJ): zperl.c
	$(DLCOMPILE) `perl -MExtUtils::Embed -e ccopts` -o $@ $<

zperl$(ANSIOBJ): zperl.c
	$(COMPILE) `perl -MExtUtils::Embed -e ccopts` -o $@ $<
	@rm -f $(dir_src)/stamp-modobjs

perlxsi.$(ANSIOBJ): perlxsi.c
	$(DLCOMPILE) `perl -MExtUtils::Embed -e ccopts` -o $@ $<

perlxsi$(ANSIOBJ): perlxsi.c
	$(COMPILE) `perl -MExtUtils::Embed -e ccopts` -o $@ $<
	@rm -f $(dir_src)/stamp-modobjs

Make
---->8 zperl.mdd 8<----


        The problem is that the mkmakemod.sh script has already spit
out a rule for `zperl.$(DL_EXT)'.  I realize that I could stick the
ldopts invocation in DLLDFLAGS and/or LDFLAGS in the configure script,
but then that'd be including them for every module.  


        Would it make sense (possibly) to add an `extralibs' paramter
in the .mdd and then have mkmakemod.sh include that in the rule for
module.$(DL_EXT)?


-- 
Fletch                | "If you find my answers frightening,       __`'/|
fletch@phydeaux.org   |  Vincent, you should cease askin'          \ o.O'
770 933-0600 x211(w)  |  scary questions." -- Jules                =(___)=
                      |                                               U


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Where to add extra libraries for modules
  2001-07-22  1:50 Where to add extra libraries for modules Fletch
@ 2001-07-22  5:08 ` Andrej Borsenkow
  2001-07-22 15:43   ` Fletch
  2001-07-23 16:31 ` Bart Schaefer
  1 sibling, 1 reply; 6+ messages in thread
From: Andrej Borsenkow @ 2001-07-22  5:08 UTC (permalink / raw)
  To: Fletch; +Cc: zsh-workers

On 21 Jul 2001, Fletch wrote:

>
>
>         The problem is that the mkmakemod.sh script has already spit
> out a rule for `zperl.$(DL_EXT)'.  I realize that I could stick the
> ldopts invocation in DLLDFLAGS and/or LDFLAGS in the configure script,
> but then that'd be including them for every module.
>
>
>         Would it make sense (possibly) to add an `extralibs' paramter
> in the .mdd and then have mkmakemod.sh include that in the rule for
> module.$(DL_EXT)?
>

It would be trivial, but ...

on most systems perl lib is installed into own directory not in standard
libpath. That means that you have to link your program with some variant
of

LD_RUN_PATH=/usr/lib/perl/5.6.0/... $(LD) ... -L$... -lperl ...

Now, the problem is - I do now that it works when linking main program. I
do not know if it works when linking shared object.

Also, we have AIX and Cygwin. Cygwin may be easier because here libperl is
in PATH (I guess, nust check), but I suspect it won't work for AIX at all
(because we need list of symbols exported from libperl.so). Anybody knows
status of perl on AIX?

Note, that there is no prolem with static perl library.

-andrej


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Where to add extra libraries for modules
  2001-07-22  5:08 ` Andrej Borsenkow
@ 2001-07-22 15:43   ` Fletch
  2001-07-23  4:32     ` Andrej Borsenkow
  0 siblings, 1 reply; 6+ messages in thread
From: Fletch @ 2001-07-22 15:43 UTC (permalink / raw)
  To: Andrej Borsenkow; +Cc: zsh-workers

>>>>> "Andrej" == Andrej Borsenkow <Andrej.Borsenkow@mow.siemens.ru> writes:

[...]

    Andrej> It would be trivial, but ...

    Andrej> on most systems perl lib is installed into own directory
    Andrej> not in standard libpath. That means that you have to link
    Andrej> your program with some variant of

    Andrej> LD_RUN_PATH=/usr/lib/perl/5.6.0/... $(LD)
    Andrej> ... -L$... -lperl ...


        Right, that's what the `perl -MExtUtils::Embed -e ldopts`
does.  For example, on FreeBSD it produces:

  -Wl,-E  -L/usr/local/lib/usr/lib/perl5/5.6.1/i386-freebsd/auto/DynaLoader/DynaLoader.a -L/usr/lib/perl5/5.6.1/i386-freebsd/CORE -lperl -lm -lc -lcrypt
-liconv -lutil


        As long as perl's been installed correctly you just let the
ExtUtils::Embed module give what's apropriate for the platform\

    Andrej> Now, the problem is - I do now that it works when linking
    Andrej> main program. I do not know if it works when linking
    Andrej> shared object.

        It seems to work on FreeBSD and (I believe) Linux.  Then again
its been linking against a static libperl.a rather than a shared
version.
 

[...]

    Andrej> Note, that there is no prolem with static perl library.


        I'm fairly sure that perl defaults to building a static
libperl.a unless you tell it otherwise.  And if it does, I'm pretty
sure that it adds the apropriate -R... flags to set the ld.so search
path.

-- 
Fletch                | "If you find my answers frightening,       __`'/|
fletch@phydeaux.org   |  Vincent, you should cease askin'          \ o.O'
770 933-0600 x211(w)  |  scary questions." -- Jules                =(___)=
                      |                                               U


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Where to add extra libraries for modules
  2001-07-22 15:43   ` Fletch
@ 2001-07-23  4:32     ` Andrej Borsenkow
  0 siblings, 0 replies; 6+ messages in thread
From: Andrej Borsenkow @ 2001-07-23  4:32 UTC (permalink / raw)
  To: Fletch; +Cc: Andrej Borsenkow, zsh-workers

On 22 Jul 2001, Fletch wrote:

>
>
>         I'm fairly sure that perl defaults to building a static
> libperl.a unless you tell it otherwise.  And if it does, I'm pretty
> sure that it adds the apropriate -R... flags to set the ld.so search
> path.
>

Yes, I know. You miss my point. First, I have no idea if these flags have
any effect when building *shared object* as opposed to building
*executable*. Second, we may already have something in LD_RUN_PATH that
needs to be combined with Perl. That cannot be done inside a Makefile and
needs external linker script (libtool? :-) Third, why do you think it is
-R flag? You are speaking about Linux that is porgrammers paradise -
everything works as it should. Other systems may not be as user friendly.

-andrej


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Where to add extra libraries for modules
  2001-07-22  1:50 Where to add extra libraries for modules Fletch
  2001-07-22  5:08 ` Andrej Borsenkow
@ 2001-07-23 16:31 ` Bart Schaefer
  2001-07-30 15:25   ` Clint Adams
  1 sibling, 1 reply; 6+ messages in thread
From: Bart Schaefer @ 2001-07-23 16:31 UTC (permalink / raw)
  To: zsh-workers

On Jul 21,  9:50pm, Fletch wrote:
} 
}         I've all but got my perl-in-zsh module working with 4.0.2
} again, but I've got an issue with where I should be adding in the
} commands to link against the perl libraries.
} 
}         Would it make sense (possibly) to add an `extralibs' paramter
} in the .mdd and then have mkmakemod.sh include that in the rule for
} module.$(DL_EXT)?

We had a short discussion about this back when termcap/terminfo became
modules.  The above would work for Perl, I think, but it won't work for
new modules in general -- the difficult bit comes when some sort of
configure-time testing is needed in order to detect the availability or
local install location of such extra libraries.  At this point there's
nowhere other than zsh's configure script where such tests can be added.

Another question is whether `extralibs' is enough.  Do we need separate
entries for dynamic v. static?  (And is `extralibs' the best name?)

One possibility would be to have `extralibs' or whatever, be an eval'd
value like `link' is.  It'd be evaluated at configure time and then the
result would be copied into config.modules.  We'd have to fix parsing
of that file to permit multiple libraries -- currently in every name=val
pair except the last on the line (`functions'), val has to be exactly
one word.

Then there's the additional question, which someone raised earlier, of
being able to compile zsh modules independently of compiling the shell
itself.  At present I think this would require installing all the .epro
files in an include directory (/usr/local/include/zsh/$(VERSION)/ ?) and
also makepro.awk, mkmakemod.sh, and the generated Makemod (or a subset
of it) somewhere.  What other files am I forgetting?

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Where to add extra libraries for modules
  2001-07-23 16:31 ` Bart Schaefer
@ 2001-07-30 15:25   ` Clint Adams
  0 siblings, 0 replies; 6+ messages in thread
From: Clint Adams @ 2001-07-30 15:25 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: zsh-workers

> Then there's the additional question, which someone raised earlier, of
> being able to compile zsh modules independently of compiling the shell
> itself.  At present I think this would require installing all the .epro
> files in an include directory (/usr/local/include/zsh/$(VERSION)/ ?) and
> also makepro.awk, mkmakemod.sh, and the generated Makemod (or a subset
> of it) somewhere.  What other files am I forgetting?

zsh.h, I would think


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2001-07-30 15:25 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-07-22  1:50 Where to add extra libraries for modules Fletch
2001-07-22  5:08 ` Andrej Borsenkow
2001-07-22 15:43   ` Fletch
2001-07-23  4:32     ` Andrej Borsenkow
2001-07-23 16:31 ` Bart Schaefer
2001-07-30 15:25   ` Clint Adams

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).