User avatar
DeanC
Posts: 136
Joined: Thu Sep 26, 2013 4:07 pm
Location: Vancouver, Canada

HELP: Compiling driver error, no /lib/modules/3.10.25+/build

Wed Jan 22, 2014 10:29 pm

I'm trying to compile a driver on my RPi running Raspbian. But I get the following error:

Code: Select all

make: *** /lib/modules/3.10.25+/build: No such file or directory.  Stop.
make: *** [all] Error 2
Every normal (not optimized for RPi) version of Linux I have worked with has this directory. But I can't find it in Raspbian. Did this directory get moved somewhere else? How to I get access to it so I can compile my driver?
We 'idiot proofed' the world, and now it's full of idiots!

User avatar
DougieLawson
Posts: 35529
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: HELP: Compiling driver error, no /lib/modules/3.10.25+/b

Wed Jan 22, 2014 10:54 pm

Can't you simply use
mkdir -p /lib/modules/3.10.25+/build

That /lib/modules/* stuff is all built by rpi-update
Note: Having anything remotely humorous in your signature is completely banned on this forum. Wear a tinfoil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

User avatar
DeanC
Posts: 136
Joined: Thu Sep 26, 2013 4:07 pm
Location: Vancouver, Canada

Re: HELP: Compiling driver error, no /lib/modules/3.10.25+/b

Thu Jan 23, 2014 1:51 am

DougieLawson wrote:Can't you simply use
mkdir -p /lib/modules/3.10.25+/build

That /lib/modules/* stuff is all built by rpi-update

I tried it and got the following error:

Code: Select all

make[1]: Entering directory `/lib/modules/3.10.25+/build'
make[1]: *** No rule to make target `modules'.  Stop.
make[1]: Leaving directory `/lib/modules/3.10.25+/build'
make: *** [LINUX] Error 2
I just tried rpi-update, but but it changes the build to 3.10.27+, so I create the directory again and still get:

Code: Select all

make[1]: Entering directory `/lib/modules/3.10.27+/build'
make[1]: *** No rule to make target `modules'.  Stop.
make[1]: Leaving directory `/lib/modules/3.10.27+/build'
make: *** [LINUX] Error 2
We 'idiot proofed' the world, and now it's full of idiots!

Maxhdroom
Posts: 13
Joined: Sat Jan 25, 2014 11:22 pm

Re: HELP: Compiling driver error, no /lib/modules/3.10.25+/b

Mon Jan 27, 2014 11:49 pm

Same situation here...
I'm trying to compile a module and can't find the build directory.

I additionally ran sudo aptitude install linux-image-rpi-rpfv linux-headers-rpi-rpfv, still no uname -r/build found, so I ran find / -name build and got
/lib/modules/3.10-3-rpi/build
I altered Makefile accordingly and got a .ko module... so far so good. Then I insmod it and got "Invalid module format" ran dmesg "usbtv: disagrees about version of symbol module_layout" :evil:

uname -a tells me I'm running Linux raspberrypi 3.10.27+ #630 PREEMPT Fri Jan 17 19:44:36 GMT 2014 armv6l GNU/Linux
How do you compile on the Pi ??

Maxhdroom
Posts: 13
Joined: Sat Jan 25, 2014 11:22 pm

Re: HELP: Compiling driver error, no /lib/modules/3.10.25+/b

Tue Jan 28, 2014 1:31 am

I followed these instructions, just adapting to my kernel's version and was able to compile the module, but apparently it crashes my Pi on depmod and insmod.
http://www.raspberrypi.org/phpBB3/viewt ... 76#p315376

Code: Select all

cd /usr/src
wget https://github.com/raspberrypi/linux/archive/rpi-3.10.y.tar.gz
tar xvfz rpi-3.10.y.tar.gz
mv linux-rpi-3.10.y linux
ln -s /usr/src/linux /lib/modules/3.10.27+/build
cd /lib/modules/3.10.27+/build
make mrproper
gzip -dc /proc/config.gz > .config
make modules_prepare
wget https://github.com/raspberrypi/firmware/raw/master/extra/Module.symvers
then got in the dir where I downloaded the module source code and ran make.
Copied the resulting .ko to /lib/modules/$(uname -r)/kernel/drivers/
depmod -a ran ok
Then modprobe crashes the system... does linux code have to be specifically adapted for Raspberry Pi ?

Reiszecke
Posts: 4
Joined: Thu Feb 06, 2014 3:31 am

Re: HELP: Compiling driver error, no /lib/modules/3.10.25+/b

Thu Feb 06, 2014 3:44 am

Same here, any solutions so far?

PiWolli
Posts: 1
Joined: Mon Mar 03, 2014 8:06 pm

Re: HELP: Compiling driver error, no /lib/modules/3.10.25+/b

Mon Mar 03, 2014 8:25 pm

I had the same problem.

There is an easy solution for the Problem:

1. Try to install linux-headers

Code: Select all

sudo apt-get install linux-headers
You get a message that you try to install a virtual package and you have to install a concrete package. You find a list of concrete packages.
2. Install the concrete package

Code: Select all

sudo apt-get install linux-headers-3.10-3-rpi
3. Now the trick. You have to link the new build folder with the missing folder.

Code: Select all

sudo ln -s /lib/modules/3.10-3-rpi/build /lib/modules/3.10.25+/build
That's it. Now I can compile the driver. After install the drivers my WLAN module works fine.

Reiszecke
Posts: 4
Joined: Thu Feb 06, 2014 3:31 am

Re: HELP: Compiling driver error, no /lib/modules/3.10.25+/b

Tue Mar 25, 2014 4:35 am

THANKS SO MUCH! That did it for me. Now I am running into the next problem, might have sth to do with that >.>
http://www.raspberrypi.org/phpBB3/viewt ... 28&t=73005

nebula
Posts: 5
Joined: Mon Dec 02, 2013 6:04 am

Re: HELP: Compiling driver error, no /lib/modules/3.10.25+/b

Wed Mar 26, 2014 3:05 am

PiWolli wrote:I had the same problem.
There is an easy solution for the Problem:
Thank you!! I`ve been searching all over the place for this answer.

Seb0
Posts: 3
Joined: Mon Apr 28, 2014 8:32 am

Re: HELP: Compiling driver error, no /lib/modules/3.10.25+/b

Mon Apr 28, 2014 8:35 am

Thanks a lot, the make works well.
Will the driver compiled works well too?!

User avatar
nipponese
Posts: 8
Joined: Wed Apr 30, 2014 6:54 am

Re: HELP: Compiling driver error, no /lib/modules/3.10.25+/b

Tue May 13, 2014 7:26 am

@PiWolli Thanks for this! So why is the install script looking for the wrong headers dir?

edwin6938
Posts: 52
Joined: Tue Apr 01, 2014 4:44 pm

Re: HELP: Compiling driver error, no /lib/modules/3.10.25+/b

Wed Jun 04, 2014 4:18 pm

It doesn t work for me... i have an error. Unable to fetch some archives. ..

LiudvikasLTU
Posts: 2
Joined: Thu Jul 24, 2014 8:48 am

Re: HELP: Compiling driver error, no /lib/modules/3.10.25+/b

Thu Jul 24, 2014 8:50 am

BUMP
I have the same problem as above. Anyone know what should I do?

epierre
Posts: 7
Joined: Thu Nov 19, 2015 12:22 pm

Re: HELP: Compiling driver error, no /lib/modules/3.10.25+/b

Sun Nov 22, 2015 5:13 pm

Hello,

this page well indexed need some updates.

first find your kernel version: uname -a

then search for headers: apt-cache search linux-headers

From it, and since I run a PI2 on a 3.18.5 I have chosen and installed: apt-get install linux-headers-3.18.0-trunk-rpi2

Then I made the symlink: sudo ln -s /lib/modules/3.18.0-trunk-rpi2/build /lib/modules/3.10.25+/build

and then edit Makefile for ARM:
CONFIG_PLATFORM_I386_PC = n
CONFIG_PLATFORM_ARM_RPI = y

and to finish :make / make install which is fine

abm413
Posts: 2
Joined: Sun Mar 27, 2016 10:49 pm

Re: HELP: Compiling driver error, no /lib/modules/3.10.25+/b

Sun Mar 27, 2016 10:50 pm

hey!!! how to get it working for the latest kernel version? help plssss

abm413
Posts: 2
Joined: Sun Mar 27, 2016 10:49 pm

Re: HELP: Compiling driver error, no /lib/modules/3.10.25+/b

Tue Mar 29, 2016 10:48 pm

PiWolli wrote:I had the same problem.

There is an easy solution for the Problem:

1. Try to install linux-headers

Code: Select all

sudo apt-get install linux-headers
You get a message that you try to install a virtual package and you have to install a concrete package. You find a list of concrete packages.
2. Install the concrete package

Code: Select all

sudo apt-get install linux-headers-3.10-3-rpi
3. Now the trick. You have to link the new build folder with the missing folder.

Code: Select all

sudo ln -s /lib/modules/3.10-3-rpi/build /lib/modules/3.10.25+/build
That's it. Now I can compile the driver. After install the drivers my WLAN module works fine.

what is the third step for the newest raspbian jessy? can you tell me please?

User avatar
DougieLawson
Posts: 35529
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: HELP: Compiling driver error, no /lib/modules/3.10.25+/b

Tue Mar 29, 2016 11:00 pm

abm413 wrote:hey!!! how to get it working for the latest kernel version? help plssss
Use https://github.com/notro/rpi-source that does everything you need to get a kernel build environment built (run on your RPi for your current RPi kernel).
Note: Having anything remotely humorous in your signature is completely banned on this forum. Wear a tinfoil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

leftcoastshot
Posts: 1
Joined: Sun Feb 10, 2019 4:56 am

Re: HELP: Compiling driver error, no /lib/modules/3.10.25+/build

Sun Feb 10, 2019 5:32 am

This issue is still around. The error I received in response to my make command:
/lib/modules/4.9.35+/build: No such file or directory.
I found a solution after lots of browsing ... execute this syntax:

Code: Select all

sudo apt-get install raspberrypi-kernel-headers
Now my make command succeeds.

gubertoli
Posts: 1
Joined: Sun Jul 07, 2019 2:44 pm

Re: HELP: Compiling driver error, no /lib/modules/3.10.25+/build

Sun Jul 07, 2019 2:53 pm

leftcoastshot wrote:
Sun Feb 10, 2019 5:32 am
This issue is still around. The error I received in response to my make command:
/lib/modules/4.9.35+/build: No such file or directory.
I found a solution after lots of browsing ... execute this syntax:

Code: Select all

sudo apt-get install raspberrypi-kernel-headers
Now my make command succeeds.
Perfect! This approach worked for Raspbian Stretch and Kernel 4.19.50-v7+

bipbip38
Posts: 2
Joined: Thu Aug 15, 2019 5:27 pm

Re: HELP: Compiling driver error, no /lib/modules/3.10.25+/build

Fri Aug 16, 2019 2:03 pm

Hi,

I have the same trouble.

Code: Select all

 
 sudo mkdir /lib/modules/4.19.58-v7+/build
 sudo apt-get install raspberrypi-kernel-headers
 sudo apt autoremove
 sudo ln -s /lib/modules/4.19.58-v7+/build
 sudo make
 rm rf *.o *~core .depend .*.cmd *.ko *.mod.c .tmp_versions Module.* modules.order
 make -c /lib/modules/4.19.58-V7+/build M=/home/GobiSerial modules
 make[1]: Entering directory `/lib/modules/4.19.58-v7+/build'
 make[1]: *** No rule to make target `modules'.  Stop.
 make[1]: Leaving directory `/lib/modules/3.10.27+/build'
 make: *** [makefile:6: all] Error 2
 
The makefile is :
obj-m := GobiSerial.o
KDIR := /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)

all: clean
$(MAKE) -C $(KDIR) M=$(PWD) modules
clean:
rm -rf *.o *~ core .depend .*.cmd *.ko *.mod.c .tmp_versions Module.* modules.order
some body knew how resolve this trouble?


Thx

Return to “Beginners”