app-office/libreoffice-5.2.3.3 fails to build on one of my machines. The build process aborts with this error message: [CXX] vcl/opengl/scale.cxx S=/var/tmp/portage/app-office/libreoffice-5.2.3.3/work/libreoffice-5.2.3.3 && I=$S/instdir && W=$S/workdir && mkdir -p $W/CxxObject/vcl/opengl/ $W/Dep/CxxObject/vcl/open gl/ && cd /var/tmp/portage/app-office/libreoffice-5.2.3.3/work/libreoffice-5.2.3.3 && i686-pc-linux-gnu-g++ -DBOOST_ERROR_CODE_HEADER_ONLY -DBOOST_SYSTEM_NO_DEPRECATED -DCPPU_ENV=gcc3 -DINTEL -DLINUX -DNDEBUG -DOPTIMIZE -DOSL_DEBUG_LEVEL=0 -DUNIX -DUNX -DX86 -D_PTHREADS -D_REENTRANT -DVCL_DLLIMPLEMENTATION -DCUI_DLL_NAME=\"libcuilo.so \" -DDESKTOP_DETECTOR_DLL_NAME=\"libmergedlo.so\" -DTK_DLL_NAME=\"libmergedlo.so\" -DENABLE_MERGELIBS=1 -DSYSTEM_CURL -DSYSTEM_NSS -DSYSTEM_NSS -DENABLE_CUPS -DHAVE _GCC_VISIBILITY_FEATURE -fvisibility=hidden -Wall -Wno-missing-braces -Wnon-virtual-dtor -Wendif-labels -Wextra -Wundef -Wunused-macros -fmessage-length=0 -fno-common - pipe -fvisibility-inlines-hidden -fstack-protector-strong -fPIC -Wshadow -Woverloaded-virtual -std=gnu++14 -DEXCEPTIONS_ON -fexceptions -fno-enforce-eh-specs -O2 -marc h=native -mfpmath=sse -pipe -DLIBO_INTERNAL_ONLY -c $S/vcl/opengl/scale.cxx -o $W/CxxObject/vcl/opengl/scale.o -I$S/vcl/opengl/ -isystem /usr/include/mdds-1.2 -I$S/in clude -I$S/config_host -I$W/CustomTarget/officecfg/registry -I$W/CustomTarget/vcl/unx/generic/fontmanager -I$S/vcl/inc -I$W/UnoApiHeadersTarget/udkapi/normal -I$W/U noApiHeadersTarget/offapi/normal -I$W/CustomTarget/officecfg/registry -isystem /usr/include/nss -isystem /usr/include/nspr -isystem /usr/include/nss -isystem /usr/i nclude/nspr -I/usr/include -pthread -isystem /usr/include/glib-2.0 -isystem /usr/lib/glib-2.0/include -isystem /usr/include/harfbuzz -isystem /usr/include/glib-2.0 - isystem /usr/lib/glib-2.0/include -Wno-long-long -isystem /usr/include/libdrm -isystem /usr/include/cairo -isystem /usr/include/glib-2.0 -isystem /usr/lib/glib -2.0/include -isystem /usr/include/pixman-1 -isystem /usr/include/freetype2 -isystem /usr/include/libdrm -isystem /usr/include/libpng16 -isystem /usr/include/freetype2 -isystem /usr/include/dbus-1.0 -isystem /usr/lib/dbus-1.0/include -isystem /usr/include/glib-2.0 -isystem /usr/lib/glib-2.0/include -I/usr/include/freetype2 -isyste m /usr/include/freetype2 [CXX] vcl/opengl/framebuffer.cxx In file included from /usr/include/glm/detail/func_integer.inl:366:0, from /usr/include/glm/detail/func_integer.hpp:203, from /usr/include/glm/integer.hpp:6, from /usr/include/glm/glm.hpp:88, from /usr/include/glm/gtx/quaternion.hpp:17, from /usr/include/glm/gtx/norm.hpp:18, from /var/tmp/portage/app-office/libreoffice-5.2.3.3/work/libreoffice-5.2.3.3/vcl/opengl/gdiimpl.cxx:42: /usr/include/glm/detail/func_integer_simd.inl: In function ‘int glm::bitCount(genType) [with genType = long long unsigned int]’: /usr/include/glm/detail/func_integer_simd.inl:60:43: error: ‘_mm_popcnt_u64’ was not declared in this scope return static_cast<int>(_mm_popcnt_u64(x)); ^ make[1]: *** [/var/tmp/portage/app-office/libreoffice-5.2.3.3/work/libreoffice-5.2.3.3/solenv/gbuild/LinkTarget.mk:191: /var/tmp/portage/app-office/libreoffice-5.2.3.3/work/libreoffice-5.2.3.3/workdir/CxxObject/vcl/opengl/gdiimpl.o] Error 1 make[1]: *** Waiting for unfinished jobs.... See the complete attached build.log for more. Funny thing is that the build worked successfully on another machine that is software-wise very similar and only differs on the hardware side. Most importantly, taking in account the word "popcnt" in the above error, I can say that the CPU of the working machine doesn't support the popcnt instruction while the CPU of the failing machine does: lscpu features of working machine: "fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx lm constant_tsc arch_perfmon pebs bts aperfmperf eagerfpu pni dtes64 monitor ds_cpl est tm2 ssse3 cx16 xtpr pdcm xsave lahf_lm dtherm" lscpu features of failing machine: "fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nonstop_tsc extd_apicid aperfmperf eagerfpu pni pclmulqdq monitor ssse3 cx16 sse4_1 sse4_2 movbe popcnt aes xsave avx f16c lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt topoext perfctr_nb bpext perfctr_l2 hw_pstate proc_feedback vmmcall bmi1 xsaveopt arat npt lbrv svm_lock nrip_save tsc_scale flushbyasid decodeassists pausefilter pfthreshold overflow_recov" I'm not sure, though, if this observation is already pointing in the right direction to explain the issue, or if it's just leading the wrong path. For reference, in the hope that it helps, I'm attaching a "emerge --info =libreoffice-5.2.3.3" from both the failing, as well as the working machine.
Created attachment 452570 [details] failing build.log (compressed; too large otherwise)
Created attachment 452572 [details] emerge --info from failing machine
Created attachment 452574 [details] emerge --info from working machine
Alright, I've done some more research, and this might actually be a media-libs/glm issue. Perhaps somone who has more of a clue can tell me if it's worth filing a bug for that package here in the Gentoo bugtracker, or probably even to file an upstream bug. But first, the findings: Both of my machines have media-libs/glm-0.9.8.2 installed, and in the file /usr/include/glm/detail/func_integer_simd.inl there's a section that goes like this (at the very bottom): # if GLM_ARCH & GLM_ARCH_AVX_BIT template <> GLM_FUNC_QUALIFIER int bitCount(uint32 x) { return _mm_popcnt_u32(x); } template <> GLM_FUNC_QUALIFIER int bitCount(uint64 x) { return static_cast<int>(_mm_popcnt_u64(x)); } # endif The working machine doesn't have AVX, so this whole section is ignored on it. The failing machine, however, does have AVX, and as we can see in the build.log I've attached, the ultimate error directly complains about the "return static_cast<int>(_mm_popcnt_u64(x));" Now, if I comment out the whole block mentioned above in /usr/include/glm/detail/func_integer_simd.inl on the failing machine and try to build libreoffice-5.2.3.3 again, the build seems to work well (it hasn't run through completely yet, but it has already run past the critical point). We're talking about kernel and userspace operating in 32 bit here, in the failing case involving a CPU that has AVX. The compiler used is gcc version 5.4.0 (Gentoo 5.4.0 p1.0, pie-0.6.5). Is _mm_popcnt_u64 not supposed to be valid on 32 bit? Well, I don't really have a clue. If these information mean something to somebody, I'm gladly accepting requests to file bugs for glm, either here or upstream. :-)
Ok, despite being unsure about this all, I reported the issue directly to the glm folks at https://github.com/g-truc/glm/issues/567. Let's see what happens - I don't think that the Gentoo devs could or should do anything regarding this issue in the meantime.
Bug confirmed upstream in GLM, should get fixed soon: https://github.com/g-truc/glm/issues/567#issuecomment-259011386 I guess since this is not really a libreoffice bug, my original bug report here in the Genroo bugtracker can be closed so that it only serves as a reference for other people who might stumble into this.
(In reply to Nils Holland from comment #6) > Bug confirmed upstream in GLM, should get fixed soon: > https://github.com/g-truc/glm/issues/567#issuecomment-259011386 > > I guess since this is not really a libreoffice bug, my original bug report > here in the Genroo bugtracker can be closed so that it only serves as a > reference for other people who might stumble into this. OK Thanks a lot for your research...
commit 36c163c407ec64f0253dd0822f2f531f20fbbedb Author: Lars Wendler <polynomial-c@gentoo.org> Date: Wed Nov 16 22:09:24 2016 media-libs/glm: Bump to version 0.9.8.3 (bug #599674). Should also fix bug #599112. Package-Manager: portage-2.3.2