Bug 216553 - archivers/snappy 1.1.4 don't compile on i386, 1.1.3 compiled fine
Summary: archivers/snappy 1.1.4 don't compile on i386, 1.1.3 compiled fine
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: i386 Any
: --- Affects Many People
Assignee: Vanilla I. Shu
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-01-28 18:32 UTC by VVD
Modified: 2017-01-31 01:53 UTC (History)
1 user (show)

See Also:
bugzilla: maintainer-feedback? (vanilla)


Attachments
archivers/snappy/files/patch-snappy.cc (303 bytes, text/x-c++src)
2017-01-28 19:06 UTC, VVD
no flags Details
Without any problem on my test env. (28.90 KB, text/plain)
2017-01-30 02:43 UTC, Vanilla I. Shu
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description VVD 2017-01-28 18:32:04 UTC
On amd64 compiled fine. USE_GCC=yes didn't help.

Build log from i386:
===>  License BSD3CLAUSE accepted by the user
===>  Found saved configuration for snappy-1.1.3
===>   snappy-1.1.4 depends on file: /usr/local/sbin/pkg - found
===> Fetching all distfiles required by snappy-1.1.4 for building
===>  Extracting for snappy-1.1.4
=> SHA256 Checksum OK for google-snappy-1.1.4_GH0.tar.gz.
===>  Patching for snappy-1.1.4
===>   snappy-1.1.4 depends on executable: autoconf-2.69 - found
===>   snappy-1.1.4 depends on executable: autoheader-2.69 - found
===>   snappy-1.1.4 depends on executable: autoreconf-2.69 - found
===>   snappy-1.1.4 depends on executable: aclocal-1.15 - found
===>   snappy-1.1.4 depends on executable: automake-1.15 - found
===>   snappy-1.1.4 depends on executable: libtoolize - found
===>   snappy-1.1.4 depends on package: pkgconf>=0.9.10 - found
===>  Configuring for snappy-1.1.4
libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, '.'.
libtoolize: copying file './ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'm4'.
libtoolize: copying file 'm4/libtool.m4'
libtoolize: copying file 'm4/ltoptions.m4'
libtoolize: copying file 'm4/ltsugar.m4'
libtoolize: copying file 'm4/ltversion.m4'
libtoolize: copying file 'm4/lt~obsolete.m4'
configure.ac:17: installing './compile'
configure.ac:17: installing './config.guess'
configure.ac:17: installing './config.sub'
configure.ac:15: installing './install-sh'
configure.ac:15: installing './missing'
/usr/local/share/automake-1.15/am/ltlibrary.am: warning: 'libsnappy.la': linking libtool libraries using a non-POSIX
/usr/local/share/automake-1.15/am/ltlibrary.am: archiver requires 'AM_PROG_AR' in 'configure.ac'
Makefile.am:4:   while processing Libtool library 'libsnappy.la'
Makefile.am: installing './depcomp'
parallel-tests: installing './test-driver'
configure: loading site script /usr/ports/Templates/config.site
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... (cached) /bin/mkdir -p
checking for gawk... (cached) /usr/bin/awk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking build system type... i386-portbld-freebsd11.0
checking host system type... i386-portbld-freebsd11.0
checking how to print strings... printf
checking for style of include used by make... GNU
checking for gcc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking whether cc understands -c and -o together... yes
checking dependency style of cc... gcc3
checking for a sed that does not truncate output... (cached) /usr/bin/sed
checking for grep that handles long lines and -e... (cached) /usr/bin/grep
checking for egrep... (cached) /usr/bin/egrep
checking for fgrep... (cached) /usr/bin/fgrep
checking for ld used by cc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/local/bin/nm -B
checking the name lister (/usr/local/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... (cached) 262144
checking how to convert i386-portbld-freebsd11.0 file names to i386-portbld-freebsd11.0 format... func_convert_file_noop
checking how to convert i386-portbld-freebsd11.0 file names to toolchain format... func_convert_file_noop
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @FILE support... no
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/local/bin/nm -B output from cc object... ok
checking for sysroot... no
checking for a working dd... /bin/dd
checking how to truncate binary pipes... /bin/dd bs=4096 count=1
checking for mt... mt
checking if mt is a manifest tool... no
checking how to run the C preprocessor... cpp
checking for ANSI C header files... (cached) yes
checking for sys/types.h... (cached) yes
checking for sys/stat.h... (cached) yes
checking for stdlib.h... (cached) yes
checking for string.h... (cached) yes
checking for memory.h... (cached) yes
checking for strings.h... (cached) yes
checking for inttypes.h... (cached) yes
checking for stdint.h... (cached) yes
checking for unistd.h... (cached) yes
checking for dlfcn.h... (cached) yes
checking for objdir... .libs
checking if cc supports -fno-rtti -fno-exceptions... yes
checking for cc option to produce PIC... -fPIC -DPIC
checking if cc PIC flag -fPIC -DPIC works... yes
checking if cc static flag -static works... yes
checking if cc supports -c -o file.o... yes
checking if cc supports -c -o file.o... (cached) yes
checking whether the cc linker (/usr/bin/ld) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... freebsd11.0 ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking whether we are using the GNU C++ compiler... yes
checking whether c++ accepts -g... yes
checking dependency style of c++... gcc3
checking how to run the C++ preprocessor... c++ -E
checking for ld used by c++... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking whether the c++ linker (/usr/bin/ld) supports shared libraries... yes
checking for c++ option to produce PIC... -fPIC -DPIC
checking if c++ PIC flag -fPIC -DPIC works... yes
checking if c++ static flag -static works... yes
checking if c++ supports -c -o file.o... yes
checking if c++ supports -c -o file.o... (cached) yes
checking whether the c++ linker (/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... freebsd11.0 ld.so
checking how to hardcode library paths into programs... immediate
checking whether byte ordering is bigendian... no
checking for size_t... (cached) yes
checking for ssize_t... (cached) yes
checking for stdint.h... (cached) yes
checking for stddef.h... (cached) yes
checking for sys/mman.h... (cached) yes
checking sys/resource.h usability... yes
checking sys/resource.h presence... yes
checking for sys/resource.h... yes
checking windows.h usability... no
checking windows.h presence... no
checking for windows.h... no
checking for byteswap.h... (cached) no
checking sys/byteswap.h usability... no
checking sys/byteswap.h presence... no
checking for sys/byteswap.h... no
checking sys/endian.h usability... yes
checking sys/endian.h presence... yes
checking for sys/endian.h... yes
checking for sys/time.h... (cached) yes
checking for mmap... (cached) yes
checking pkg-config is at least version 0.9.0... yes
checking for gflags... no
checking if the compiler supports __builtin_expect... yes
checking if the compiler supports __builtin_ctzll... yes
checking for zlibVersion in -lz... yes
checking for lzo1x_1_15_compress in -llzo2... no
checking for lzf_compress in -llzf... no
checking for fastlz_compress in -lfastlz... no
checking for qlz_compress in -lquicklz... no
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating snappy-stubs-public.h
config.status: creating snappy.pc
config.status: creating config.h
config.status: executing depfiles commands
config.status: executing libtool commands
===>  Building for snappy-1.1.4
--- all ---
/usr/bin/make  all-am
--- snappy.lo ---
--- snappy-sinksource.lo ---
--- snappy-stubs-internal.lo ---
--- snappy-c.lo ---
--- snappy.lo ---
/bin/sh ./libtool  --tag=CXX    --mode=compile c++ -DHAVE_CONFIG_H  -I.      -O2 -pipe -march=prescott -DNDEBUG -fstack-protector -fno-strict-aliasing -MT snappy.lo -MD -MP -MF .deps/snappy.Tpo -c -o snappy.lo snappy.cc
--- snappy-sinksource.lo ---
/bin/sh ./libtool  --tag=CXX    --mode=compile c++ -DHAVE_CONFIG_H  -I.      -O2 -pipe -march=prescott -DNDEBUG -fstack-protector -fno-strict-aliasing -MT snappy-sinksource.lo -MD -MP -MF .deps/snappy-sinksource.Tpo -c -o snappy-sinksource.lo snappy-sinksource.cc
--- snappy-stubs-internal.lo ---
/bin/sh ./libtool  --tag=CXX    --mode=compile c++ -DHAVE_CONFIG_H  -I.      -O2 -pipe -march=prescott -DNDEBUG -fstack-protector -fno-strict-aliasing -MT snappy-stubs-internal.lo -MD -MP -MF .deps/snappy-stubs-internal.Tpo -c -o snappy-stubs-internal.lo snappy-stubs-internal.cc
--- snappy-c.lo ---
/bin/sh ./libtool  --tag=CXX    --mode=compile c++ -DHAVE_CONFIG_H  -I.      -O2 -pipe -march=prescott -DNDEBUG -fstack-protector -fno-strict-aliasing -MT snappy-c.lo -MD -MP -MF .deps/snappy-c.Tpo -c -o snappy-c.lo snappy-c.cc
libtool: compile:  c++ -DHAVE_CONFIG_H -I. -O2 -pipe -march=prescott -DNDEBUG -fstack-protector -fno-strict-aliasing -MT snappy-c.lo -MD -MP -MF .deps/snappy-c.Tpo -c snappy-c.cc  -fPIC -DPIC -o .libs/snappy-c.o
--- snappy-sinksource.lo ---
libtool: compile:  c++ -DHAVE_CONFIG_H -I. -O2 -pipe -march=prescott -DNDEBUG -fstack-protector -fno-strict-aliasing -MT snappy-sinksource.lo -MD -MP -MF .deps/snappy-sinksource.Tpo -c snappy-sinksource.cc  -fPIC -DPIC -o .libs/snappy-sinksource.o
--- snappy-stubs-internal.lo ---
libtool: compile:  c++ -DHAVE_CONFIG_H -I. -O2 -pipe -march=prescott -DNDEBUG -fstack-protector -fno-strict-aliasing -MT snappy-stubs-internal.lo -MD -MP -MF .deps/snappy-stubs-internal.Tpo -c snappy-stubs-internal.cc  -fPIC -DPIC -o .libs/snappy-stubs-internal.o
--- snappy.lo ---
libtool: compile:  c++ -DHAVE_CONFIG_H -I. -O2 -pipe -march=prescott -DNDEBUG -fstack-protector -fno-strict-aliasing -MT snappy.lo -MD -MP -MF .deps/snappy.Tpo -c snappy.cc  -fPIC -DPIC -o .libs/snappy.o
--- snappy-sinksource.lo ---
libtool: compile:  c++ -DHAVE_CONFIG_H -I. -O2 -pipe -march=prescott -DNDEBUG -fstack-protector -fno-strict-aliasing -MT snappy-sinksource.lo -MD -MP -MF .deps/snappy-sinksource.Tpo -c snappy-sinksource.cc -o snappy-sinksource.o >/dev/null 2>&1
mv -f .deps/snappy-sinksource.Tpo .deps/snappy-sinksource.Plo
--- snappy_unittest-snappy_unittest.o ---
c++ -DHAVE_CONFIG_H -I.      -O2 -pipe -march=prescott -DNDEBUG -fstack-protector -fno-strict-aliasing -MT snappy_unittest-snappy_unittest.o -MD -MP -MF .deps/snappy_unittest-snappy_unittest.Tpo -c -o snappy_unittest-snappy_unittest.o `test -f 'snappy_unittest.cc' || echo './'`snappy_unittest.cc
--- snappy-stubs-internal.lo ---
libtool: compile:  c++ -DHAVE_CONFIG_H -I. -O2 -pipe -march=prescott -DNDEBUG -fstack-protector -fno-strict-aliasing -MT snappy-stubs-internal.lo -MD -MP -MF .deps/snappy-stubs-internal.Tpo -c snappy-stubs-internal.cc -o snappy-stubs-internal.o >/dev/null 2>&1
--- snappy-c.lo ---
libtool: compile:  c++ -DHAVE_CONFIG_H -I. -O2 -pipe -march=prescott -DNDEBUG -fstack-protector -fno-strict-aliasing -MT snappy-c.lo -MD -MP -MF .deps/snappy-c.Tpo -c snappy-c.cc -o snappy-c.o >/dev/null 2>&1
--- snappy.lo ---
snappy.cc:99:3: error: unknown type name '__m128i'
  __m128i x = _mm_loadu_si128(static_cast<const __m128i*>(src));
  ^
snappy.cc:99:49: error: unknown type name '__m128i'
  __m128i x = _mm_loadu_si128(static_cast<const __m128i*>(src));
                                                ^
snappy.cc:99:15: error: use of undeclared identifier '_mm_loadu_si128'
  __m128i x = _mm_loadu_si128(static_cast<const __m128i*>(src));
              ^
snappy.cc:100:32: error: unknown type name '__m128i'
  _mm_storeu_si128(static_cast<__m128i*>(dst), x);
                               ^
4 errors generated.
*** [snappy.lo] Error code 1

make[3]: stopped in /usr/obj/usr/ports/archivers/snappy/work/snappy-1.1.4
--- snappy-c.lo ---
mv -f .deps/snappy-c.Tpo .deps/snappy-c.Plo
--- snappy-stubs-internal.lo ---
mv -f .deps/snappy-stubs-internal.Tpo .deps/snappy-stubs-internal.Plo
--- snappy_unittest-snappy_unittest.o ---
mv -f .deps/snappy_unittest-snappy_unittest.Tpo .deps/snappy_unittest-snappy_unittest.Po
1 error

make[3]: stopped in /usr/obj/usr/ports/archivers/snappy/work/snappy-1.1.4
*** [all] Error code 2

make[2]: stopped in /usr/obj/usr/ports/archivers/snappy/work/snappy-1.1.4
1 error

make[2]: stopped in /usr/obj/usr/ports/archivers/snappy/work/snappy-1.1.4
===> Compilation failed unexpectedly.
Try to set MAKE_JOBS_UNSAFE=yes and rebuild before reporting the failure to
the maintainer.
*** Error code 1

Stop.
make[1]: stopped in /usr/ports/archivers/snappy
*** Error code 1

Stop.
make: stopped in /usr/ports/archivers/snappy
Comment 1 VVD 2017-01-28 18:32:53 UTC
11.0-RELEASE-p7
Comment 2 VVD 2017-01-28 19:06:00 UTC
Created attachment 179380 [details]
archivers/snappy/files/patch-snappy.cc

I made a patch fixed this bug:
--- snappy.cc.orig        2017-01-27 08:12:04
+++ snappy.cc
@@ -30,7 +30,7 @@
 #include "snappy-internal.h"
 #include "snappy-sinksource.h"
 
-#if defined(__x86_64__) || defined(_M_X64)
+#if defined(__x86_64__) || defined(_M_X64) || defined(__i386__)
 #include <emmintrin.h>
 #endif
 #include <stdio.h>
Comment 3 Vanilla I. Shu freebsd_committer 2017-01-30 02:43:43 UTC
Created attachment 179416 [details]
Without any problem on my test env.

I could not reproduce this issue on my box,
Comment 4 VVD 2017-01-30 03:33:39 UTC
Try to build on real i386 on real system - not in poudriere jail.

Small test for your poudriere jail:
#include <stdio.h>
int main() {
#ifdef __i386__
  printf("__i386__\n");
#endif
#if defined(__x86_64__) || defined(_M_X64)
  printf("__x86_64__\n");
#endif
  return 0;
}

On i386 it prints __i386__, on amd64 it prints __x86_64__, but not both on any platform.

__m128i defined in emmintrin.h.
Comment 5 Vanilla I. Shu freebsd_committer 2017-01-30 06:21:17 UTC
I think the main reason should be "-march=prescott"

it will enable SSE2 definition, but could not find m128i.

everything work fine with your patch?
Comment 6 VVD 2017-01-30 12:08:57 UTC
Yes, it's -march=prescott turn on __SSE__/__SSE2__, same as pentium4, core2 and etc.
And yes, everything work fine with my patch.

This patch is better:
--- snappy.cc.orig        2017-01-30 12:03:09
+++ snappy.cc
@@ -30,7 +30,7 @@
 #include "snappy-internal.h"
 #include "snappy-sinksource.h"
 
-#if defined(__x86_64__) || defined(_M_X64)
+#ifdef __SSE2__
 #include <emmintrin.h>
 #endif
 #include <stdio.h>
Comment 7 commit-hook freebsd_committer 2017-01-30 12:49:39 UTC
A commit references this bug:

Author: vanilla
Date: Mon Jan 30 12:49:22 UTC 2017
New revision: 432840
URL: https://svnweb.freebsd.org/changeset/ports/432840

Log:
  Fix building on i386 (with SSE2 enable)

  PR:		216553
  Submitted by:	vvd@unislabs.com

Changes:
  head/archivers/snappy/files/
  head/archivers/snappy/files/patch-snappy.cc
Comment 8 VVD 2017-01-30 13:12:35 UTC
Thanks.

I want to report patch to upstream, but can't find any bug tracker for it at https://github.com/google/snappy
Comment 9 Vanilla I. Shu freebsd_committer 2017-01-30 13:26:58 UTC
In github, use "pull request" to report bug or patches to upstream.
Comment 10 VVD 2017-01-30 17:16:43 UTC
Do I need to make self fork for this?
It's so stupid - make forks for 1 line patches.

Ok, no bug tracker - no user patches.
Comment 11 Vanilla I. Shu freebsd_committer 2017-01-31 01:53:06 UTC
Yep, fork it and pull request with your patch.