unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Undefined symbols: cfmakeraw and cfsetspeed
@ 2008-06-18  7:23 Klaus Zeitler
  2008-06-18  7:30 ` dhruva
                   ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Klaus Zeitler @ 2008-06-18  7:23 UTC (permalink / raw)
  To: emacs-devel

Production under Solaris 5.8 fails with:

Undefined                       first referenced
 symbol                             in file
cfmakeraw                           sysdep.o
cfsetspeed                          sysdep.o

I compared termios.h with the version in GNU/Linux and obviously the Solaris
5.8 termios.h only provides a subset of the GNU/Linux version, e.g. there's
no cfmakeraw and cfsetspeed.

Is serial_open and serial_configure new code? I also observed that they
are used in process.c (enclosed in HAVE_SERIAL).

Klaus


-- 
 --------------------------------------------------
|  Klaus Zeitler      Alcatel-Lucent               |
|  Email:             kzeitler@alcatel-lucent.com  |
 --------------------------------------------------
---
"Would you tell me, please, which way I ought to go from here?"
"That depends a good deal on where you want to get to," said the Cat
                                                     -- Lewis Carrol




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

* Re: Undefined symbols: cfmakeraw and cfsetspeed
  2008-06-18  7:23 Klaus Zeitler
@ 2008-06-18  7:30 ` dhruva
  2008-06-18  7:47 ` David Kastrup
  2008-06-18 13:01 ` Stefan Monnier
  2 siblings, 0 replies; 14+ messages in thread
From: dhruva @ 2008-06-18  7:30 UTC (permalink / raw)
  To: kzeitler; +Cc: emacs-devel

Hello,

On Wed, Jun 18, 2008 at 12:53 PM, Klaus Zeitler
<kzeitler@alcatel-lucent.com> wrote:
> Is serial_open and serial_configure new code? I also observed that they
> are used in process.c (enclosed in HAVE_SERIAL).

It is new code that allows serial port communication (I am not the
author but have been following the mail chains)

-dhruva

-- 
Contents reflect my personal views only!




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

* Re: Undefined symbols: cfmakeraw and cfsetspeed
  2008-06-18  7:23 Klaus Zeitler
  2008-06-18  7:30 ` dhruva
@ 2008-06-18  7:47 ` David Kastrup
  2008-06-18 13:01 ` Stefan Monnier
  2 siblings, 0 replies; 14+ messages in thread
From: David Kastrup @ 2008-06-18  7:47 UTC (permalink / raw)
  To: kzeitler; +Cc: emacs-devel

Klaus Zeitler <kzeitler@alcatel-lucent.com> writes:

> Production under Solaris 5.8 fails with:
>
> Undefined                       first referenced
>  symbol                             in file
> cfmakeraw                           sysdep.o
> cfsetspeed                          sysdep.o
>
> I compared termios.h with the version in GNU/Linux and obviously the
> Solaris 5.8 termios.h only provides a subset of the GNU/Linux version,
> e.g. there's no cfmakeraw and cfsetspeed.

Sounds to me like cfmakeraw and cfsetspeed are just convenience wrappers
around the more general termios system calls.  It should probably be not
all too difficult to just take the respective versions from glibc which
should be (C) FSF already.

-- 
David Kastrup




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

* Re: Undefined symbols: cfmakeraw and cfsetspeed
  2008-06-18  7:23 Klaus Zeitler
  2008-06-18  7:30 ` dhruva
  2008-06-18  7:47 ` David Kastrup
@ 2008-06-18 13:01 ` Stefan Monnier
  2 siblings, 0 replies; 14+ messages in thread
From: Stefan Monnier @ 2008-06-18 13:01 UTC (permalink / raw)
  To: Daniel Engeler; +Cc: emacs-devel

Could someone please DTRT with this?


        Stefan


>>>>> "Klaus" == Klaus Zeitler <kzeitler@alcatel-lucent.com> writes:

> Production under Solaris 5.8 fails with:
> Undefined                       first referenced
>  symbol                             in file
> cfmakeraw                           sysdep.o
> cfsetspeed                          sysdep.o

> I compared termios.h with the version in GNU/Linux and obviously the Solaris
> 5.8 termios.h only provides a subset of the GNU/Linux version, e.g. there's
> no cfmakeraw and cfsetspeed.

> Is serial_open and serial_configure new code? I also observed that they
> are used in process.c (enclosed in HAVE_SERIAL).

> Klaus


> -- 
>  --------------------------------------------------
> |  Klaus Zeitler      Alcatel-Lucent               |
> |  Email:             kzeitler@alcatel-lucent.com  |
>  --------------------------------------------------
> ---
> "Would you tell me, please, which way I ought to go from here?"
> "That depends a good deal on where you want to get to," said the Cat
>                                                      -- Lewis Carrol





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

* Re: Undefined symbols: cfmakeraw and cfsetspeed
@ 2008-06-18 15:08 Angelo Graziosi
  2008-06-19 13:59 ` Stefan Monnier
  0 siblings, 1 reply; 14+ messages in thread
From: Angelo Graziosi @ 2008-06-18 15:08 UTC (permalink / raw)
  To: emacs-devel; +Cc: kzeitler, Stefan Monnier

This problem has been flagged a few days ago [1].

Following the suggestions in [2], it seems that this patch

===========================================================
$ cat sysdep.c.diff
--- sysdep.c.orig       2008-06-15 01:09:50.000000000 +0200
+++ sysdep.c    2008-06-15 02:13:58.875000000 +0200
@@ -244,6 +244,10 @@

  SIGMASKTYPE sigprocmask_set;

+#if defined(__CYGWIN__)
+void cfmakeraw(struct termios *);
+#endif /* defined(__CYGWIN__) */
+

  #if !defined (HAVE_GET_CURRENT_DIR_NAME) || defined 
(BROKEN_GET_CURRENT_DIR_NAME)

@@ -5447,7 +5451,9 @@
    else
      tem = Fplist_get (p->childp, QCspeed);
    CHECK_NUMBER (tem);
-  err = cfsetspeed (&attr, XINT (tem));
+  err = cfsetispeed(&attr, XINT (tem));
+  err = err +  cfsetospeed(&attr, XINT (tem));
+
    if (err != 0)
      error ("cfsetspeed(%d) failed: %s", XINT (tem), emacs_strerror 
(errno));
    childp2 = Fplist_put (childp2, QCspeed, tem);
@@ -5577,6 +5583,19 @@
    p->childp = childp2;

  }
+
+#if defined(__CYGWIN__)
+/* Workaround for Cygwin, which is missing cfmakeraw */
+/* Pasted from man page; added in serial.c arbitrarily */
+void cfmakeraw(struct termios *termios_p)
+{
+    termios_p->c_iflag &= 
~(IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON);
+    termios_p->c_oflag &= ~OPOST;
+    termios_p->c_lflag &= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN);
+    termios_p->c_cflag &= ~(CSIZE|PARENB);
+    termios_p->c_cflag |= CS8;
+}
+#endif /* defined(__CYGWIN__) */
  #endif /* TERMIOS  */

  /* arch-tag: edb43589-4e09-4544-b325-978b5b121dcf

===========================================================

solves the thing, at least on Cygwin (but perhaps also on Solaris, with 
little changes).


Cheers,
    Angelo.

---
[1] http://lists.gnu.org/archive/html/emacs-devel/2008-06/msg00980.html

[2] http://lists.gnu.org/archive/html/emacs-devel/2008-06/msg00994.html
     http://lists.gnu.org/archive/html/emacs-devel/2008-06/msg00995.html




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

* Re: Undefined symbols: cfmakeraw and cfsetspeed
  2008-06-18 15:08 Angelo Graziosi
@ 2008-06-19 13:59 ` Stefan Monnier
  2008-06-19 16:09   ` Angelo Graziosi
  2008-06-19 17:29   ` Emanuele Giaquinta
  0 siblings, 2 replies; 14+ messages in thread
From: Stefan Monnier @ 2008-06-19 13:59 UTC (permalink / raw)
  To: Angelo Graziosi; +Cc: kzeitler, emacs-devel

> Following the suggestions in [2], it seems that this patch

Could you improve the patch so as to avoid things like "#ifdef __CYGWIN__"
and use autoconf instead?


        Stefan




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

* Re: Undefined symbols: cfmakeraw and cfsetspeed
  2008-06-19 13:59 ` Stefan Monnier
@ 2008-06-19 16:09   ` Angelo Graziosi
  2008-06-19 17:17     ` Stefan Monnier
  2008-06-19 17:29   ` Emanuele Giaquinta
  1 sibling, 1 reply; 14+ messages in thread
From: Angelo Graziosi @ 2008-06-19 16:09 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: kzeitler, emacs-devel

Stefan Monnier ha scritto:
>> Following the suggestions in [2], it seems that this patch
> 
> Could you improve the patch so as to avoid things like "#ifdef __CYGWIN__"
> and use autoconf instead?
> 
> 
>         Stefan
> 

I can't, do not know how autoconf works. Perhaps who introduced the 
access to serial ports, in Emacs, has better solutions.


Cheers,
    Angelo.

---
Tu proverai si' come sa di sale
lo pane altrui, e come e' duro calle
lo scendere e 'l salir per l'altrui scale.
-
                   DANTE, Paradiso, xvii 58-60




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

* Re: Undefined symbols: cfmakeraw and cfsetspeed
  2008-06-19 16:09   ` Angelo Graziosi
@ 2008-06-19 17:17     ` Stefan Monnier
  2008-06-19 23:02       ` Angelo Graziosi
  0 siblings, 1 reply; 14+ messages in thread
From: Stefan Monnier @ 2008-06-19 17:17 UTC (permalink / raw)
  To: Angelo Graziosi; +Cc: Daniel Engeler, kzeitler, emacs-devel

>>> Following the suggestions in [2], it seems that this patch
>> 
>> Could you improve the patch so as to avoid things like "#ifdef __CYGWIN__"
>> and use autoconf instead?

> I can't, do not know how autoconf works.

I don't either, to tell you the truth, but some parts are pretty easy.
In this case, I think you just need to add the relevant functions to one
of the calls to AC_CHECK_FUNCS (in configure.in) and that will provide
you with a HAVE_<FUNNAME> macro which you can then use in your code with
#ifdef HAVE_<FUNNAME>.


        Stefan




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

* Re: Undefined symbols: cfmakeraw and cfsetspeed
  2008-06-19 13:59 ` Stefan Monnier
  2008-06-19 16:09   ` Angelo Graziosi
@ 2008-06-19 17:29   ` Emanuele Giaquinta
  1 sibling, 0 replies; 14+ messages in thread
From: Emanuele Giaquinta @ 2008-06-19 17:29 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: kzeitler, emacs-devel, Angelo Graziosi

On Thu, Jun 19, 2008 at 09:59:59AM -0400, Stefan Monnier wrote:

> > Following the suggestions in [2], it seems that this patch
> 
> Could you improve the patch so as to avoid things like "#ifdef __CYGWIN__"
> and use autoconf instead?

Given that cfmakeraw and cfsetspeed are non standard BSD extensions,
wouldn't it be better to replace their use unconditionally?

Emanuele Giaquinta




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

* Re: Undefined symbols: cfmakeraw and cfsetspeed
  2008-06-19 17:17     ` Stefan Monnier
@ 2008-06-19 23:02       ` Angelo Graziosi
  2008-06-20  1:01         ` Stefan Monnier
  0 siblings, 1 reply; 14+ messages in thread
From: Angelo Graziosi @ 2008-06-19 23:02 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Daniel Engeler, kzeitler, emacs-devel

Stefan Monnier ha scritto:
>>>> Following the suggestions in [2], it seems that this patch
>>> Could you improve the patch so as to avoid things like "#ifdef __CYGWIN__"
>>> and use autoconf instead?
> 
>> I can't, do not know how autoconf works.
> 
> I don't either, to tell you the truth, but some parts are pretty easy.
> In this case, I think you just need to add the relevant functions to one
> of the calls to AC_CHECK_FUNCS (in configure.in) and that will provide
> you with a HAVE_<FUNNAME> macro which you can then use in your code with
> #ifdef HAVE_<FUNNAME>.

Do you mean this?

=======================================
--- configure.in.orig   2008-06-01 23:52:00.000000000 +0200
+++ configure.in        2008-06-19 22:30:20.218750000 +0200
@@ -2300,7 +2300,8 @@
  __fpending mblen mbrlen mbsinit strsignal setitimer ualarm index rindex \
  sendto recvfrom getsockopt setsockopt getsockname getpeername \
  gai_strerror mkstemp getline getdelim mremap memmove fsync sync bzero \
-memset memcmp difftime memcpy mempcpy mblen mbrlen posix_memalign)
+memset memcmp difftime memcpy mempcpy mblen mbrlen posix_memalign \
+cfmakeraw cfsetspeed)

  AC_CHECK_HEADERS(sys/un.h)
=======================================

=======================================
--- sysdep.c.orig       2008-06-15 12:28:21.000000000 +0200
+++ sysdep.c    2008-06-19 22:43:14.578125000 +0200
@@ -244,6 +244,10 @@

  SIGMASKTYPE sigprocmask_set;

+#if !defined (HAVE_CFMAKERAW)
+void cfmakeraw(struct termios *);
+#endif /* !defined (HAVE_CFMAKERAW */
+

  #if !defined (HAVE_GET_CURRENT_DIR_NAME) || defined 
(BROKEN_GET_CURRENT_DIR_NAME)

@@ -5447,7 +5451,12 @@
    else
      tem = Fplist_get (p->childp, QCspeed);
    CHECK_NUMBER (tem);
+#ifdef HAVE_CFSETSPEED
    err = cfsetspeed (&attr, XINT (tem));
+#else
+  err = cfsetispeed(&attr, XINT (tem));
+  err = err +  cfsetospeed(&attr, XINT (tem));
+#endif
    if (err != 0)
      error ("cfsetspeed(%d) failed: %s", XINT (tem), emacs_strerror 
(errno));
    childp2 = Fplist_put (childp2, QCspeed, tem);
@@ -5577,6 +5586,18 @@
    p->childp = childp2;

  }
+#if !defined (HAVE_CFMAKERAW)
+/* Workaround for targets which are missing cfmakeraw */
+/* Pasted from man page; added in serial.c arbitrarily */
+void cfmakeraw(struct termios *termios_p)
+{
+    termios_p->c_iflag &= 
~(IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON);
+    termios_p->c_oflag &= ~OPOST;
+    termios_p->c_lflag &= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN);
+    termios_p->c_cflag &= ~(CSIZE|PARENB);
+    termios_p->c_cflag |= CS8;
+}
+#endif /* !defined (HAVE_CFMAKERAW */
  #endif /* TERMIOS  */

  /* arch-tag: edb43589-4e09-4544-b325-978b5b121dcf
=======================================

I have regenerated 'configure' with autoconf, but it seems that 
HAVE_CFMAKERAW is always 0 and build/src/config.h does not have it.

I have tested this on Cygwin, for which 'configure' says

checking for cfmakeraw... no

and so, HAVE_CFMAKERAW should be 0, and on GNU/Linux, for which

checking for cfmakeraw... yes

and HAVE_CFMAKERAW should be 1. But as I said, it seems 
HAVE_CFMAKERAW==0 always.

The same for HAVE_CFSETSPEED.


Perhaps have you other suggestions?


Cheers,
    Angelo.




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

* Re: Undefined symbols: cfmakeraw and cfsetspeed
  2008-06-19 23:02       ` Angelo Graziosi
@ 2008-06-20  1:01         ` Stefan Monnier
  2008-06-20  7:34           ` Angelo Graziosi
  0 siblings, 1 reply; 14+ messages in thread
From: Stefan Monnier @ 2008-06-20  1:01 UTC (permalink / raw)
  To: Angelo Graziosi; +Cc: Daniel Engeler, kzeitler, emacs-devel

> Do you mean this?

Yes, that looks right.

> I have regenerated 'configure' with autoconf, but it seems that
> HAVE_CFMAKERAW is always 0 and build/src/config.h does not have it.

I think you need to run `autoheader' to generate the config.in and
config.h part.


        Stefan




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

* Re: Undefined symbols: cfmakeraw and cfsetspeed
  2008-06-20  1:01         ` Stefan Monnier
@ 2008-06-20  7:34           ` Angelo Graziosi
  2008-06-20 14:51             ` Stefan Monnier
  0 siblings, 1 reply; 14+ messages in thread
From: Angelo Graziosi @ 2008-06-20  7:34 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Daniel Engeler, kzeitler, emacs-devel

Stefan Monnier ha scritto:
>> Do you mean this?
> 
> Yes, that looks right.
> 
>> I have regenerated 'configure' with autoconf, but it seems that
>> HAVE_CFMAKERAW is always 0 and build/src/config.h does not have it.
> 
> I think you need to run `autoheader' to generate the config.in and
> config.h part.

After running 'autoheader', it seems that the macros 
HAVE_CFMAKERAW/HAVE_CFSETSPEED have the right values: 0 on Cygwin, 1 on 
GNU/Linux.

After reviewing the patches in previous post, perhaps you can apply them 
to CVS-trunk.


Thanks for all suggestions,
    Angelo.





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

* Re: Undefined symbols: cfmakeraw and cfsetspeed
  2008-06-20  7:34           ` Angelo Graziosi
@ 2008-06-20 14:51             ` Stefan Monnier
  0 siblings, 0 replies; 14+ messages in thread
From: Stefan Monnier @ 2008-06-20 14:51 UTC (permalink / raw)
  To: Angelo Graziosi; +Cc: Daniel Engeler, kzeitler, emacs-devel

>>> Do you mean this?
>> 
>> Yes, that looks right.
>> 
>>> I have regenerated 'configure' with autoconf, but it seems that
>>> HAVE_CFMAKERAW is always 0 and build/src/config.h does not have it.
>> 
>> I think you need to run `autoheader' to generate the config.in and
>> config.h part.

> After running 'autoheader', it seems that the macros
> HAVE_CFMAKERAW/HAVE_CFSETSPEED have the right values: 0 on Cygwin, 1 on
> GNU/Linux.

> After reviewing the patches in previous post, perhaps you can apply them to
> CVS-trunk.

Installed (luckily this can be considered as a "tiny change"
so it does not require you to assign copyright).
Thank you for your help,


        Stefan




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

* Re: Undefined symbols: cfmakeraw and cfsetspeed
@ 2008-06-20 21:25 Daniel Engeler
  0 siblings, 0 replies; 14+ messages in thread
From: Daniel Engeler @ 2008-06-20 21:25 UTC (permalink / raw)
  To: angelo.graziosi; +Cc: emacs-devel

Hi Angelo

Thanks for fixing my bug!

Regards,
Daniel




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

end of thread, other threads:[~2008-06-20 21:25 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-20 21:25 Undefined symbols: cfmakeraw and cfsetspeed Daniel Engeler
  -- strict thread matches above, loose matches on Subject: below --
2008-06-18 15:08 Angelo Graziosi
2008-06-19 13:59 ` Stefan Monnier
2008-06-19 16:09   ` Angelo Graziosi
2008-06-19 17:17     ` Stefan Monnier
2008-06-19 23:02       ` Angelo Graziosi
2008-06-20  1:01         ` Stefan Monnier
2008-06-20  7:34           ` Angelo Graziosi
2008-06-20 14:51             ` Stefan Monnier
2008-06-19 17:29   ` Emanuele Giaquinta
2008-06-18  7:23 Klaus Zeitler
2008-06-18  7:30 ` dhruva
2008-06-18  7:47 ` David Kastrup
2008-06-18 13:01 ` Stefan Monnier

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

	https://git.savannah.gnu.org/cgit/emacs.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).