Attempting to compile net-libs/nodejs-18.14.2 on Gentoo 5.15.75 on an Intel Core 2 Duo Thinkpad T500 results in the emerge failing partway through if '-march=native' in '/etc/portage/make.conf'. A workaround is to set -march=core2 in '/etc/portage/make.conf'. Reproducible: Always Steps to Reproduce: 1.Set '-march=native' in '/etc/portage/make.conf'. 2.Attempt to compile net-libs/nodejs-18.14.2 with portage. 3.Build will start but fail partway through. Actual Results: The package failed to compile. Expected Results: The package should have compiled.
Please always include the full build.log and emerge --info.
Created attachment 859129 [details] Result of 'emerge --info' after applying workaround This is the result of 'emerge --info' after changing '-march=native' to '-march=core2' in '/etc/portage/make.conf' and successfully compiling 'net-libs/nodejs-18.14.2'. No other changes were made and everything else was the same when the package failed to build.
(In reply to Sam James from comment #1) > Please always include the full build.log and emerge --info. emerge --info was too long to fit in the "Additional Comments" section, so I had to attach it after posting.
Please attach the full build log.
Created attachment 859137 [details] build.log for failed emerge I switched '-march=core2' back to '-march=native' and attempted to emerge 'net-libs/nodejs-18.14.2' again. The build failed and this is the result.
Can you post your /proc/cpuinfo file?
Also the output of `gcc -march=native -Q --help=target` would be helpful.
Created attachment 860037 [details] Output of 'gcc -march=native -Q --help=target'
Created attachment 860038 [details] Output of '/proc/cpuinfo'
Interesting. Your /proc/cpuinfo shows sse4_1 but not popcnt. Fortunately the GCC -march=native output agrees, so I think that means that it's probably not the GCC problem [*] I thought it was. Diffing your output against `gcc -march=core2 -Q --help=target`, I see this: > --- core2 2023-04-15 12:25:56.575149311 -0400 > +++ native 2023-04-15 12:26:10.885108020 -0400 > @@ -127,7 +127,7 @@ > -mno-fancy-math-387 [disabled] > -mno-push-args [disabled] > -mno-red-zone [disabled] > - -mno-sse4 [enabled] > + -mno-sse4 [disabled] > -mnop-mcount [disabled] > -momit-leaf-frame-pointer [disabled] > -mpc32 [disabled] > @@ -169,7 +169,7 @@ > -msse2avx [disabled] > -msse3 [enabled] > -msse4 [disabled] > - -msse4.1 [disabled] > + -msse4.1 [enabled] > -msse4.2 [disabled] > -msse4a [disabled] > -msse5 -mavx > @@ -202,7 +202,7 @@ > -mwidekl [disabled] > -mx32 [disabled] > -mxop [disabled] > - -mxsave [disabled] > + -mxsave [enabled] > -mxsavec [disabled] > -mxsaveopt [disabled] > -mxsaves [disabled] Notably, -mpopcnt is not changed: > -mpopcnt [disabled] So my suspicion is that something is incorrectly trying to use popcnt intrinsics, but keyed off of SSE 4.1 rather than popcnt availability. [*] for some CPUs -march=native enables some instructions that are not available on all CPUs in that family
The function that's using the popcnt intrinsics is utf16_to_utf8_avx512i, so it's definitely not getting executed on your CPU. I see from the build log: > -DHAVE_SSSE3=1' '-DHAVE_SSE41=1' '-DHAVE_SSE42=1' '-DHAVE_AVX=1' '-DHAVE_AVX2=1' which is probably fine. It's probably that it's compiling runtime-enabled code that won't be executed on your CPU.
Instead of switching from -march=native to -march=core2, does simply adding -mno-sse4 allow it to build? Would be good to confirm.
Created attachment 860435 [details] build log for 'march=native -mno-sse4'
(In reply to Matt Turner from comment #12) > Instead of switching from -march=native to -march=core2, does simply adding > -mno-sse4 allow it to build? Would be good to confirm. nodejs fails to build with those settings.
Any news here / is this still relevant?
See also https://github.com/gentoo/gentoo/pull/32067