tor's configure script is failing on armv7:

checking size of short... (cached) 2
checking size of int... configure: error: in 
`/usr/ports/pobj/tor-0.3.2.10/tor-0.3.2.10':
configure: error: cannot compute sizeof (int)
See `config.log' for more details

The underlying error shows up at mulitple places in config.log,
and looks like:

configure:12618: cc -o conftest -O2 -pipe -fasynchronous-unwind-tables  
-I${top_srcdir}/src/common  -z relro -z now -rdynamic conftest.c
 -lpthread  >&5
/tmp/conftest-9c413e.o:(.ARM.exidx+0x0): undefined reference to 
`__aeabi_unwind_cpp_pr1'
cc: error: linker command failed with exit code 1 (use -v to see invocation)
configure:12618: $? = 1
configure: program exited with status 1

Note that the error shows up during other tests in the configure
script as well, not just this 'size of int' check. It seems we
are lucky that we didn't get silent failures only.

I am not sure what __aeabi_unwind_cpp_pr1 is about, and whether there is
a deeper issue to fix. This seems related to -fasynchronous-unwind-table
which according to the tor changelog has something to do with backtrace
support:

  o Minor bugfixes (backtrace support):
    - Support automatic backtraces on more platforms by using the
      "-fasynchronous-unwind-tables" compiler option. This option is
      needed for platforms like 32-bit Intel where "-fomit-frame-pointer"
      is on by default and table generation is not. This doesn't yet
      add Windows support; only Linux, OSX, and some BSDs are affected.
      Reported by 'cypherpunks'; fixes bug 11047; bugfix on 0.2.5.2-alpha.

If I simply remove this compiler flag the configure script finishes fine.

Is this a good fix?


Index: Makefile
===================================================================
RCS file: /cvs/ports/net/tor/Makefile,v
retrieving revision 1.111
diff -u -p -r1.111 Makefile
--- Makefile    4 Mar 2018 14:05:06 -0000       1.111
+++ Makefile    25 Apr 2018 11:45:57 -0000
@@ -15,7 +15,8 @@ WANTLIB += c crypto event_core event_ext
 
 MASTER_SITES=  https://www.torproject.org/dist/
 
-CONFIGURE_STYLE=gnu
+AUTOCONF_VERSION=2.69
+CONFIGURE_STYLE=gnu autoconf
 # PIE is already taken care of on a per-arch basis, and we have stack 
protection
 # anyway on FRAME_GROWS_DOWN archs.
 CONFIGURE_ARGS=        --with-ssl-dir=/usr \
Index: patches/patch-configure_ac
===================================================================
RCS file: patches/patch-configure_ac
diff -N patches/patch-configure_ac
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-configure_ac  25 Apr 2018 11:46:27 -0000
@@ -0,0 +1,19 @@
+$OpenBSD$
+disable -fasynchronous-unwind-tables as it breaks build on armv7
+Index: configure.ac
+--- configure.ac.orig
++++ configure.ac
+@@ -1081,13 +1081,6 @@ fi
+ CFLAGS="$saved_CFLAGS"
+ AC_SUBST(F_OMIT_FRAME_POINTER)
+ 
+-dnl ------------------------------------------------------
+-dnl If we are adding -fomit-frame-pointer (or if the compiler's doing it
+-dnl for us, as GCC 4.6 and later do at many optimization levels), then
+-dnl we should try to add -fasynchronous-unwind-tables so that our backtrace
+-dnl code will work.
+-TOR_CHECK_CFLAGS(-fasynchronous-unwind-tables)
+-
+ dnl ============================================================
+ dnl Check for libseccomp
+ 
Index: patches/patch-src_config_torrc_sample_in
===================================================================
RCS file: /cvs/ports/net/tor/patches/patch-src_config_torrc_sample_in,v
retrieving revision 1.19
diff -u -p -r1.19 patch-src_config_torrc_sample_in
--- patches/patch-src_config_torrc_sample_in    10 Jan 2018 14:35:49 -0000      
1.19
+++ patches/patch-src_config_torrc_sample_in    25 Apr 2018 11:10:43 -0000
@@ -37,7 +37,7 @@ Index: src/config/torrc.sample.in
  #HiddenServicePort 80 127.0.0.1:80
  #HiddenServicePort 22 127.0.0.1:22
  
-@@ -198,6 +198,8 @@
+@@ -204,6 +204,8 @@
  ## and any public IPv4 and IPv6 addresses on any interface on the relay.
  ## See the man page entry for ExitPolicyRejectPrivate if you want to allow
  ## "exit enclaving".

Reply via email to