|
From: Ethan A M. <me...@uw...> - 2025-01-10 18:44:15
|
On Thursday, 9 January 2025 13:38:22 PST Ozan Kahramanogullari wrote:
> Hi,
>
> I am trying to install gnuplot following the instructions in the INSTALL
> file.
>
> I could run "./prepare" and "./configure" without problems but "make"
> failed with the error message below.
>
> I tried to debug the code, but it exceeded my capacity to do a quick fix. I
> also checked online, but I could not find a solution.
>
> Can anyone help?
>
> I am using an M1 Mac, in case it is relevant.
Yes, very relevant.
First off, you can just ignore the warning that advises to use posix_spawn()
instead of fork(). The real problem is "undeclared function 'rl_getc'".
Gnuplot supports 3 alternative methods for terminal input.
The choice is made at build-time as part of the ./configure step.
1) The gnu readline library, selected by
./configure --with-readline=gnu
2) The BSD editline library, selected by
./configure --with-readline=bsd
3) A minimal but functional input layer that can be selected by
./configure --with-readline=builtin
If you do not specify any of these options, the configure script will pick
one for you based on what it thinks it knows about the library support
on your system. I.e. first it will look for libreadline. If it doesn't find that
it looks for libeditline. If it finds neither it will use the builtin code.
The problem is that MacOS provides a version of the BSD library with
a wrapper that makes it look like, or almost like, gnu readline.
I say "almost" because it does not provide 100% of the routines that
are present in gnu readline. I think what is happening in your case is
that the configure script thinks it has found the readline library on your
system so it selects all the readline-appropriate calling options.
But what it really found was the imitation readline wrapper for libeditline.
That is normal for a Mac if you have not separately installed the "real"
readline library, and up until recently that was good enough for gnuplot.
Recently gnuplot's input layer was modified to use an undocumented
feature of the editline wrapper so that it would be possible to support
UTF-8 encoded terminal input. This worked great on the machines I was
able to test, but an M1 Mac was not among those machines. I am guessing
that the wrapper provided on your machine does not provide a wrapper
for rl_getc(), or just as likely it does have such a routine but fails to list it
in the "readline.h" header file that comes with the wrapper.
Here is the relevant chunk of code from gnuplot's file .../src/term.c:
> #if defined(HAVE_LIBREADLINE)
>
> #define raw() rl_prep_terminal(1)
> #define cook() rl_deprep_terminal()
> #define nextchar() rl_getc(stdin)
>
> #elif defined(HAVE_LIBEDITLINE)
>
> #define raw() rl_prep_terminal(1)
> #define cook() rl_deprep_terminal()
> #define nextchar() fgetc(stdin)
>
> #elif defined(READLINE)
>
> #define raw() set_termio()
> #define cook() reset_termio()
> #define nextchar() fgetc(stdin)
>
> #endif
So, what can you do?
- It is possible that specifying one of the three input options explicitly to ./configure
rather than letting it default would make it work.
Certainly the builtin option should work.
- I am guessing that editing chunk of code shown above so that all three options say
#define nextchar() fgetc(stdin)
would be the correct solution for a system with editline-masquerading-as-readline.
If you try that and it works, please let us know and we can try to teach the configure
script how to handle that. Do you know if there is a compile-time symbol defined
on your machine to indicate that it is an M1? That might be what we would have to
look for.
- I am also guessing that the "real" fix is to file a bug report against the readline.h
header provided by Apple. But I'm not holding my breath on that one.
As I said, this is an undocumented option, and there may in fact be a reason for that.
Ethan
> Best,
> Ozan
>
> =======================
> Ozan Kahramanoğulları, PhD
> ozan-k.com
> =======================
>
> (base) ozan@MBP-FVFGT17VQ05N gnuplot-gnuplot-main % make
>
> /Library/Developer/CommandLineTools/usr/bin/make all-recursive
>
> Making all in config
>
> make[2]: Nothing to be done for `all'.
>
> Making all in m4
>
> make[2]: Nothing to be done for `all'.
>
> Making all in term
>
> make[2]: Nothing to be done for `all'.
>
> Making all in src
>
> Making timestamp.h
>
> /Library/Developer/CommandLineTools/usr/bin/make all-recursive
>
> Making all in wxterminal
>
> make[4]: Nothing to be done for `all'.
>
> Making all in qtterminal
>
> make[4]: Nothing to be done for `all'.
>
> depbase=`echo term.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
>
> gcc -DHAVE_CONFIG_H -I. -I.. -I../term -I../term
> -DBINDIR=\"/usr/local/bin\"
> -DX11_DRIVER_DIR=\"/usr/local/libexec/gnuplot/6.1\"
> -DQT_DRIVER_DIR=\"/usr/local/libexec/gnuplot/6.1\"
> -DGNUPLOT_SHARE_DIR=\"/usr/local/share/gnuplot/6.1\"
> -DGNUPLOT_PS_DIR=\"/usr/local/share/gnuplot/6.1/PostScript\"
> -DGNUPLOT_JS_DIR=\"/usr/local/share/gnuplot/6.1/js\"
> -DGNUPLOT_LUA_DIR=\"/usr/local/share/gnuplot/6.1/lua\" -DCONTACT=\"
> gnu...@li...\"
> -DHELPFILE=\"/usr/local/share/gnuplot/6.1/gnuplot.gih\"
> -DGNUPLOT_X11=\"`echo gnuplot_x11 | sed 's,x,x,'`\"
> -DGNUPLOT_DRIVER_DIR=\"/usr/local/libexec/gnuplot/6.1\" -DGNUPLOT_QT=\"`echo
> gnuplot_qt | sed 's,x,x,'`\"
> -DQTGNUPLOT_DATA_DIR=\"/usr/local/share/gnuplot/6.1/qt\" -I/usr/X11/include
> -g -O2 -MT term.o -MD -MP -MF $depbase.Tpo -c -o term.o term.c &&\
>
> mv -f $depbase.Tpo $depbase.Po
>
> In file included from term.c:1214:
>
> In file included from ./term.h:187:
>
> *../term/x11.trm:1084:6: **warning: **'fork' is deprecated: Use posix_spawn
> or fork [-Wdeprecated-declarations]*
>
> 1084 | if (fork() == 0) {
>
> | * ^*
>
> */Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/unistd.h:604:1:
> note: *'fork' has been explicitly marked deprecated here
>
> 604 | __deprecated_msg("Use posix_spawn or fork")
>
> | *^*
>
> */Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h:218:48:
> note: *expanded from macro '__deprecated_msg'
>
> 218 | #define __deprecated_msg(_msg)
> __attribute__((__deprecated__(_msg)))
>
> | * ^*
>
> *term.c:1382:13: **error: **call to undeclared function 'rl_getc'; ISO C99
> and later do not support implicit function declarations
> [-Wimplicit-function-declaration]*
>
> 1382 | nextchar = nextchar();
>
> | * ^*
>
> *term.c:1360:22: note: *expanded from macro 'nextchar'
>
> 1360 | #define nextchar() rl_getc(stdin)
>
> | * ^*
>
> 1 warning and 1 error generated.
>
> make[4]: *** [term.o] Error 1
>
> make[3]: *** [all-recursive] Error 1
>
> make[2]: *** [all] Error 2
>
> make[1]: *** [all-recursive] Error 1
>
> make: *** [all] Error 2
>
--
Ethan A Merritt
Department of Biochemistry
University of Washington, Seattle
|