Hi,
I am trying to build the kernel with the addition of a simple C++ file in sys/kern that doesn't use any C++-specific library but only language features such as the use of classes, e.g.
I have added kern/kern_cpp_test.cc to sys/conf/files (with "standard" configuration), but the file doesn't seem to be recognized as a C++ file for compilation. I checked share/mk/sys.mk and I found:
Doing "make buildkernel" results in this error, which looks like the result of the extension being incorrectly recognized as something else and being truncated. The compiler is still cc and not cc++ for some reason:
(Look at "-MTkern_cpp_test.co")
Is there any solution to this?
I am trying to build the kernel with the addition of a simple C++ file in sys/kern that doesn't use any C++-specific library but only language features such as the use of classes, e.g.
Code:
// kern/kern_cpp_test.cc
class TestClass {
int x;
};
Code:
.cc .cpp .cxx .C:
${CXX} ${CXXFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} -o ${.TARGET}
Doing "make buildkernel" results in this error, which looks like the result of the extension being incorrectly recognized as something else and being truncated. The compiler is still cc and not cc++ for some reason:
Code:
cc -target x86_64-unknown-freebsd11.1 --sysroot=/usr/obj/usr/src/tmp -B/usr/obj/usr/src/tmp/usr/bin -c -O2 -pipe -fno-strict-aliasing -g -nostdinc -I. -I/usr/src/sys -I/usr/src/sys/contrib/libfdt -D_KERNEL -DHAVE_KERNEL_OPTION_HEADERS -include opt_global.h -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -MD -MF.depend.kern_cpp_test.co -MTkern_cpp_test.co -mcmodel=kernel -mno-red-zone -mno-mmx -mno-sse -msoft-float -fno-asynchronous-unwind-tables -ffreestanding -fwrapv -fstack-protector -gdwarf-2 -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 -Werror
cc: error: no input files
(Look at "-MTkern_cpp_test.co")
Is there any solution to this?