How to compile linux-kernel-module using clang - makefile

I want to build my Linux kernel module (character driver) using clang with the following Makefile
My-Makefile:
System
Ubuntu: 22.04 LTS
kernel: 5.15.0-41-generic
clang version: 14
I tried using the command:
make CC=clang-14 HOSTCC=clang-14
Error:
clang: error: unknown argument: '-fconserve-stack'
clang: error: unsupported option '-mrecord-mcount' for target 'x86_64-unknown-linux-gnu'

Related

How to do a make on MACOS Catalina?

I have a make to compile some files but it gives me this error:
ld: library not found -lomp
clang-13: error: linker command failed with exit code 1 (use -v to see invocation)
Version: macOS Catalina 10.15.7

How do I cross compile a Rust application from macOS x86 to macOS Silicon?

I want to cross compile a Rust program from my x86 Mac to a binary that can run on a Silicon Mac, and I can't figure out linking.
I have:
An x86 Mac running macOS 10.15.7 Catalina
A Rust project called riff
cargo 1.51.0 (43b129a20 2021-03-16) recently retrieved using rustup
Xcode version 12.4 (12D4e)
I want to compile this into a binary that can run on a Silicon (ARM) Mac. This could be one of:
A Silicon specific binary
A Universal binary that can run on either Silicon or x86
I have tried (through ./release.sh --dry):
rustup target add aarch64-apple-darwin
cargo build --release --target=aarch64-apple-darwin
The result was too long to paste in here, so this is an excerpt:
Compiling riff v0.1.0 (/Users/johan/src/riff)
error: linking with `cc` failed: exit code: 1
|
= note: "cc" "-arch arm64" "-L" "/Users/johan/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib" "/Users/johan/src/riff/target/aarch64-apple-darwin/release/deps/riff.1g47gi93dk96t2va.rcgu.o" ... "/Users/johan/src/riff/target/aarch64-apple-darwin/release/deps/riff.thread_local-9baf7723f72eef37.thread_local.7fl1y1d9-cgu.9.rcgu.o.rcgu.o" "/Users/johan/src/riff/target/aarch64-apple-darwin/release/deps/riff.unwind-082f7f4ff792426f.unwind.7rkx2ya0-cgu.0.rcgu.o.rcgu.o" "-o /Users/johan/src/riff/target/aarch64-apple-darwin/release/deps/riff" "-Wl,-dead_strip" "-nodefaultlibs" "-L" "/Users/johan/src/riff/target/aarch64-apple-darwin/release/deps" "-L" "/Users/johan/src/riff/target/release/deps" "-L" "/Users/johan/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib" "/Users/johan/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libcompiler_builtins-9eb7dc999785b765.rlib" "-lSystem" "-lresolv" "-lc" "-lm"
= note: ld: warning: ignoring file /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/libresolv.tbd, missing required architecture arm64 in file /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/libresolv.tbd
ld: warning: ignoring file /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/libm.tbd, missing required architecture arm64 in file /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/libm.tbd
ld: warning: ignoring file /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/libc.tbd, missing required architecture arm64 in file /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/libc.tbd
ld: warning: ignoring file /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/libSystem.tbd, missing required architecture arm64 in file /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/libSystem.tbd
Undefined symbols for architecture arm64:
"__tlv_atexit", referenced from:
std::sys::unix::thread_local_dtor::register_dtor::h4ece0fa32a190720 in riff.std-e40bd6a3af835df4.std.5bd9rdky-cgu.0.rcgu.o.rcgu.o
...
"_free", referenced from:
alloc::raw_vec::finish_grow::hd210c40bc8674cab (.llvm.18296587876935678160) in riff.addr2line-220464f1af330a49.addr2line.6xizm3st-cgu.1.rcgu.o.rcgu.o
addr2line::path_push::hf1048f2514c3ed28 in riff.addr2line-220464f1af330a49.addr2line.6xizm3st-cgu.5.rcgu.o.rcgu.o
alloc::raw_vec::finish_grow::ha5f485527a5c6598 in riff.addr2line-a950b2eed913eb15.addr2line.1hygsg7c-cgu.0.rcgu.o.rcgu.o
addr2line::path_push::h891160d400ff153e in riff.addr2line-a950b2eed913eb15.addr2line.1hygsg7c-cgu.0.rcgu.o.rcgu.o
core::ptr::drop_in_place$LT$aho_corasick..prefilter..Packed$GT$::h03bcd2abfab8068d in riff.aho_corasick-5d6c900557669556.aho_corasick.4z4l4vb2-cgu.0.rcgu.o.rcgu.o
core::ptr::drop_in_place$LT$aho_corasick..packed..pattern..Patterns$GT$::h0c7fda104debb352 in riff.aho_corasick-5d6c900557669556.aho_corasick.4z4l4vb2-cgu.0.rcgu.o.rcgu.o
core::ptr::drop_in_place$LT$alloc..vec..Vec$LT$alloc..vec..Vec$LT$u8$GT$$GT$$GT$::h75f2b558c0581f8d in riff.aho_corasick-5d6c900557669556.aho_corasick.4z4l4vb2-cgu.0.rcgu.o.rcgu.o
...
(maybe you meant: alloc::alloc::box_free::ha8718384ecb60252 (.llvm.10945926475227631812), alloc::alloc::box_free::h58e664059c03effd (.llvm.10945926475227631812) , alloc::alloc::box_free::h75cae1a8684a32ce (.llvm.8938487907768303252) , alloc::alloc::box_free::h0459f8e1bcc5ae0a (.llvm.8938487907768303252) , alloc::alloc::box_free::hc3b2f94f9be4da06 (.llvm.7882408235892284297) , alloc::alloc::box_free::h75cae1a8684a32ce (.llvm.7882408235892284297) , alloc::alloc::box_free::h0459f8e1bcc5ae0a (.llvm.11547294393004044273) , alloc::alloc::box_free::hcc8806ce168336a8 (.llvm.2537316772799228199) , alloc::alloc::box_free::h305ed20a6d3d49c7 (.llvm.11075277010792284734) , alloc::alloc::box_free::h384e6b725c5ad166 (.llvm.7882408235892284297) , alloc::alloc::box_free::h0459f8e1bcc5ae0a (.llvm.7882408235892284297) , alloc::alloc::box_free::hb8cf920d803cfa22 (.llvm.4992613404806278909) , alloc::alloc::box_free::h90dd1ed16b644fc1 (.llvm.9562203231941335137) , alloc::alloc::box_free::h9e3286b91a0737ba (.llvm.4992613404806278909) , alloc::alloc::box_free::h75cae1a8684a32ce (.llvm.11547294393004044273) )
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Add the appropriate target
rustup target add aarch64-apple-darwin
Compile your code using the macOS 11.x SDK 1:
SDKROOT=$(xcrun -sdk macosx11.1 --show-sdk-path) \
MACOSX_DEPLOYMENT_TARGET=$(xcrun -sdk macosx11.1 --show-sdk-platform-version) \
cargo build --target=aarch64-apple-darwin
This produces a single-architecture binary:
file target/aarch64-apple-darwin/debug/riff
target/aarch64-apple-darwin/debug/riff: Mach-O 64-bit executable arm64
1 — Find what the current available SDKs are via xcodebuild -showsdks.

Makefile:605 in caffe make

When I make caffe makefile with command make all -j4, there is an error on line 605 of makeprofile, Im not sure is there anything wrong or not, I didn't edit this line. It seem to be a wrong version of cuda? or for other reason...
error message:
NVCC src/caffe/layers/swish_layer.cu
NVCC src/caffe/layers/cudnn_lrn_layer.cu
NVCC src/caffe/layers/im2col_layer.cu
nvcc fatal : Option '--generate-code arch=-gencode', missing code
NVCC src/caffe/layers/dropout_layer.cu
nvcc fatal : Option '--generate-code arch=-gencode', missing code
nvcc fatal : Option '--generate-code arch=-gencode', missing code
Makefile:605: recipe for target '.build_release/cuda/src/caffe/layers/swish_layer.o' failed
make: *** [.build_release/cuda/src/caffe/layers/swish_layer.o] Error 1
Makefile:605: recipe for target '.build_release/cuda/src/caffe/layers/cudnn_lrn_layer.o' failed
make: *** [.build_release/cuda/src/caffe/layers/cudnn_lrn_layer.o] Error 1
nvcc fatal : Option '--generate-code arch=-gencode', missing code
Makefile:605: recipe for target '.build_release/cuda/src/caffe/layers/im2col_layer.o' failed
make: *** [.build_release/cuda/src/caffe/layers/im2col_layer.o] Error 1
environment:
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.2 LTS
Release: 18.04
Codename: bionic
CUDA Version 10.0.130
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2017 NVIDIA Corporation
Built on Fri_Nov__3_21:07:56_CDT_2017
Cuda compilation tools, release 9.1, V9.1.85

vecintrin.h: No such file or directory

While building TensorFlow with vectorization, I get below error:
external/eigen_archive/unsupported/Eigen/CXX11/../../../Eigen/Core:248:27:
fatal error: vecintrin.h: No such file or directory compilation
terminated.
I don't see this on Ubuntu 17.04 (GCC v6.3.0), however it is appearing on Ubuntu 16.04 (GCC v5.4.0).
Is it related to GCC version? or some dependency is needed?

dlltool: Fatal error: no compiled in support for x86_64

I'm trying to build a 64-bit version of libpython27.a from python27.dll on Windows 7 x64.
Following these instructions, I tried:
E:\temp>gendef python27.dll
* [python27.dll] Found PE+ image
E:\temp>dlltool --as-flags=--64 -m i386:x86-64 -k --output-lib libpython27.a --i
nput-def python27.def
Assembler messages:
Fatal error: no compiled in support for x86_64
dlltool: as exited with status 1
dlltool: failed to open temporary head file: dgtnh.o: No such file or directory
What can explain Fatal error: no compiled in support for x86_64?
I see:
E:\temp>dlltool -h
Usage dlltool <option(s)> <object-file(s)>
-m --machine <machine> Create as DLL for <machine>. [default: i386:x86-64]
possible <machine>: arm[_interwork], i386, mcore[-elf]{-le|-be}, ppc, thumb
-e --output-exp <outname> Generate an export file.
Does the issue come from the fact possible <machine> does not contain x86_64, and if so where to find a dlltool.exe that supports x86_64?

Resources