Solved Thunderbird build failure on vbox guest running 12.1

Hello,

I'm getting errors when building thunderbird from ports:

Code:
In file included from /usr/ports/mail/thunderbird/work/thunderbird-68.8.0/gfx/skia/skia/src/core/SkOpts.cpp:44:
/usr/ports/mail/thunderbird/work/thunderbird-68.8.0/gfx/skia/skia/src/opts/SkRasterPipeline_opts.h:346:16: error: always_inline function '_mm256_fmadd_ps' requires target feature 'fma', but would be inlined into function 'mad' that is compiled without support for 'fma'
       return _mm256_fmadd_ps(f,m,a);
              ^
/usr/ports/mail/thunderbird/work/thunderbird-68.8.0/gfx/skia/skia/src/opts/SkRasterPipeline_opts.h:816:12: error: always_inline function '_mm256_cvtph_ps' requires target feature 'f16c', but would be inlined into function 'from_half' that is compiled without support for 'f16c'
   return _mm256_cvtph_ps(h);
          ^
/usr/ports/mail/thunderbird/work/thunderbird-68.8.0/gfx/skia/skia/src/opts/SkRasterPipeline_opts.h:837:12: error: '__builtin_ia32_vcvtps2ph256' needs target feature f16c
   return _mm256_cvtps_ph(f, _MM_FROUND_CUR_DIRECTION);
          ^
/usr/local/llvm90/lib/clang/9.0.1/include/f16cintrin.h:139:11: note: expanded from macro '_mm256_cvtps_ph'
(__m128i)__builtin_ia32_vcvtps2ph256((__v8sf)(__m256)(a), (imm))
         ^
3 errors generated.

This is on a virtualbox guest running 12.1 where everything is installed from ports via portsnap & portmaster. Host is a mac laptop running VirtualBox 6.1.

I've tried using the default set of config options with and without OPTIMIZED_CFLAGS set. Same errors.

Hints, questions, suggestions on how to get this building successfully greatly appreciated.

Thanks,
ksb
 
# grep -v ^# /etc/make.conf
CPUTYPE?=native
COPTFLAGS= -O -pipe
OPTIONS_UNSET=DOCS EXAMPLES HAL
 
Commenting that line out of /etc/make.conf and rebuilding just thunderbird results in the same error.
 
VirtualBox does not support the AVX instruction set, to which the _mm256_* commands belong to. Now the problem is that VB reports the capablilities of the host's CPU to the guest OS. For example on my i5-Mac mini running FreeBSD 12.1 in a VirtualBox:
Code:
...
CPU: Intel(R) Core(TM) i5-4278U CPU @ 2.60GHz (2600.07-MHz K8-class CPU)
  Origin="GenuineIntel"  Id=0x40651  Family=0x6  Model=0x45  Stepping=1
  Features=0x1783fbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,MMX,FXSR,SSE,SSE2,HTT>
  Features2=0x5eda220b<SSE3,PCLMULQDQ,MON,SSSE3,CX16,PCID,SSE4.1,SSE4.2,MOVBE,POPCNT,AESNI,XSAVE,OSXSAVE,AVX,RDRAND>
  AMD Features=0x28100800<SYSCALL,NX,RDTSCP,LM>
  AMD Features2=0x21<LAHF,ABM>
  Structured Extended Features=0x2421<FSGSBASE,AVX2,INVPCID,NFPUSG>
  Structured Extended Features3=0x10000400<MD_CLEAR,L1DFL>
  TSC: P-state invariant
...

Compilation using AVX instructions is most likely triggered by the compile time flag -march=native.
 
  • Thanks
Reactions: ksb
Thank you both so much. That was it. Commenting out the CPUTYPE?=native line fixed it.

Interestingly, thunderbird (and I think also firefox) have been the only ports so far to be caught by this. I even rebuilt kernel and world with that setting on. Maybe kernel & world builds ignore CPUTYPE?

Do you think it is safe to leave CPUTYPE?=native enabled and remove it for ports that use AVX instructions? Or might there be a way to specifically tell this VM that AVX is not supported?

This is my first real attempt at running FreeBSD as a guest in vbox. The handbook and wiki page have left a few key hints out that I've discovered the hard way. If anyone has a recommendation on a more complete list of setting for running FreeBSD as a guest in VBox, I'm all ears. Meanwhile here are my notes so far:

To get mouse clicks in X working
Read the messages for the xorg-server ( pkg info -D xorg-server) and:​
sysctl kern.evdev.rcpt_mask=6
or add to /etc/sysctl.conf
kern.evdev.rcpt_mask=6
To get window resize working

Thanks again,
ksb
 
Do you think it is safe to leave CPUTYPE?=native enabled and remove it for ports that use AVX instructions?
Don't set it at all unless you have a specific reason to do so.
 
Don't set it at all unless you have a specific reason to do so.
So my thinking in setting it is that since I'm building only for that specific machine, I might as well take advantage of whatever capabilities that specific CPU has. Clearly in the case of vbox mis-reporting capabilities it should be off, but that seems like a corner case.

I have it set on my FreeBSD box that runs as the native OS and don't think I've come across any problems related to it. Is there something else that I'm missing?
 
The system typically does a great job figuring things out on its own. Don't tune for the sake of tuning. Tune and tweak things to solve problems. Not the other way around.
 
Back
Top