Formula libstfl 0.24: Building fails with "ld: cannot find -liconv"

(mglh) #1

On my system, running CentOS 7, building libstfl 0.24 reproducibly fails.
Further informations: https://github.com/Homebrew/linuxbrew-core/issues/12868

After having done some web searching, I would assume that libstfl expects to find libiconv, but at least on Linux systems its functionality is part of libc, so libiconv is not needed on Linux systems. Accordingly, brew seems to deny to install libiconv on Linux systems.

Is a fix for this problem possible, or a workaround?

(Shaun Jackman) #2

Hi, @mglh. Try editing the libstfl formula with brew edit libstfl to remove references to libiconv on Linux.

  if OS.mac?
    ENV.append "LDLIBS", "-liconv"
    ENV.append "LIBS", "-lncurses -liconv -lruby"
  else
    ENV.append "LIBS", "-lncurses -lruby"
  end
…
    s.gsub! "-lncurses", "-lncurses -liconv" if OS.mac?

If that works, we’d appreciate a pull request to fix it!

(mglh) #3

Dear Shaun,

I’m not a programmer, so for me editing the formula is not much more
than a educated guess. Nevertheless, this syntax of libstfl.rb seems
to be correct:

https://pastebin.com/jP797Qm7

Unfortunately libstfl still does not build yet:

https://pastebin.com/s3tiVJLr

My knowledge is not sufficient to interpret the error message =:\

Yours,
mglw

(Shaun Jackman) #4

It looks like you’re getting closer!

stfl_wrap.c:739:20: fatal error: EXTERN.h: No such file or directory

The poorly named EXTERN.h is provided by Perl. Try brew installing perl and gcc or installing the Perl development package with your host package manager (apt-get or yum).

(mglh) #5

Dear Shaun,

I did

$ brew install perl gcc

successfully. I did it a second time, and got

Warning: perl 5.28.1 is already installed and up-to-date
To reinstall 5.28.1, run brew reinstall perl
Warning: gcc 5.5.0_4 is already installed and up-to-date
To reinstall 5.5.0_4, run brew reinstall gcc

libstfl does not build yet:

https://pastebin.com/rdsCtQXD

In my case linuxbrew is used on a system where I do not have
root rights, so installing any additional packages is not an
option.

Yours,
mglh

(Shaun Jackman) #6

Try adding to libstfl.rb

depends_on "perl" unless OS.mac?
(mglh) #7

Dear Shaun,

no success yet.

New libstfl.rb:

https://pastebin.com/3eyGVenr

Error Message:

https://pastebin.com/aBiWJqnK

Yours,
mglh

(Shaun Jackman) #8

Try changing

s.gsub! "gcc", "gcc -undefined dynamic_lookup #{`python-config --cflags`.chomp}"

to

if OS.mac?
  s.gsub! "gcc", "gcc -undefined dynamic_lookup #{`python-config --cflags`.chomp}"
else
  s.gsub! "gcc", "gcc #{`python-config --cflags`.chomp}"
end
(mglh) #9

Dear Shaun,

still no success yet.

New libstfl.rb:

https://pastebin.com/xLeESsZ3

Error Message:

https://pastebin.com/t1KrpP3m

Yours,
mglh

(Shaun Jackman) #10
python/stfl_wrap.c:155:21: fatal error: Python.h: No such file or directory

Try adding…

  depends_on "python" unless OS.mac?
(mglh) #11

Dear Shaun,

no success yet.

New libstfl.rb:

https://pastebin.com/4wWEbKNJ

Error Mesage:

https://pastebin.com/ke889mcW

Yours,
mglh

(Shaun Jackman) #12

Looks like it’s Python 2, not Python 3.
Try removing the dependency on python and adding…

  depends_on "python@2" unless OS.mac?