Opened 15 months ago

Last modified 3 months ago

#26460 reopened defect

Some? autoconf tests that include stdio.h fail with a missing ssp.h on cygwin

Reported by: teor Owned by:
Priority: Medium Milestone: Tor: unspecified
Component: Core Tor/Tor Version: Tor: 0.3.3.1-alpha
Severity: Normal Keywords: regression, 035-backport, 040-backport
Cc: Actual Points:
Parent ID: #26356 Points:
Reviewer: Sponsor:

Description

It looks like ssp doesn't actually work on cygwin.
We should fix the ssp test so it includes studio.h and fails.

configure:10546: checking whether the compiler accepts -fstack-protector-all
configure:10565: gcc -c -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -pedantic -Werror -fstack-protector-all  -I${top_srcdir}/src/common conftest.c >&5
configure:10565: $? = 0
configure:10584: gcc -o conftest.exe -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -pedantic -Werror -fstack-protector-all  -I${top_srcdir}/src/common  conftest.c  >&5
configure:10584: $? = 0
configure:10596: result: yes
configure:10622: checking whether the compiler accepts -Wstack-protector
configure:10641: gcc -c -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector-all -pedantic -Werror -Wstack-protector  -I${top_srcdir}/src/common conftest.c >&5
configure:10641: $? = 0
configure:10672: result: yes
configure:10685: checking whether the compiler accepts --param ssp-buffer-size=1
configure:10704: gcc -c -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector-all -Wstack-protector -pedantic -Werror --param ssp-buffer-size=1  -I${top_srcdir}/src/common conftest.c >&5
configure:10704: $? = 0
configure:10735: result: yes
configure:10749: checking whether the compiler accepts -fPIE
configure:10768: gcc -c -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector-all -Wstack-protector --param ssp-buffer-size=1 -pedantic -Werror -fPIE  -I${top_srcdir}/src/common conftest.c >&5
configure:10768: $? = 0
configure:10799: result: yes
configure:10811: checking whether the linker accepts -pie
configure:10854: gcc -o conftest.exe -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector-all -Wstack-protector --param ssp-buffer-size=1 -fPIE -pedantic -Werror  -I${top_srcdir}/src/common     -pie conftest.c  -lz  -levent -lssl -lcrypto      >&5
In file included from /usr/include/stdio.h:800,
                 from conftest.c:78:
/usr/local/lib/gcc/x86_64-unknown-cygwin/8.1.0/include/ssp/stdio.h:38:10: fatal error: ssp.h: No such file or directory
 #include <ssp.h>
          ^~~~~~~
compilation terminated.
configure:10854: $? = 1
configure: program exited with status 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "tor"
| #define PACKAGE_TARNAME "tor"
| #define PACKAGE_VERSION "0.3.3.7"

(similar macros)

| #define STDC_HEADERS 1
| #define HAVE_SYS_TYPES_H 1

(similar macros)

| /* end confdefs.h.  */
| #include <stdio.h>
| int
| main ()
| {
| fputs("", stdout)
|   ;
|   return 0;
| }
configure:10868: result: no

Child Tickets

Change History (14)

comment:1 Changed 15 months ago by rolex0815

Just adding, file is present:

me@i7t /usr/local/lib/gcc/x86_64-unknown-cygwin/8.1.0/include/ssp
$ ll
total 20K
-rw-r--r-- 1 me Kein 2.4K May 21 17:11 ssp.h
-rw-r--r-- 1 me Kein 3.4K May 21 17:11 stdio.h
-rw-r--r-- 1 me Kein 5.6K May 21 17:11 string.h
-rw-r--r-- 1 me Kein 2.8K May 21 17:11 unistd.h

comment:2 Changed 15 months ago by teor

Status: newneeds_information

Ok, so I think your preprocessor is broken.
About half the time, it falils when including ssp.h. And the rest of the time, it succeeds.

configure:10878: checking whether the compiler accepts -fwrapv
configure:10897: gcc -c -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector-all -Wstack-protector --param ssp-buffer-size=1 -fPIE -pedantic -Werror -fwrapv  -I${top_srcdir}/src/common conftest.c >&5
configure:10897: $? = 0
configure:10916: gcc -o conftest.exe -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector-all -Wstack-protector --param ssp-buffer-size=1 -fPIE -pedantic -Werror -fwrapv  -I${top_srcdir}/src/common  conftest.c  >&5
configure:10916: $? = 0
configure:10928: result: yes
configure:11284: checking whether the linker accepts -z relro -z now
configure:11327: gcc -o conftest.exe -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector-all -Wstack-protector --param ssp-buffer-size=1 -fPIE -pedantic -Werror  -I${top_srcdir}/src/common     -z relro -z now conftest.c  -lz  -levent -lssl -lcrypto      >&5
In file included from /usr/include/stdio.h:800,
                 from conftest.c:78:
/usr/local/lib/gcc/x86_64-unknown-cygwin/8.1.0/include/ssp/stdio.h:38:10: fatal error: ssp.h: No such file or directory
 #include <ssp.h>
          ^~~~~~~
compilation terminated.
configure:11327: $? = 1
configure: program exited with status 1
configure: failed program was:

(similar to the last one)

Please try re-running configure, after deleting the config cache.
Then run a diff between the two logs.

If there are a lot of differences between the logs, then your preprocessor is failing on arbitrary inputs.
If the logs are identical, it's failing based on some characteristic of the input files.

Please also retry running configure with stack smashing protection off.

Then, please make sure you have enough available file descriptors, disk space, RAM, etc., then reinstall Cygwin, and try again.

comment:3 Changed 15 months ago by teor

Summary: All autoconf tests that include studio.h fail with a missing ssp.h on cygwinSome? autoconf tests that include studio.h fail with a missing ssp.h on cygwin

comment:4 Changed 15 months ago by nickm

Is this new with 0.3.3, or did 0.3.2 have the same issue?

comment:5 Changed 15 months ago by nickm

Summary: Some? autoconf tests that include studio.h fail with a missing ssp.h on cygwinSome? autoconf tests that include stdio.h fail with a missing ssp.h on cygwin

comment:6 in reply to:  4 Changed 15 months ago by teor

Replying to nickm:

Is this new with 0.3.3, or did 0.3.2 have the same issue?

Apparently 0.3.2 worked, but I want to confirm it's not a compiler upgrade issue:

https://trac.torproject.org/projects/tor/ticket/26356#comment:7

comment:7 Changed 15 months ago by nickm

I tried searching for this issue, and apparently ssp/stdio.h is *not* the include file you want the compiler to be finding: https://stackoverflow.com/questions/27824139/cygwin-gcc-cannot-find-stdio-h

comment:8 Changed 15 months ago by teor

Hi rolex0815,

Can you please check that you have cygwin-devel installed?

You can use these commands:

cygcheck -f /usr/include/stdio.h
cygcheck -c cygwin-devel
cygcheck -l cygwin-devel | grep stdio

If it isn't installed, please install it and try building 0.3.3 and 0.3.2 again.
If it is installed, please try building 0.3.2 again.

comment:9 Changed 13 months ago by nickm

Resolution: user disappeared
Status: needs_informationclosed

comment:10 Changed 6 months ago by rolex0815

I'm sorry, forgot about the issue and stayed at 0.3.2.9.

Here's the desired information:

$ cygcheck -f /usr/include/stdio.h
cygwin-devel-3.0.5-1

$ cygcheck -c cygwin-devel
Cygwin Package Information
Package              Version        Status
cygwin-devel         3.0.5-1        OK

$ cygcheck -l cygwin-devel | grep stdio
/usr/include/stdio.h
/usr/include/stdio_ext.h
/usr/include/ssp/stdio.h
/usr/include/sys/stdio.h

comment:11 Changed 6 months ago by rolex0815

I just tried now with 0.3.5.8, it still fails. Here are the last snippets:

make  all-am
make[1]: Entering directory '/cygdrive/f/tor-0.3.5.8'
  CC       src/app/main/main.o
In file included from ./src/core/or/or.h:16,
                 from src/app/main/main.c:12:
./src/lib/cc/torint.h:44:2: error: #error "Can't define ssize_t."
 #error "Can't define ssize_t."
  ^~~~~
In file included from /usr/include/strings.h:77,
                 from /usr/include/string.h:24,
                 from ./src/lib/arch/bytes.h:16,
                 from ./src/core/or/or.h:25,
                 from src/app/main/main.c:12:
/usr/include/ssp/strings.h:50:23: error: expected declaration specifiers or '...' before 'explicit_bzero'
 __ssp_redirect0(void, explicit_bzero, (void *__buf, size_t __len), \
                       ^~~~~~~~~~~~~~
/usr/include/ssp/strings.h:50:39: error: expected declaration specifiers or '...' before '(' token
 __ssp_redirect0(void, explicit_bzero, (void *__buf, size_t __len), \
                                       ^
/usr/include/ssp/strings.h:51:5: error: expected declaration specifiers or '...' before '(' token
     (__buf, __len));
     ^
In file included from /usr/include/string.h:180,
                 from ./src/lib/arch/bytes.h:16,
                 from ./src/core/or/or.h:25,
                 from src/app/main/main.c:12:
/usr/local/lib/gcc/x86_64-unknown-cygwin/8.3.0/include/ssp/string.h:38:10: fatal error: ssp.h: No such file or directory
 #include <ssp.h>
          ^~~~~~~
compilation terminated.
make[1]: *** [Makefile:9877: src/app/main/main.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: Leaving directory '/cygdrive/f/tor-0.3.5.8'
make: *** [Makefile:5788: all] Error 2

comment:12 Changed 6 months ago by teor

Keywords: 034-backport 035-backport 040-backport added; 033-backport removed
Milestone: Tor: 0.3.4.x-finalTor: unspecified
Resolution: user disappeared
Status: closedreopened

Thanks for the info!

It's going to be hard for us to reproduce this issue, because none of the core developers have Cygwin.
We're probably going to need a volunteer with Cygwin to fix it.

comment:13 Changed 6 months ago by rolex0815

I even think it's maybe compiler related on my side. Because now, also the once successful compiled 0.3.2.9 version fails to compile, same errors about ssp and "Can't define ssize_t."

But a lot of other source packages just compile fine - maybe it's about "libssp", but I'm not sure.


I did a new cygwin installation with the "stock" compiler, it's gcc 7.4.0 (I'm using 8.3.0) and with this version tor is successfully compiled:

Apr 03 10:56:34.814 [notice] Tor 0.3.5.8 running on CYGWIN_NT-10.0-17763 with Libevent 2.0.22-stable, OpenSSL 1.1.1b, Zlib 1.2.11, Liblzma 5.2.4, and Libzstd N/A.

So it's definitely a compiler issue on my side.

Last edited 6 months ago by rolex0815 (previous) (diff)

comment:14 Changed 3 months ago by nickm

Keywords: 034-backport removed

Removing 034-backport from all open tickets: 034 has reached EOL.

Note: See TracTickets for help on using tickets.