Solved Upgrade from FreeBSD 11.1-RELEASE to FreeBSD 11.2-BETA1 - compilation issue

paulw

New Member

Thanks: 2
Messages: 10

#1
In case anyone else runs into this...

After upgrading to FreeBSD 11.2-BETA1 yesterday (via freebsd-update(8)), I could not compile the nvidia-driver or anything else for that matter. Eventually, by temporarily disabling my /etc/make.conf, I was able to narrow it down to the presence of CPUTYPE?=native in that file so on my system at least this directive is apparently no longer working.
 
Last edited by a moderator:

Rigoletto

Daemon
Developer

Thanks: 751
Messages: 1,654

#2
You can use this command to find your specific processor model:

sh -c "clang -v -fsyntax-only -march=native -x c /dev/null 2>&1 | grep -e '-target-cpu' \
| sed -e 's|.*-target-cpu \([[:alnum:]]*\) .*|\1|'"
 
OP
OP
P

paulw

New Member

Thanks: 2
Messages: 10

#3
You can use this command to find your specific processor model:

sh -c "clang -v -fsyntax-only -march=native -x c /dev/null 2>&1 | grep -e '-target-cpu' \
| sed -e 's|.*-target-cpu \([[:alnum:]]*\) .*|\1|'"
Thanks lebarondemerde. What I get is:

Code:
 "/usr/bin/clang" -cc1 -triple x86_64-unknown-freebsd11.2 -fsyntax-only -disable-free -disable-llvm-verifier -discard-value-names -main-file-name null \
-mrelocation-model static -mthread-model posix -mdisable-fp-elim -masm-verbose -mconstructor-aliases -munwind-tables -target-cpu k6-3 \
-target-feature +sse2 -target-feature +cx16 -target-feature -tbm -target-feature -avx512ifma -target-feature -gfni -target-feature -sha \
-target-feature -fma4 -target-feature -vpclmulqdq -target-feature -prfchw -target-feature -bmi2 -target-feature -xsavec -target-feature \
-fsgsbase -target-feature -popcnt -target-feature -aes -target-feature -avx512bitalg -target-feature -xsaves -target-feature -avx512er \
-target-feature -avx512vnni -target-feature -avx512vpopcntdq -target-feature -clwb -target-feature -avx512f -target-feature -clzero \
-target-feature -pku -target-feature +mmx -target-feature -lwp -target-feature -xop -target-feature -rdseed -target-feature -ibt \
-target-feature -sse4a -target-feature -avx512bw -target-feature -clflushopt -target-feature -xsave -target-feature -avx512vbmi2 \
-target-feature -avx512vl -target-feature -avx512cd -target-feature -avx -target-feature -vaes -target-feature -rtm -target-feature -fma \
-target-feature -bmi -target-feature -rdrnd -target-feature -mwaitx -target-feature -sse4.1 -target-feature -sse4.2 -target-feature -avx2 \
-target-feature +sse -target-feature -lzcnt -target-feature -pclmul -target-feature -prefetchwt1 -target-feature -f16c -target-feature -ssse3 \
-target-feature -sgx -target-feature -shstk -target-feature +cmov -target-feature -avx512vbmi -target-feature -movbe -target-feature -xsaveopt \
-target-feature -avx512dq -target-feature -adx -target-feature -avx512pf -target-feature +sse3 -dwarf-column-info -debugger-tuning=gdb -v \
-resource-dir /usr/lib/clang/6.0.0 -fdebug-compilation-dir /home/paul -ferror-limit 19 -fmessage-length 0 -fobjc-runtime=gnustep -fdiagnostics-show-option -x c /dev/null"
I didn't have the details handy last time so here's what I was seeing:

Code:
paul@laurel-FreeBSD ~ $ sudo portmaster nvidia-driver-304

===>>> Currently installed version: nvidia-driver-304-304.137
===>>> Port directory: /usr/ports/x11/nvidia-driver-304

===>>> Gathering distinfo list for installed ports

===>>> Launching 'make checksum' for x11/nvidia-driver-304 in background
===>>> Gathering dependency list for x11/nvidia-driver-304 from ports
===>>> Initial dependency check complete for x11/nvidia-driver-304


===>>> Starting build for x11/nvidia-driver-304 <<<===

===>>> All dependencies are up to date

===>  Cleaning for nvidia-driver-304-304.137
===>  License NVIDIA accepted by the user
===>   nvidia-driver-304-304.137 depends on file: /usr/local/sbin/pkg - found
===> Fetching all distfiles required by nvidia-driver-304-304.137 for building
===>  Extracting for nvidia-driver-304-304.137
=> SHA256 Checksum OK for NVIDIA-FreeBSD-x86_64-304.137.tar.gz.
===>  Patching for nvidia-driver-304-304.137
===>  Applying extra patch /usr/ports/x11/nvidia-driver-304/../nvidia-driver/files/extra-patch-src-Makefile
===>  Applying extra patch /usr/ports/x11/nvidia-driver-304/../nvidia-driver/files/extra-patch-src-nv-freebsd.h
===>  Applying extra patch /usr/ports/x11/nvidia-driver-304/../nvidia-driver/files/extra-patch-src-nv-misc.h
===>  Applying FreeBSD patches for nvidia-driver-304-304.137
===>   nvidia-driver-304-304.137 depends on file: /usr/local/lib/libGL.so - found
===>   nvidia-driver-304-304.137 depends on file: /usr/local/libdata/pkgconfig/glproto.pc - found
===>   nvidia-driver-304-304.137 depends on file: /usr/local/libdata/pkgconfig/dri2proto.pc - found
===>   nvidia-driver-304-304.137 depends on file: /usr/local/libdata/pkgconfig/dri3proto.pc - found
===>   nvidia-driver-304-304.137 depends on file: /usr/local/libdata/pkgconfig/x11.pc - found
===>   nvidia-driver-304-304.137 depends on file: /usr/local/libdata/pkgconfig/xorg-server.pc - found
===>   nvidia-driver-304-304.137 depends on file: /usr/local/libdata/pkgconfig/xext.pc - found
===>  Configuring for nvidia-driver-304-304.137
===>  Building for nvidia-driver-304-304.137
--- all ---
===> src (all)
--- machine ---
--- x86 ---
x86 -> /usr/src/sys/x86/include
--- machine ---
machine -> /usr/src/sys/amd64/include
--- stdarg.h ---
--- vnode_if_newproto.h ---
awk -f /usr/src/sys/tools/vnode_if.awk /usr/src/sys/kern/vnode_if.src -p
--- vnode_if_typedef.h ---
awk -f /usr/src/sys/tools/vnode_if.awk /usr/src/sys/kern/vnode_if.src -q
--- opt_global.h ---
:> opt_global.h
--- device_if.h ---
awk -f /usr/src/sys/tools/makeobjops.awk /usr/src/sys/kern/device_if.m -h
--- bus_if.h ---
awk -f /usr/src/sys/tools/makeobjops.awk /usr/src/sys/kern/bus_if.m -h
--- pci_if.h ---
awk -f /usr/src/sys/tools/makeobjops.awk /usr/src/sys/dev/pci/pci_if.m -h
--- vnode_if.h ---
awk -f /usr/src/sys/tools/vnode_if.awk /usr/src/sys/kern/vnode_if.src -h
--- nvidia_ctl.o ---
--- nvidia_dev.o ---
--- nvidia_ctl.o ---
cc -O2 -pipe -march=native -fno-strict-aliasing -DNV_VERSION_STRING=\"304.137\" -D__KERNEL__ -DNVRM -Wno-unused-function -Wuninitialized -O -mno-red-zone -mcmodel=kernel -UDEBUG -U_DEBUG -DNDEBUG -march=native  -Werror -D_KERNEL -DKLD_MODULE -nostdinc  -I. -I. -I/usr/src/sys -fno-common  -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer   -MD  -MF.depend.nvidia_ctl.o -MTnvidia_ctl.o -mcmodel=kernel -mno-red-zone -mno-mmx -mno-sse -msoft-float  -fno-asynchronous-unwind-tables -ffreestanding -fwrapv -fstack-protector -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual -Wundef -Wno-pointer-sign -D__printf__=__freebsd_kprintf__ -Wmissing-include-dirs -fdiagnostics-show-option -Wno-unknown-pragmas -Wno-error-tautological-compare -Wno-error-empty-body -Wno-error-parentheses-equality -Wno-error-unused-function -Wno-error-pointer-sign -Wno-error-shift-negative-value -Wno-error-address-of-packed-member  -mno-aes -mno-avx  -std=iso9899:1999 -c nvidia--- nvidia_dev.o ---
cc -O2 -pipe -march=native -fno-strict-aliasing -DNV_VERSION_STRING=\"304.137\" -D__KERNEL__ -DNVRM -Wno-unused-function -Wuninitialized -O -mno-red-zone -mcmodel=kernel -UDEBUG -U_DEBUG -DNDEBUG -march=native  -Werror -D_KERNEL -DKLD_MODULE -nostdinc  -I. -I. -I/usr/src/sys -fno-common  -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer   -MD  -MF.depend.nvidia_dev.o -MTnvidia_dev.o -mcmodel=kernel -mno-red-zone -mno-mmx -mno-sse -msoft-float  -fno-asynchronous-unwind-tables -ffreestanding -fwrapv -fstack-protector -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual -Wundef -Wno-pointer-sign -D__printf__=__freebsd_kprintf__ -Wmissing-include-dirs -fdiagnostics-show-option -Wno-unknown-pragmas -Wno-error-tautological-compare -Wno-error-empty-body -Wno-error-parentheses-equality -Wno-error-unused-function -Wno-error-pointer-sign -Wno-error-shift-negative-value -Wno-error-address-of-packed-member  -mno-aes -mno-avx  -std=iso9899:1999 -c nvidia_dev.c -o nvidia_dev.o
--- nvidia_ctl.o ---
_ctl.c -o nvidia_ctl.o
--- nvidia_dev.o ---
error: unknown target CPU 'k6-3'
*** [nvidia_dev.o] Error code 1
...

paul@laurel-FreeBSD ~ $
Code:
paul@laurel-FreeBSD ~ $ dmesg | grep -i cpu
CPU: Intel(R) Pentium(R) D CPU 3.20GHz (3200.18-MHz K8-class CPU)
FreeBSD/SMP: Multiprocessor System Detected: 2 CPUs
SMP: AP CPU #1 Launched!
cpu0: <ACPI CPU> on acpi0
cpu1: <ACPI CPU> on acpi0
est0: <Enhanced SpeedStep Frequency Control> on cpu0
est1: <Enhanced SpeedStep Frequency Control> on cpu1
CPU: Intel(R) Pentium(R) D CPU 3.20GHz (3200.18-MHz K8-class CPU)
paul@laurel-FreeBSD ~ $
 
Last edited by a moderator:

Rigoletto

Daemon
Developer

Thanks: 751
Messages: 1,654

#4
IDK, sorry.

Btw, that "\" after '-target-cpu' in the command was just to indicate I break the line in there, but that may become misleading on that particular example:

Code:
sh -c "clang -v -fsyntax-only -march=native -x c /dev/null 2>&1 | grep -e '-target-cpu' | sed -e 's|.*-target-cpu \([[:alnum:]]*\) .*|\1|'"
The output of that command is quite simple, something like this in my case (AMD FX-8020):

Code:
bdver1
 
OP
OP
P

paulw

New Member

Thanks: 2
Messages: 10

#6
Oops. In my original post maybe I should also have included:

Code:
paul@laurel-FreeBSD ~ $ uname -a
FreeBSD laurel-FreeBSD 11.2-BETA1 FreeBSD 11.2-BETA1 #0 r333474: Fri May 11 05:22:08 UTC 2018     root@releng2.nyi.freebsd.org:/usr/obj/usr/src/sys/GENERIC  amd64
paul@laurel-FreeBSD ~ $
 
Last edited by a moderator:
Top