1

I have a code below and I need to compile it. However, I can not run the Makefile on my computer

#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/module.h>

int
simple_init(void)
{
  printk("Loading module\n");
  return 0;
}

void
simple_exit(void)
{
  printk("Removing module\n");
}

module_init(simple_init);
module_exit(simple_exit);

MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("Simple Module");

Makefile:

obj-m := simple.o
KDIR := /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)

default:
    $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules

clean:
    $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) clean

The problem is that: When I type Make in the terminal the following error occurs:

make -C /lib/modules/4.4.0-75-generic/build 
SUBDIRS=/home/caiquefortunato/Área de Trabalho/kernel modules
make[1]: Entering directory '/usr/src/linux-headers-4.4.0-75-generic'
arch/x86/Makefile:148: CONFIG_X86_X32 enabled but no binutils support
Makefile:693: Cannot use CONFIG_CC_STACKPROTECTOR_STRONG: -fstack-
protector-strong not supported by compiler
make[1]: *** No rule to make target 'de'.  Pare.
make[1]: Leaving directory '/usr/src/linux-headers-4.4.0-75-generic'
Makefile:19: recipe for target 'default' failed
make: *** [default] Error 2

What do I have to do to make it work? Do I need to install something?

Thank you very much in advance

2
  • 1
    make may mess things up when you have spaces in your folder paths. Try copying the build folder to a path with no spaces and run make again. Commented May 6, 2017 at 23:26
  • Resolved. Thank you so much. =D Commented May 6, 2017 at 23:33

1 Answer 1

2

There are a few causes of the CONFIG_X86_X32 enabled but no binutils support error.

1) spaces in the compilation directory <== this is is you

2) binutils not installed

3) attempting to compile root-owned kernel source directory with unprivileged user

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.