unable to build kernel driver - Debian Jessie stackprotector - linux

We have one Debian Jessie installation into which I am attempting to install a kernel driver.
Basically, upon build the makefile drops out with :
Cannot use CONFIG_CC_STACKPROTECTOR_REGULAR: -fstack-protector not supported by compiler.
We're on kernel 3.16 with gcc 4.9.1
I'm fairly sure that 4.9.1 supports -fstack-protector so I'm stumped.
Would very much appreciate some help getting this built.

Related

Problems with sfml function in linux

I have a sfml c++ project. In this project, if I use the "sf::Mouse::setPosition" sfml method, the program crashes in 2-3 seconds after launch. If i don't use the "sf::Mouse::setPosition" sfml method, the runs successfully.
OS: Kubuntu 22.10 x64,
Kernel: 5.19.0-28-generic,
Video card: GT 730,
Compiler: gcc version 12.2.0 (Ubuntu 12.2.0-3ubuntu1),
SFML has installed by apt, libsfml-dev version 2.5.1+dfsg-2.
Makefile:
`
compile:./main.cpp
g++ -c main.cpp
g++ main.o -o app -lsfml-graphics -lsfml-window -lsfml-system
run:
./app
`
I've tried to use legacy nvidia-driver-390, xserver-xorg-video-nouveau but it doesn't work. Maybe I should compile sfml source code for better compatibility, but i don't know how to do this. Also the problem might be in gcc version (maybe sfml 2.5.1 doesn't support 12.2.0).

How do I link libraries from multiple locations (corresponding to multiple GCC versions)?

I am currently trying to use Oracle Linux 6 OS on a SPARC S7 server to run the NPB benchmarks (with OpenMP multithreading support). The OS comes preloaded with gcc 4.4.7, which is missing the Niagara 7 optimizations. I downloaded devtoolset-3 from the Oracle Yum Repository, which has gcc 4.9.2 installed in /opt/rh/devtoolset-3/root/usr/bin. However, when I compile the NPB benchmark using the newer gcc, it automatically links to libraries associated with the older gcc 4.4.7 (located in /usr/lib). This caused my program to segfault during execution. I believe that it is because libgomp 4.4.7 is incompatible with libgomp 4.9.2. I have tried several ways of linking to the libraries in the gcc 4.9.2 folder (which is /opt/rh/devtoolset-3/root/usr/lib/gcc); none of the methods work:
-Xlinker -rpath=lib_location
-Wl -Bstatic
-L lib_location
The closest I got was when using -Wl -Bstatic ~/libgomp.a or -static -L ~/libgomp.a. It fails to find libraries such as libm that reside in the default gcc lib folder (usr/lib).
The actual command used to link is:
/opt/rh/devtoolset-3/root/usr/bin/gcc -O3 -fopenmp -mcmodel=medmid -static -L/opt/rh/devtoolset-3/root/usr/lib/gcc/sparc64-redhat-linux/4.9.2 -o ../bin/bt.W.x bt.o initialize.o exact_solution.o exact_rhs.o set_constants.o adi.o rhs.o x_solve.o y_solve.o solve_subs.o z_solve.o add.o error.o verify.o ../common/print_results.o ../common/c_timers.o ../common/wtime.o -lm -L/opt/rh/devtoolset-3/root/usr/lib/gcc/sparc64-redhat-linux/4.9.2/lib/
/opt/rh/devtoolset-3/root/usr/libexec/gcc/sparc64-redhat-linux/4.9.2/ld: cannot find -lm
/opt/rh/devtoolset-3/root/usr/libexec/gcc/sparc64-redhat-linux/4.9.2/ld: cannot find -lrt
/opt/rh/devtoolset-3/root/usr/libexec/gcc/sparc64-redhat-linux/4.9.2/ld: cannot find -lpthread
/opt/rh/devtoolset-3/root/usr/libexec/gcc/sparc64-redhat-linux/4.9.2/ld: cannot find -lc
Is there a way I can link just the libgomp library from gcc 4.9.2 while linking the remaining libraries from gcc 4.4.7?
The devtoolset compilers are all using the system libgcc, libstdc++, version 4.4.7, and can therefore not compile e.g. c++11.
I guess the gcc53-c++-5.3.0-1.el6.x86_64.rpm will do. Comes with the internal */gcc53/lib64{libgcc_s.so**, libgomp.so**, libstdc++} (version 5.3.0) ... Provides /usr/bin/{ gcc53, g++53 }
The package was created a year ago ... well tested, as extra compiler. Download link : https://drive.google.com/file/d/0B7S255p3kFXNbTBneHgwSzBodFE/view?usp=sharing
If you're going to do the -Wl,-Bstatic thing, make sure to follow it immediately by -Wl,-Bdynamic to reset to normal after your added library argument. By default, not all system libraries have static versions installed, which is why you get e.g. cannot find -lc.
So you can try this as a modification of your workaround:
-Wl,-Bstatic ~/libgomp.a -Wl,-Bdynamic
Not pretty, and this question deserves a much better answer (this is still pretty much a hack), but it should get the job done for now.

How to modify the DWARF version of G++ compiled debugging information

I'm compiling a library using g++, using following parameters:
g++ -gdwarf-2 -std=c++0x -m32 -Dunix=1 -Dlinux=1 -D_JAVA=1 -DNDEBUG=1 -I...
Although I'm using specific DWARF version 2, the investigation of my core-file keeps on giving following error message:
Dwarf Error: wrong version in compilation unit header (is 4, should be 2)
Does anybody know what I can do?
I'm working with following versions:
Platform version : CentOS 5.2
g++ version : g++ (GCC) 4.1.1 20070105 (Red Hat 4.1.1-52)
gdb version : GNU gdb Red Hat Linux (6.5-37.el5rh)
It is not possible to update the platform.
For your information: meanwhile I've found this URL (http://www.delorie.com/gnu/docs/gdb/gdb_17.html), which explains that sometimes it might be a bad idea to mix debugging information with optimisation flags.
As a result, I have removed the optimisation flag (although it was "-O0", and I have used "g++ -gdwarf-2 -g3" (as mentioned in the URL), but still no improvement.
Meanwhile I've solved the problem, by updating my GDB (and related) processes.

Gcc compile hello.c for c6x

I compiled hello.c program for c6x architecture:
gcc-4.8 -o hello -march='c64x' hello.c
But It got an error: error: bad value (c64x) for -march= switch
Seem gcc can't recognize c64x architecture!
I am using Ubuntu 12.04 LTS & gcc-4.8 version.
Thank you!
-march=name
This specifies the name of the target architecture.
But in your case target is TI (c64x) board i.e its arm architecture. to compile your program for arm architecture you need cross-compiler. But you trying to compile on x86gcc native-compiler with option -march which is different from target target. i.e "gcc" is a native compiler. In your case it appears you are not working on an ARM host, thus "gcc" will not compile for ARM on x86.
so download the cross-compiler tool chain and then compile your program with your options.
cross compiler for ubuntu is here
http://www.filewatcher.com/m/gcc-c6x-linux-gnu-4.7.1-0.1.20120606.fc18.1.i686.rpm.10801432-0.html

generating 64 bit code on 32bit debian system

Could you please describe that how have you installed gcc-multilib and g++-multilib on 32bit debian machine to generate 64 bit code?
I installed gcc-4.7.2 on my 32bit debian system(and also installed binutils-2.23). When i try to compile a simple hello world program with -m64 flag as
# gcc -m64 hello.c
I am getting following error message:
"hello.c:1:0: sorry, unimplemented: 64-bit mode not compiled in" .
Please tell me the steps to generate the 64bit code on 32bit debian system.
You need to re-install gcc with this option in the configure.

Resources