Bug 202586 - mail/thunderbird fail to build/wrong CFLAGS sse2 on i386
Summary: mail/thunderbird fail to build/wrong CFLAGS sse2 on i386
Status: Closed Not A Bug
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: i386 Any
: --- Affects Some People
Assignee: freebsd-gecko (Nobody)
URL:
Keywords:
Depends on:
Blocks: 198738
  Show dependency treegraph
 
Reported: 2015-08-23 09:31 UTC by sasamotikomi
Modified: 2015-08-28 17:26 UTC (History)
1 user (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description sasamotikomi 2015-08-23 09:31:32 UTC
c++ -o nsUTF8ToUnicodeSSE2.o -c -I../../dist/stl_wrappers -I../../dist/system_wrappers -include /usr/ports/mail/thunderbird/work/comm-esr38/mozilla/config/gcc_hidden.h -DSTATIC_EXPORTABLE_JS_API -DMOZILLA_INTERNAL_API -DIMPL_LIBXUL -DMOZ_GLUE_IN_PROGRAM -DAB_CD=en-US -DNO_NSPR_10_SUPPORT -I/usr/ports/mail/thunderbird/work/comm-esr38/mozilla/intl/uconv -I. -I/usr/ports/mail/thunderbird/work/comm-esr38/mozilla/intl/uconv/ucvcn -I/usr/ports/mail/thunderbird/work/comm-esr38/mozilla/intl/uconv/ucvja -I/usr/ports/mail/thunderbird/work/comm-esr38/mozilla/intl/uconv/ucvko -I/usr/ports/mail/thunderbird/work/comm-esr38/mozilla/intl/uconv/ucvlatin -I/usr/ports/mail/thunderbird/work/comm-esr38/mozilla/intl/uconv/ucvtw -I/usr/ports/mail/thunderbird/work/comm-esr38/mozilla/intl/uconv/util -I../../dist/include   -I/usr/local/include/nspr -I/usr/local/include/nss -I/usr/local/include/nss/nss -I/usr/local/include -I/usr/local/include  -I/usr/local/include/pixman-1     -fPIC  -Qunused-arguments -isystem/usr/local/include -DLIBICONV_PLUG  -DMOZILLA_CLIENT -include ../../mozilla-config.h -MD -MP -MF .deps/nsUTF8ToUnicodeSSE2.o.pp -Qunused-arguments -isystem/usr/local/include -DLIBICONV_PLUG  -Qunused-arguments -Wall -Wempty-body -Woverloaded-virtual -Wsign-compare -Wwrite-strings -Wno-invalid-offsetof -Wno-inline-new-delete -Wno-c++0x-extensions -Wno-extended-offsetof -Wno-unknown-warning-option -Wno-return-type-c-linkage -O2 -pipe -march=athlon-xp -O3 -DLIBICONV_PLUG -fno-strict-aliasing -DLIBICONV_PLUG -fno-exceptions -fno-strict-aliasing -fno-rtti -ffunction-sections -fdata-sections -fno-exceptions -fno-math-errno -std=gnu++0x -pipe  -DNDEBUG -DTRIMMED -O2 -O3 -fomit-frame-pointer   -msse2  /usr/ports/mail/thunderbird/work/comm-esr38/mozilla/intl/uconv/nsUTF8ToUnicodeSSE2.cpp
/usr/ports/mail/thunderbird/work/comm-esr38/mozilla/intl/uconv/nsUTF8ToUnicodeSSE2.cpp:8:10: fatal error: 'emmintrin.h' file not found
#include <emmintrin.h>
         ^
1 error generated.
/usr/ports/mail/thunderbird/work/comm-esr38/mozilla/config/rules.mk:930: recipe for target 'nsUTF8ToUnicodeSSE2.o' failed
gmake[6]: *** [nsUTF8ToUnicodeSSE2.o] Error 1
gmake[6]: Leaving directory '/usr/ports/mail/thunderbird/work/comm-esr38/obj-i386-portbld-freebsd10.1/intl/uconv'
/usr/ports/mail/thunderbird/work/comm-esr38/mozilla/config/recurse.mk:74: recipe for target 'intl/uconv/target' failed
gmake[5]: *** [intl/uconv/target] Error 2
gmake[5]: Leaving directory '/usr/ports/mail/thunderbird/work/comm-esr38/obj-i386-portbld-freebsd10.1'
/usr/ports/mail/thunderbird/work/comm-esr38/mozilla/config/recurse.mk:36: recipe for target 'compile' failed
gmake[4]: *** [compile] Error 2
gmake[4]: Leaving directory '/usr/ports/mail/thunderbird/work/comm-esr38/obj-i386-portbld-freebsd10.1'
/usr/ports/mail/thunderbird/work/comm-esr38/mozilla/config/rules.mk:541: recipe for target 'default' failed
gmake[3]: *** [default] Error 2
gmake[3]: Leaving directory '/usr/ports/mail/thunderbird/work/comm-esr38/obj-i386-portbld-freebsd10.1'
/usr/ports/mail/thunderbird/work/comm-esr38/client.mk:404: recipe for target 'build' failed
gmake[2]: *** [build] Error 2
gmake[2]: Leaving directory '/usr/ports/mail/thunderbird/work/comm-esr38'
*** Error code 1

Stop.
make[1]: stopped in /usr/ports/mail/thunderbird
*** Error code 1

Wrong CFLAGS "sse2" on 32-bit processor and few duplicated CFLAGS.
Comment 1 Jan Beich freebsd_committer freebsd_triage 2015-08-23 17:56:36 UTC
What kind of toolchain are you using? -Qunused-arguments suggests Clang of unknown version. Check it's not broken:

  $ cat a.c
  #include <emmintrin.h>

  int main() {}

  $ cc -msse2 a.c
  $ cc -march=athlon-xp -msse2 a.c

  $ cc -msse2 -dM -E -</dev/null | fgrep SSE
  $ cc -march=athlon-xp -msse2 -dM -E -</dev/null | fgrep SSE

  $ find /usr/include /usr/lib/clang -name emmintrin.h
  /usr/include/clang/3.4.1/emmintrin.h
  [or]
  /usr/lib/clang/3.6.1/include/emmintrin.h

Gecko uses SSE2 only when CPU supports it with the check done at runtime. The *optional* bits providing optimized routines are required to be built with -msse2 flag. If SSE2 is used unconditionally somewhere Firefox would crash, not fail to build.

https://dxr.mozilla.org/mozilla-central/source/intl/uconv/nsUTF8ToUnicode.cpp#170
https://dxr.mozilla.org/mozilla-central/source/mozglue/build/SSE.h#103
Comment 2 sasamotikomi 2015-08-28 15:53:12 UTC
(In reply to Jan Beich from comment #1)
Default clang (cc -v
FreeBSD clang version 3.4.1 (tags/RELEASE_34/dot1-final 208032) 20140512
Target: i386-unknown-freebsd10.1
Thread model: posix
Selected GCC installation: )
 cc -msse2 a.c

a.c:1:10: fatal error: 'emmintrin.h' file not found
#include <emmintrin.h>
         ^
1 error generated.

cc -march=athlon-xp -msse2 a.c

a.c:1:10: fatal error: 'emmintrin.h' file not found
#include <emmintrin.h>
         ^
1 error generated.

cc -msse2 -dM -E -</dev/null | fgrep SSE

#define __SSE2_MATH__ 1
#define __SSE2__ 1
#define __SSE_MATH__ 1
#define __SSE__ 1

cc -march=athlon-xp -msse2 -dM -E -</dev/null | fgrep SSE
#define __SSE2_MATH__ 1
#define __SSE2__ 1
#define __SSE_MATH__ 1
#define __SSE__ 1

find /usr/include /usr/lib/clang -name emmintrin.h
find: /usr/lib/clang: No such file or directory

find /usr/include  -name emmintrin.h

find / -name emmintrin.h
/usr/local/lib/gcc48/gcc/i386-portbld-freebsd10.1/4.8.5/include/emmintrin.h
/usr/local/lib/gcc46/gcc/i386-portbld-freebsd10.0/4.6.4/include/emmintrin.h
/usr/local/llvm36/lib/clang/3.6.2/include/emmintrin.h
Comment 3 Jan Beich freebsd_committer freebsd_triage 2015-08-28 17:26:44 UTC
So, your toolchain is indeed broken as one or more clang headers are
missing. Most likely due to a pilot error. Better ask for an advice
how to recover on freebsd-questions@ maillist.

(In reply to sasamotikomi from comment #2)
> Target: i386-unknown-freebsd10.1
[...]
> find /usr/include /usr/lib/clang -name emmintrin.h
> find: /usr/lib/clang: No such file or directory

How did you end up on 10.1? Was it clean install or an upgrade?
Perhaps, something went wrong during a major version upgrade or when
switching branches (e.g. -CURRENT to -STABLE).

  # my poudriere jail for 10.1-RELEASE-p19 i386
  $ find /usr/include /usr/lib/clang -name emmintrin.h
  /usr/include/clang/3.4.1/emmintrin.h
  find: /usr/lib/clang: No such file or directory

  # my poudriere jail for 9.3-RELEASE-p24 i386
  $ find /usr/include /usr/lib/clang -name emmintrin.h
  /usr/include/clang/3.4.1/emmintrin.h
  /usr/include/gcc/4.2/emmintrin.h
  find: /usr/lib/clang: No such file or directory

If you have /usr/src populated try reinstalling just headers and
comparing the list of files.

  $ mv /usr/include /usr/include.old
  $ make distrib-dirs -C /usr/src
  $ make installincludes -C /usr/src
  $ (cd /usr/include.old && find . | sort) >old.list
  $ (cd /usr/include && find . | sort) >new.list
  $ diff -u old.list new.list