Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#6173 closed defect (fixed)

tor-0.2.3.17 fails to compile FreeBSD 8x

Reported by: grarpamp Owned by:
Priority: High Milestone: Tor: 0.2.3.x-final
Component: Core Tor/Tor Version: Tor: 0.2.3.17-beta
Severity: Keywords: tor-client
Cc: Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description

On FreeBSD 8x i386.
Note 0.2.3.16 is working fine.

checking size of int8_t... Segmentation fault (core dumped)
0
checking size of int16_t... Segmentation fault (core dumped)
0
checking size of int32_t... Segmentation fault (core dumped)
0
checking size of int64_t... Segmentation fault (core dumped)
0
checking size of uint8_t... Segmentation fault (core dumped)
0
checking size of uint16_t... Segmentation fault (core dumped)
0
checking size of uint32_t... Segmentation fault (core dumped)
0
checking size of uint64_t... Segmentation fault (core dumped)
0
checking size of intptr_t... Segmentation fault (core dumped)
0
checking size of uintptr_t... Segmentation fault (core dumped)
0
checking size of char... Segmentation fault (core dumped)
0
checking size of short... Segmentation fault (core dumped)
0
checking size of int... Segmentation fault (core dumped)
0
checking size of long... Segmentation fault (core dumped)
0
checking size of long long... Segmentation fault (core dumped)
0
checking size of int64... 0
checking size of void *... Segmentation fault (core dumped)
0
checking size of time_t... Segmentation fault (core dumped)
0
checking size of size_t... Segmentation fault (core dumped)
0

checking whether time_t is signed... Segmentation fault (core dumped)
yes
checking whether size_t is signed... Segmentation fault (core dumped)
yes
configure: error: You have a signed size_t; that's grossly nonconformant.
make: no target to make.
make: don't know how to make install. Stop

configure:9482: checking size of uint64_t
configure:9487: gcc -o conftest -g -O2 -D_FORTIFY_SOURCE=2 -fstack-protector-all -Wstack-protector -fwrapv -fPIE -static -I${top_srcdir}/src/common -static -pie -z relro -z now conftest.c -lpthread >&5
configure:9487: $? = 0
configure:9487: ./conftest
configure:9487: $? = 139
configure: program exited with status 139
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| #define PACKAGE "tor"
| #define VERSION "0.2.3.17-beta"
| #define ENABLE_BUF_FREELISTS 1
| #define ENABLE_THREADS 1
| #define FLEXIBLE_ARRAY_MEMBER //
| #define STDC_HEADERS 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_MEMORY_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_UNISTD_H 1
| #define HAVE_CLOCK_GETTIME 1
| #define HAVE_FLOCK 1
| #define HAVE_GETADDRINFO 1
| #define HAVE_GETIFADDRS 1
| #define HAVE_GETRLIMIT 1
| #define HAVE_GETTIMEOFDAY 1
| #define HAVE_GMTIME_R 1
| #define HAVE_INET_ATON 1
| #define HAVE_IOCTL 1
| #define HAVE_LOCALTIME_R 1
| #define HAVE_MEMMEM 1
| #define HAVE_SOCKETPAIR 1
| #define HAVE_STRLCAT 1
| #define HAVE_STRLCPY 1
| #define HAVE_STRPTIME 1
| #define HAVE_STRTOK_R 1
| #define HAVE_STRTOULL 1
| #define HAVE_SYSCONF 1
| #define HAVE_UNAME 1
| #define HAVE_VASPRINTF 1
| #define HAVE_MALLOC_USABLE_SIZE 1
| #define HAVE_PTHREAD_H 1
| #define HAVE_PTHREAD_CREATE 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_EVENT_GET_VERSION 1
| #define HAVE_EVENT_GET_VERSION_NUMBER 1
| #define HAVE_EVENT_GET_METHOD 1
| #define HAVE_EVENT_SET_LOG_CALLBACK 1
| #define HAVE_EVENT_BASE_LOOPEXIT 1
| #define HAVE_EVENT2_EVENT_H 1
| #define HAVE_EVENT2_DNS_H 1
| #define HAVE_EVENT2_BUFFEREVENT_SSL_H 1
| #define HAVE_ASSERT_H 1
| #define HAVE_ERRNO_H 1
| #define HAVE_FCNTL_H 1
| #define HAVE_SIGNAL_H 1
| #define HAVE_STRING_H 1
| #define HAVE_SYS_FCNTL_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_SYS_TIME_H 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_TIME_H 1
| #define HAVE_UNISTD_H 1
| #define HAVE_ARPA_INET_H 1
| #define HAVE_GRP_H 1
| #define HAVE_IFADDRS_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_LIMITS_H 1
| #define HAVE_MACHINE_LIMITS_H 1
| #define HAVE_MALLOC_NP_H 1
| #define HAVE_NETDB_H 1
| #define HAVE_NETINET_IN_H 1
| #define HAVE_PWD_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_SYS_FILE_H 1
| #define HAVE_SYS_IOCTL_H 1
| #define HAVE_SYS_LIMITS_H 1
| #define HAVE_SYS_MMAN_H 1
| #define HAVE_SYS_PARAM_H 1
| #define HAVE_SYS_RESOURCE_H 1
| #define HAVE_SYS_SOCKET_H 1
| #define HAVE_SYS_SYSLIMITS_H 1
| #define HAVE_SYS_TIME_H 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_UN_H 1
| #define HAVE_SYS_WAIT_H 1
| #define HAVE_SYSLOG_H 1
| #define HAVE_UTIME_H 1
| #define HAVE_SYS_PARAM_H 1
| #define HAVE_NET_IF_H 1
| #define HAVE_NET_PFVAR_H 1
| #define USE_TRANSPARENT 1
| #define HAVE_STRUCT_TIMEVAL_TV_SEC 1
| #define SIZEOF_INT8_T 0
| #define SIZEOF_INT16_T 0
| #define SIZEOF_INT32_T 0
| #define SIZEOF_INT64_T 0
| #define SIZEOF_UINT8_T 0
| #define SIZEOF_UINT16_T 0
| #define SIZEOF_UINT32_T 0
| /* end confdefs.h. */
| #include <stdio.h>
| #ifdef HAVE_SYS_TYPES_H
| # include <sys/types.h>
| #endif
| #ifdef HAVE_SYS_STAT_H
| # include <sys/stat.h>
| #endif
| #ifdef STDC_HEADERS
| # include <stdlib.h>
| # include <stddef.h>
| #else
| # ifdef HAVE_STDLIB_H
| # include <stdlib.h>
| # endif
| #endif
| #ifdef HAVE_STRING_H
| # if !defined STDC_HEADERS && defined HAVE_MEMORY_H
| # include <memory.h>
| # endif
| # include <string.h>
| #endif
| #ifdef HAVE_STRINGS_H
| # include <strings.h>
| #endif
| #ifdef HAVE_INTTYPES_H
| # include <inttypes.h>
| #endif
| #ifdef HAVE_STDINT_H
| # include <stdint.h>
| #endif
| #ifdef HAVE_UNISTD_H
| # include <unistd.h>
| #endif
| static long int longval () { return (long int) (sizeof (uint64_t)); }
| static unsigned long int ulongval () { return (long int) (sizeof (uint64_t)); }
| #include <stdio.h>
| #include <stdlib.h>
| int
| main ()
| {
|
| FILE *f = fopen ("conftest.val", "w");
| if (! f)
| return 1;
| if (((long int) (sizeof (uint64_t))) < 0)
| {
| long int i = longval ();
| if (i != ((long int) (sizeof (uint64_t))))
| return 1;
| fprintf (f, "%ld", i);
| }
| else
| {
| unsigned long int i = ulongval ();
| if (i != ((long int) (sizeof (uint64_t))))
| return 1;
| fprintf (f, "%lu", i);
| }
| /* Do not output a trailing newline, as this causes \r\n confusion
| on some platforms. */

| return ferror (f)
fclose (f) != 0;

|
| ;
| return 0;
| }
configure:9501: result: 0

Child Tickets

Attachments (1)

config.log.txt.gz (15.3 KB) - added by grarpamp 7 years ago.

Download all attachments as: .zip

Change History (14)

comment:1 Changed 7 years ago by rransom

config.log would be more useful; please attach it to the ticket, then add a comment so Trac will send a notification e-mail.

Do --disable-gcc-hardening and/or --disable-ld-hardening help?

comment:2 in reply to:  1 Changed 7 years ago by rransom

Replying to rransom:

config.log would be more useful; please attach it to the ticket, then add a comment so Trac will send a notification e-mail.

Sorry -- I didn't recognize that list of definitions as part of a config.log excerpt. Still, that piece of it doesn't seem to contain any useful information.

comment:3 Changed 7 years ago by grarpamp

Putting that test code into a.c. After trimming gcc line down,
removing either -static or -pie works. The bt is not useful.
gcc -g -Wall -pedantic -ansi -O2 -static -pie -o a a.c ; ./a ; echo $?
Appears conflict in generated compiler flags.
Will gather config.log, and try those two as that was the change
in this ver.

comment:4 Changed 7 years ago by grarpamp

This is the only option required to make things work cleanly:

--disable-gcc-hardening

I necessarily use static, and via the more commonly seen configure 'environment' approach:

CPPFLAGS=-static LDFLAGS=-static ./configure

Behaviour without -static, or with any/all of --enable-static-*, is as yet untested.

Changed 7 years ago by grarpamp

Attachment: config.log.txt.gz added

comment:5 Changed 7 years ago by grarpamp

Tested with exactly...
./configure : works
./configure --enable-static-tor : fails unless --disable-gcc-hardening
environment static ./configure : fails unless --disable-gcc-hardening
So as related to the trimmed test case, gcc-hardening does not like static.

For the readers, it's --disable-linker-hardening, not 'ld'.

Since we're mucking in configure... this has been present for a while now...

configure: WARNING: sys/syslimits.h: accepted by the compiler, rejected by the preprocessor!
configure: WARNING: sys/syslimits.h: proceeding with the compiler's result

comment:6 Changed 7 years ago by nickm

This is related to #5120

It looks like the linker finishes, but build unrunnable programs, which makes the rest of the configrue script run amok.

Possible solution if we're not cross-compiling, we might need to change our linker-flag check to do AC_TRY_RUN rather than AC_TRY_LINK.

comment:7 in reply to:  6 Changed 7 years ago by nickm

Replying to nickm:

This is related to #5120

Oops. I meant #5210

comment:8 Changed 7 years ago by nickm

Status: newneeds_review

Please test the (only semi-tested) branch "bug6173" in my public repository. It might fix this.

comment:9 Changed 7 years ago by grarpamp

I'd think some people cross-compile, especially embeddeds.
Only other way might be magic in Makefile for manipulation by make.
Anyway...
git: 3b88721d2945a24bda3b79b51be93e4b16b24cf2
Both dynamic and static work ok (configure, make, run).

From configure... dynamic on left, static on right:

< checking whether the linker accepts -pie... yes

checking whether the linker accepts -pie... Segmentation fault (core dumped)
no

Also, this yields a bunch of these with autoreconf -fiv, it's not present in 0.2.3.17 release...

configure.in:582: warning: AC_LANG_CONFTEST: no AC_LANG_SOURCE call detected in body
../../lib/autoconf/lang.m4:194: AC_LANG_CONFTEST is expanded from...
../../lib/autoconf/general.m4:2730: _AC_RUN_IFELSE is expanded from...
../../lib/m4sugar/m4sh.m4:606: AS_IF is expanded from...
../../lib/autoconf/general.m4:2749: AC_RUN_IFELSE is expanded from...
../../lib/m4sugar/m4sh.m4:606: AS_IF is expanded from...
../../lib/autoconf/general.m4:2032: AC_CACHE_VAL is expanded from...
../../lib/autoconf/general.m4:2053: AC_CACHE_CHECK is expanded from...
acinclude.m4:65: TOR_CHECK_LDFLAGS is expanded from...

comment:10 Changed 7 years ago by nickm

ok; I can clear up that warning with a little AC_LANG_PROGRAM. I'm still not sure this is the right approach, but as with so many things in autotools, the perfect is the enemy of the working. Updating a new "bug6173", testing it in a couple places, and then merging.

comment:11 Changed 7 years ago by nickm

Resolution: fixed
Status: needs_reviewclosed

comment:12 Changed 7 years ago by nickm

Keywords: tor-client added

comment:13 Changed 7 years ago by nickm

Component: Tor ClientTor
Note: See TracTickets for help on using tickets.