zsh-users
 help / color / mirror / code / Atom feed
From: Phil Pennock <zsh-workers+phil.pennock@spodhuis.org>
To: "Vadim A. Misbakh-Soloviov" <mva@mva.name>
Cc: "<zsh-users@zsh.org>" <zsh-users@zsh.org>
Subject: Re: zsh/pcre module breakage when static build enabled
Date: Mon, 19 Mar 2018 19:42:36 -0400	[thread overview]
Message-ID: <20180319234236.GA43407@tower.spodhuis.org> (raw)
In-Reply-To: <3073701.qdQlh9y6XZ@note>

On 2018-03-20 at 00:33 +0700, Vadim A. Misbakh-Soloviov wrote:
> Hi there!
> I faced strange issue: when I build zsh-5.4.2 as static binary and trying to 
> run, for example, something like that:
> 
> > $  [[ 'foo→bar' =~ .([^[:ascii:]]). ]]; print $MATCH
> 
> I'm getting following errors:
> 
> > zsh: module `zsh/pcre' has no such feature: `C:pcre-match'
> > zsh: -pcre-match not available for regex
> 
> Although, when I rebuild it as dynamically linked binary, pcre starting to 
> work again
> 
> I think, it looks like a bug.
> 
> Isn't it a way to fix it?

I went to do a static build on FreeBSD (Darwin doesn't support static
binaries) and when grabbing the configure options used by Ports, saw
this:

  ## Some modules can only be built as a shared library.
  ## If you enable STATIC, you may get strange errors if you, a script,
  ## or a plugin tries to use the regex module.

So someone has spotted this before, but I don't recall seeing a
bug-report.

I can't reproduce on FreeBSD, as long as I follow the 'INSTALL'
instructions.  Perhaps it could be made easier to build static shells
with variant features, but I suspect that if you really need a static
shell, you can follow the steps.

Here's what I did.  Did you perhaps skip the '--disable-dynamic' option,
required to change how zsh manages the module code when building
statically?

----------------8< zsh build zsh-5.4.2-198-gd2350a1e8 >8----------------
git pull
git status
git clean -fxd
./.preconfig
CPPFLAGS=-I/usr/local/include LDFLAGS='-L/usr/local/lib -static' \
  ./configure --prefix=$HOME/uzsh \
    --enable-etcdir=/etc --with-tcsetpgrp \
    --enable-function-subdirs --enable-maildir-support \
    --enable-multibyte --enable-zsh-mem --enable-zsh-secure-free \
    --sysconfdir=/usr/local \
    --disable-dynamic --with-term-lib="tinfow tinfo" \
    --enable-pcre --disable-dynamic
sed -Ei '' -e '/name=zsh\/(pcre|regex)/s/link=no/link=static/' config.modules
make && make install.bin install.modules install.fns

~/uzsh/bin/zsh -f

tower% [[ 'foo→bar' =~ .([^[:ascii:]]). ]]; print $MATCH
zsh: failed to compile regex: invalid character class

tower% setopt rematchpcre
tower% [[ 'foo→bar' =~ .([^[:ascii:]]). ]]; print $MATCH
o→b
----------------8< zsh build zsh-5.4.2-198-gd2350a1e8 >8----------------

I just rebuilt with 'config.modules' saying 'link=static' for every
module except: zsh/attr, zsh/db/gdbm, zsh/example

I can use the resulting shell quite well.  It even functions well enough
to display my prompt, which is a bit of a torture test. :^)

-Phil


  reply	other threads:[~2018-03-19 23:42 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-19 17:33 Vadim A. Misbakh-Soloviov
2018-03-19 23:42 ` Phil Pennock [this message]
2018-03-20  5:02   ` Vadim A. Misbakh-Soloviov
2018-03-20  5:16   ` Vadim A. Misbakh-Soloviov
2018-03-21  2:15     ` Phil Pennock
2018-03-25  6:04       ` Vadim A. Misbakh-Soloviov
2018-03-25  6:25         ` Vadim A. Misbakh-Soloviov
2018-03-25 19:50           ` Bart Schaefer
2018-03-26  2:53             ` Vadim A. Misbakh-Soloviov
2018-03-26  5:37             ` Phil Pennock
2018-03-26  8:16               ` Vadim A. Misbakh-Soloviov
2018-03-26  9:41                 ` Vadim A. Misbakh-Soloviov
2018-03-19 18:13 Vadim A. Misbakh-Soloviov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180319234236.GA43407@tower.spodhuis.org \
    --to=zsh-workers+phil.pennock@spodhuis.org \
    --cc=mva@mva.name \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).