Quantcast

Clang compiler error on Sierra (termios.h)

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Clang compiler error on Sierra (termios.h)

Denis Davydov
Dear all,

I am building Gnuplot using Spack package manager on macOS and came across this error:

Making all in docs
/Applications/Xcode.app/Contents/Developer/usr/bin/make  all-am
/Users/davydden/spack/lib/spack/env/clang/clang -DHAVE_CONFIG_H -I. -I..  -I../src -I../term -I/Users/davydden/spack/opt/spack/darwin-sierra-x86_64/clang-8.0.0-apple/readline-6.3-lc6wbyj2gqw2nvkmixulzlnxgmvmbbo6/include  -g -O2 -c -o checkdoc.o checkdoc.c
In file included from checkdoc.c:58:
In file included from ./doc2x.h:72:
In file included from /Users/davydden/spack/opt/spack/darwin-sierra-x86_64/clang-8.0.0-apple/ncurses-6.0-f5ft4ie4brbq44gkyjhr7r42xnfjkhgt/include/term.h:86:
In file included from /usr/include/termios.h:27:
/usr/include/sys/termios.h:263:1: error: expected expression
typedef unsigned long   tcflag_t;
^
1 error generated.

The config is minimalistic for now:

  $ ./configure --prefix=/Users/davydden/spack/opt/spack/darwin-sierra-x86_64/clang-8.0.0-apple/gnuplot-5.0.5-duvihibefbdov3sf33n5w55wrwxf6dax --disable-dependency-tracking --disable-silent-rules --with-readline=/Users/davydden/spack/opt/spack/darwin-sierra-x86_64/clang-8.0.0-apple/readline-6.3-lc6wbyj2gqw2nvkmixulzlnxgmvmbbo6 --without-tutorial --without-bitmap-terminals --without-x --disable-wxwidgets --without-gd --without-cairo --without-pdf --with-qt=no --without-lua --without-latex --without-aquaterm

I would appreciate any suggestion on how to make it work.

p.s. XCode 8.2.1 and Clang8.0.0

p.p.s. I have a feeling that I came across a similar problem in the past and it was related to some issues in Apple’s system headers.

Regards,
Denis

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
gnuplot-info mailing list
[hidden email]
Membership management via: https://lists.sourceforge.net/lists/listinfo/gnuplot-info
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Clang compiler error on Sierra (termios.h)

Hans-Bernhard Bröker-2
Am 18.02.2017 um 23:47 schrieb Denis Davydov:
[...]

> In file included from /Users/davydden/spack/opt/spack/darwin-sierra-x86_64/clang-8.0.0-apple/ncurses-6.0-f5ft4ie4brbq44gkyjhr7r42xnfjkhgt/include/term.h:86:
> In file included from /usr/include/termios.h:27:
> /usr/include/sys/termios.h:263:1: error: expected expression
> typedef unsigned long   tcflag_t;
> ^
> 1 error generated.
[...]
> p.p.s. I have a feeling that I came across a similar problem in the past and it was related to some issues in Apple’s system headers.

Well, for what it's worth, the above _is_ an issue in Apple's system
header termios.h, or maybe in your locally built edition of ncurses. The
clue will most likely be in the last active line above the one cited by
the error message.  I recommend adding "-save-temps" into the CFLAGS and
looking at the resulting *.i file for further clues.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
gnuplot-info mailing list
[hidden email]
Membership management via: https://lists.sourceforge.net/lists/listinfo/gnuplot-info
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Clang compiler error on Sierra (termios.h)

Denis Davydov

> On 19 Feb 2017, at 16:35, Hans-Bernhard Bröker <[hidden email]> wrote:
>
> Am 18.02.2017 um 23:47 schrieb Denis Davydov:
> [...]
>
>> In file included from /Users/davydden/spack/opt/spack/darwin-sierra-x86_64/clang-8.0.0-apple/ncurses-6.0-f5ft4ie4brbq44gkyjhr7r42xnfjkhgt/include/term.h:86:
>> In file included from /usr/include/termios.h:27:
>> /usr/include/sys/termios.h:263:1: error: expected expression
>> typedef unsigned long   tcflag_t;
>> ^
>> 1 error generated.
> [...]
>> p.p.s. I have a feeling that I came across a similar problem in the past and it was related to some issues in Apple’s system headers.
>
> Well, for what it's worth, the above _is_ an issue in Apple's system header termios.h, or maybe in your locally built edition of ncurses. The clue will most likely be in the last active line above the one cited by the error message.  I recommend adding "-save-temps" into the CFLAGS and looking at the resulting *.i file for further clues.

Thanks for the reply.
Indeed, Gnuplot builds fine with system-provided ncurses/readline.

Cheers,
Denis.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
gnuplot-info mailing list
[hidden email]
Membership management via: https://lists.sourceforge.net/lists/listinfo/gnuplot-info
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Clang compiler error on Sierra (termios.h)

Denis Davydov
Apparently, the issue also appears on Ubuntu 16.04.2 with gcc@5.4.0.
So it looks like it’s not related to macOS and/or apple’s Clang or headers.

Below is the error with the invocation line. Although it could indeed be due to some issues with ncurses,
at the moment I don’t see any indication that this is the case. That is because ncurses is used (inderectly) in
many other packages (cmake, boost, etc) and everything builds fine and runs ok.

Is there anything one could further investigate here? Maybe some configure flag has to be added to Gnuplot?

Regards,
Denis.

— Ubuntu 16 error: —

/home/user/spack/lib/spack/env/gcc/gcc -DHAVE_CONFIG_H -I. -I..  -I../src -I../term -I/home/user/spack/opt/spack/linux-ubuntu16-x86_64/gcc-5.4.0/libcerf-1.3-zbysaujg5zsfa4op6qurbu66krzft5hm/include  -I/home/user/spack/opt/spack/linux-ubuntu16-x86_64/gcc-5.4.0/readline-6.3-euvtc2mudxd437l3g24iwjedqatmb7yp/include -I/home/user/spack/opt/spack/linux-ubuntu16-x86_64/gcc-5.4.0/harfbuzz-0.9.37-jmiy6shpek5qiyhiagh7mozmy6gaenxu/include/harfbuzz -I/home/user/spack/opt/spack/linux-ubuntu16-x86_64/gcc-5.4.0/pango-1.40.3-o25yd7z6epplaaewkbsx7qqsiomwz7jd/include/pango-1.0 -I/home/user/spack/opt/spack/linux-ubuntu16-x86_64/gcc-5.4.0/pixman-0.34.0-ebom3x2wc73nw63fcl2wjjtzittk3jm6/include/pixman-1 -I/home/user/spack/opt/spack/linux-ubuntu16-x86_64/gcc-5.4.0/pcre-8.39-vw6umqx3bve2jjiv3scfypbcrgzzageq/include -I/home/user/spack/opt/spack/linux-ubuntu16-x86_64/gcc-5.4.0/glib-2.49.7-qmtzivbdepe44qcxkv26mzvzaquk2njy/include/glib-2.0 -I/home/user/spack/opt/spack/linux-ubuntu16-x86_64/gcc-5.4.0/glib-2.49.7-qmtzivbdepe44qcxkv26mzvzaquk2njy/lib/glib-2.0/include -I/home/user/spack/opt/spack/linux-ubuntu16-x86_64/gcc-5.4.0/libxml2-2.9.4-4m6dx6fnyxgd4yriqxrzq6tmf6lpi2tk/include/libxml2 -I/home/user/spack/opt/spack/linux-ubuntu16-x86_64/gcc-5.4.0/zlib-1.2.11-zn23nl6w64spjwau3vgkaqp4f4vi2uba/include -I/home/user/spack/opt/spack/linux-ubuntu16-x86_64/gcc-5.4.0/libpng-1.6.27-pey6g7av2vicmu3ap4imiu2wau4ylttk/include/libpng16 -I/home/user/spack/opt/spack/linux-ubuntu16-x86_64/gcc-5.4.0/freetype-2.7-d6pxg3prhr7bu6whu6622632nlq6a5yb/include/freetype2 -I/home/user/spack/opt/spack/linux-ubuntu16-x86_64/gcc-5.4.0/fontconfig-2.11.1-urjozsfnjxo4wbr42lykqepkffz53dt6/include -I/home/user/spack/opt/spack/linux-ubuntu16-x86_64/gcc-5.4.0/zlib-1.2.11-zn23nl6w64spjwau3vgkaqp4f4vi2uba/include -I/home/user/spack/opt/spack/linux-ubuntu16-x86_64/gcc-5.4.0/libpng-1.6.27-pey6g7av2vicmu3ap4imiu2wau4ylttk/include/libpng16 -I/home/user/spack/opt/spack/linux-ubuntu16-x86_64/gcc-5.4.0/freetype-2.7-d6pxg3prhr7bu6whu6622632nlq6a5yb/include/freetype2 -I/home/user/spack/opt/spack/linux-ubuntu16-x86_64/gcc-5.4.0/libxml2-2.9.4-4m6dx6fnyxgd4yriqxrzq6tmf6lpi2tk/include/libxml2 -I/home/user/spack/opt/spack/linux-ubuntu16-x86_64/gcc-5.4.0/cairo-1.14.8-5dnv7ujnucheotmu6nle257k3i3udy5n/include/cairo  -g -O2 -c -o doc2rnh.o doc2rnh.c
In file included from /usr/include/termios.h:39:0,
                 from /home/user/spack/opt/spack/linux-ubuntu16-x86_64/gcc-5.4.0/ncurses-6.0-edxtvp6xypxklibesnv2z5gstx3rat7a/include/term.h:86,
                 from doc2x.h:72,
                 from checkdoc.c:58:
/usr/include/x86_64-linux-gnu/bits/termios.h:23:1: error: expected expression before ‘typedef’
 typedef unsigned char cc_t;
 ^

— Configure args: ——

'/home/user/spack/var/spack/stage/gnuplot-5.0.5-bjpzudnr6jw6iogpyctzqwe6ye6djuhw/gnuplot-5.0.5/configure' '--prefix=/home/user/spack/opt/spack/linux-ubuntu16-x86_64/gcc-5.4.0/gnuplot-5.0.5-bjpzudnr6jw6iogpyctzqwe6ye6djuhw' '--prefix=/home/user/spack/opt/spack/linux-ubuntu16-x86_64/gcc-5.4.0/gnuplot-5.0.5-bjpzudnr6jw6iogpyctzqwe6ye6djuhw' '--disable-dependency-tracking' '--disable-silent-rules' '--without-tutorial' '--with-readline=/home/user/spack/opt/spack/linux-ubuntu16-x86_64/gcc-5.4.0/readline-6.3-euvtc2mudxd437l3g24iwjedqatmb7yp' '--without-bitmap-terminals' '--with-x' '--disable-wxwidgets' '--without-gd' '--without-pdf' '--with-qt=no' '--without-lua' '--without-latex' '--without-aquaterm'


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
gnuplot-info mailing list
[hidden email]
Membership management via: https://lists.sourceforge.net/lists/listinfo/gnuplot-info
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Clang compiler error on Sierra (termios.h)

sfeam
On Wednesday, 22 February 2017 01:51:18 PM Denis Davydov wrote:
> Apparently, the issue also appears on Ubuntu 16.04.2 with gcc@5.4.0.
> So it looks like it’s not related to macOS and/or apple’s Clang or headers.
>
> Below is the error with the invocation line. Although it could indeed be due to some issues with ncurses,
> at the moment I don’t see any indication that this is the case. That is because ncurses is used (inderectly) in
> many other packages (cmake, boost, etc) and everything builds fine and runs ok.
>
> Is there anything one could further investigate here? Maybe some configure flag has to be added to Gnuplot?

It looks to me that the compiler is mistakenly resolving
#include "term.h"
to
 /home/user/spack/opt/spack/linux-ubuntu16-x86_64/gcc-5.4.0/ncurses-6.0-edxtvp6xypxklibesnv2z5gstx3rat7a/include/term.h
rather than to
 <build-dir>/src/term.h

That is, it is pulling in a file "term.h" from the ncurses package when it should
be pulling in a file with the same name from the gnuplot source directory.

Why?   No idea.

        Ethan


>
> Regards,
> Denis.
>
> — Ubuntu 16 error: —
>
> /home/user/spack/lib/spack/env/gcc/gcc -DHAVE_CONFIG_H -I. -I..  -I../src -I../term -I/home/user/spack/opt/spack/linux-ubuntu16-x86_64/gcc-5.4.0/libcerf-1.3-zbysaujg5zsfa4op6qurbu66krzft5hm/include  -I/home/user/spack/opt/spack/linux-ubuntu16-x86_64/gcc-5.4.0/readline-6.3-euvtc2mudxd437l3g24iwjedqatmb7yp/include -I/home/user/spack/opt/spack/linux-ubuntu16-x86_64/gcc-5.4.0/harfbuzz-0.9.37-jmiy6shpek5qiyhiagh7mozmy6gaenxu/include/harfbuzz -I/home/user/spack/opt/spack/linux-ubuntu16-x86_64/gcc-5.4.0/pango-1.40.3-o25yd7z6epplaaewkbsx7qqsiomwz7jd/include/pango-1.0 -I/home/user/spack/opt/spack/linux-ubuntu16-x86_64/gcc-5.4.0/pixman-0.34.0-ebom3x2wc73nw63fcl2wjjtzittk3jm6/include/pixman-1 -I/home/user/spack/opt/spack/linux-ubuntu16-x86_64/gcc-5.4.0/pcre-8.39-vw6umqx3bve2jjiv3scfypbcrgzzageq/include -I/home/user/spack/opt/spack/linux-ubuntu16-x86_64/gcc-5.4.0/glib-2.49.7-qmtzivbdepe44qcxkv26mzvzaquk2njy/include/glib-2.0 -I/home/user/spack/opt/spack/linux-ubuntu16-x86_64/gcc-5.4.0/glib-2.49.7-qmtzivbdepe44qcxkv26mzvzaquk2njy/lib/glib-2.0/include -I/home/user/spack/opt/spack/linux-ubuntu16-x86_64/gcc-5.4.0/libxml2-2.9.4-4m6dx6fnyxgd4yriqxrzq6tmf6lpi2tk/include/libxml2 -I/home/user/spack/opt/spack/linux-ubuntu16-x86_64/gcc-5.4.0/zlib-1.2.11-zn23nl6w64spjwau3vgkaqp4f4vi2uba/include -I/home/user/spack/opt/spack/linux-ubuntu16-x86_64/gcc-5.4.0/libpng-1.6.27-pey6g7av2vicmu3ap4imiu2wau4ylttk/include/libpng16 -I/home/user/spack/opt/spack/linux-ubuntu16-x86_64/gcc-5.4.0/freetype-2.7-d6pxg3prhr7bu6whu6622632nlq6a5yb/include/freetype2 -I/home/user/spack/opt/spack/linux-ubuntu16-x86_64/gcc-5.4.0/fontconfig-2.11.1-urjozsfnjxo4wbr42lykqepkffz53dt6/include -I/home/user/spack/opt/spack/linux-ubuntu16-x86_64/gcc-5.4.0/zlib-1.2.11-zn23nl6w64spjwau3vgkaqp4f4vi2uba/include -I/home/user/spack/opt/spack/linux-ubuntu16-x86_64/gcc-5.4.0/libpng-1.6.27-pey6g7av2vicmu3ap4imiu2wau4ylttk/include/libpng16 -I/home/user/spack/opt/spack/linux-ubuntu16-x86_64/gcc-5.4.0/freetype-2.7-d6pxg3prhr7bu6whu6622632nlq6a5yb/include/freetype2 -I/home/user/spack/opt/spack/linux-ubuntu16-x86_64/gcc-5.4.0/libxml2-2.9.4-4m6dx6fnyxgd4yriqxrzq6tmf6lpi2tk/include/libxml2 -I/home/user/spack/opt/spack/linux-ubuntu16-x86_64/gcc-5.4.0/cairo-1.14.8-5dnv7ujnucheotmu6nle257k3i3udy5n/include/cairo  -g -O2 -c -o doc2rnh.o doc2rnh.c
> In file included from /usr/include/termios.h:39:0,
>                  from /home/user/spack/opt/spack/linux-ubuntu16-x86_64/gcc-5.4.0/ncurses-6.0-edxtvp6xypxklibesnv2z5gstx3rat7a/include/term.h:86,
>                  from doc2x.h:72,
>                  from checkdoc.c:58:
> /usr/include/x86_64-linux-gnu/bits/termios.h:23:1: error: expected expression before ‘typedef’
>  typedef unsigned char cc_t;
>  ^
>
> — Configure args: ——
>
> '/home/user/spack/var/spack/stage/gnuplot-5.0.5-bjpzudnr6jw6iogpyctzqwe6ye6djuhw/gnuplot-5.0.5/configure' '--prefix=/home/user/spack/opt/spack/linux-ubuntu16-x86_64/gcc-5.4.0/gnuplot-5.0.5-bjpzudnr6jw6iogpyctzqwe6ye6djuhw' '--prefix=/home/user/spack/opt/spack/linux-ubuntu16-x86_64/gcc-5.4.0/gnuplot-5.0.5-bjpzudnr6jw6iogpyctzqwe6ye6djuhw' '--disable-dependency-tracking' '--disable-silent-rules' '--without-tutorial' '--with-readline=/home/user/spack/opt/spack/linux-ubuntu16-x86_64/gcc-5.4.0/readline-6.3-euvtc2mudxd437l3g24iwjedqatmb7yp' '--without-bitmap-terminals' '--with-x' '--disable-wxwidgets' '--without-gd' '--without-pdf' '--with-qt=no' '--without-lua' '--without-latex' '--without-aquaterm'
>
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, SlashDot.org! http://sdm.link/slashdot
> _______________________________________________
> gnuplot-info mailing list
> [hidden email]
> Membership management via: https://lists.sourceforge.net/lists/listinfo/gnuplot-info
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
gnuplot-info mailing list
[hidden email]
Membership management via: https://lists.sourceforge.net/lists/listinfo/gnuplot-info
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Clang compiler error on Sierra (termios.h)

Denis Davydov
Thank you very much, Ethan. That explained everything!

The Spack package manager was injecting -I<dependency>/include flags for
all packages in the dependencies graph for Gnuplot. In this case Gnuplot needs readline
and readline needs ncurses, which lead to extra undesired include flags.
I am submitting a PR to fix this in Spack and thereby make Gnuplot work again
https://github.com/LLNL/spack/pull/3185

Thank a lot for the help! The root of the problem has been found.

Denis.


> On 22 Feb 2017, at 17:22, sfeam <[hidden email]> wrote:
>
> On Wednesday, 22 February 2017 01:51:18 PM Denis Davydov wrote:
>> Apparently, the issue also appears on Ubuntu 16.04.2 with gcc@5.4.0.
>> So it looks like it’s not related to macOS and/or apple’s Clang or headers.
>>
>> Below is the error with the invocation line. Although it could indeed be due to some issues with ncurses,
>> at the moment I don’t see any indication that this is the case. That is because ncurses is used (inderectly) in
>> many other packages (cmake, boost, etc) and everything builds fine and runs ok.
>>
>> Is there anything one could further investigate here? Maybe some configure flag has to be added to Gnuplot?
>
> It looks to me that the compiler is mistakenly resolving
> #include "term.h"
> to
> /home/user/spack/opt/spack/linux-ubuntu16-x86_64/gcc-5.4.0/ncurses-6.0-edxtvp6xypxklibesnv2z5gstx3rat7a/include/term.h
> rather than to
> <build-dir>/src/term.h
>
> That is, it is pulling in a file "term.h" from the ncurses package when it should
> be pulling in a file with the same name from the gnuplot source directory.
>
> Why?   No idea.
>
> Ethan

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
gnuplot-info mailing list
[hidden email]
Membership management via: https://lists.sourceforge.net/lists/listinfo/gnuplot-info
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Clang compiler error on Sierra (termios.h)

Ethan A Merritt-2
On Wed, Feb 22, 2017 at 2:36 PM, Denis Davydov <[hidden email]> wrote:
> Thank you very much, Ethan. That explained everything!
>
> The Spack package manager was injecting -I<dependency>/include flags for
> all packages in the dependencies graph for Gnuplot. In this case Gnuplot
> needs readline and readline needs ncurses, which lead to extra undesired include flags.

Well, gnuplot-the-executable needs readline, but your failure here
came while trying
to build the documentation.  Maybe Spack could be told to distinguish between
dependencies needed to build executable components of the package and
dependencies (if any) needed for auxiliary stuff like documentation or demos?

   Ethan


> I am submitting a PR to fix this in Spack and thereby make Gnuplot work
> again
> https://github.com/LLNL/spack/pull/3185
>
> Thank a lot for the help! The root of the problem has been found.
>
> Denis.
>
>
> On 22 Feb 2017, at 17:22, sfeam <[hidden email]> wrote:
>
> On Wednesday, 22 February 2017 01:51:18 PM Denis Davydov wrote:
>
> Apparently, the issue also appears on Ubuntu 16.04.2 with gcc@5.4.0.
> So it looks like it’s not related to macOS and/or apple’s Clang or headers.
>
> Below is the error with the invocation line. Although it could indeed be due
> to some issues with ncurses,
> at the moment I don’t see any indication that this is the case. That is
> because ncurses is used (inderectly) in
> many other packages (cmake, boost, etc) and everything builds fine and runs
> ok.
>
> Is there anything one could further investigate here? Maybe some configure
> flag has to be added to Gnuplot?
>
>
> It looks to me that the compiler is mistakenly resolving
> #include "term.h"
> to
> /home/user/spack/opt/spack/linux-ubuntu16-x86_64/gcc-5.4.0/ncurses-6.0-edxtvp6xypxklibesnv2z5gstx3rat7a/include/term.h
> rather than to
> <build-dir>/src/term.h
>
> That is, it is pulling in a file "term.h" from the ncurses package when it
> should
> be pulling in a file with the same name from the gnuplot source directory.
>
> Why?   No idea.
>
> Ethan
>
>

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
gnuplot-info mailing list
[hidden email]
Membership management via: https://lists.sourceforge.net/lists/listinfo/gnuplot-info
Loading...