Solved

How to fix the linux kernel make error: implicit declaration of function class_device_create

Posted on 2009-05-13
6
3,476 Views
Last Modified: 2013-12-06
When compiling code with make, I got the errors:
--------------------
make -C /lib/modules/`uname -r`/build modules M=$PWD
make: Entering directory `/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686'
  CC [M]  /home/jeff/modules/plp_kmem/plp_kmem.o
/home/jeff/modules/plp_kmem/plp_kmem.c: In function plp_kmem_init:
/home/jeff/modules/plp_kmem/plp_kmem.c:193: error: implicit declaration of function class_device_create
/home/jeff/modules/plp_kmem/plp_kmem.c: In function plp_kmem_exit:
/home/jeff/modules/plp_kmem/plp_kmem.c:212: error: implicit declaration of function class_device_destroy
make[1]: *** [/home/jeff/modules/plp_kmem/plp_kmem.o] Error 1
make: *** [_module_/home/jeff/modules/plp_kmem] Error 2
make: Leaving directory `/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686'
--------------
Can any expert shed some light on it?
0
Comment
Question by:jl66
  • 2
  • 2
  • 2
6 Comments
 
LVL 30

Assisted Solution

by:Kerem ERSOY
Kerem ERSOY earned 100 total points
ID: 24381991
Hi,

This is not a known error. since the kernel 2.6.27.21-170.2.56.fc10.i686 is around nearly 3 months nobody reported something like that. Are you sure that all the necessary headers and develtools in place before you compile your kernel ?

Did you follow all the necessary steps before building?
http://korenofer.blogspot.com/2009/01/building-fedora-10-kernel.html

I hope this helps.

Cheers,
K.
0
 

Author Comment

by:jl66
ID: 24384105
Thanks for the info.
I basically use yum to upgrade Fedora 10 to this release (instead of rpm in the link you recommended). I installed the original one from CDs downloaded from linux site. The issue here is that when I tried to compile an kernel book example, the errors occurred. I believe this example was well written. The error messages are not new. There are some hits on the net, but they are not detail enough, so I asked help from your experts.  
0
 

Author Comment

by:jl66
ID: 24384155
The most important lines in the compiling message seem  as follows:
----
error: implicit declaration of function 'class_device_create'
error: implicit declaration of function 'class_device_destroy'
----
There are some hits in the net. Is there anything I can do to fix this?
0
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 
LVL 11

Expert Comment

by:climbgunks
ID: 24425861
the class_device_* api's  have long been deprecated.... now removed I guess.   Look at using device_create() instead.

0
 
LVL 30

Expert Comment

by:Kerem ERSOY
ID: 24426162
> I basically use yum to upgrade Fedora 10 to this release (instead of rpm in the link you recommended). I
> installed the original one from CDs downloaded from linux site. The issue here is that when I tried to

If wht you mean is you had a previous release of FC and you've upgraded to this version you'll may be need to check your /etc/yum.d folder and look for any .rpmnew files there If you have them you'll need to remove the ones from the older version and and be replaced by the newere version.

I think you're may be getting the older versions when updating. then you do a yum clean and redo yum update before attempting to compile.

ans will you post the output of:
rpm -qa |grep kernel


 
0
 
LVL 11

Accepted Solution

by:
climbgunks earned 400 total points
ID: 24426381

It looks like you're trying to compile the kernel module from the PLP book.   If that's the case, the API they're using is no more, replace the lines where you're getting errors above (they should match the first of each set below)...with the line below it.


- class_device_create(plp_kmem_class, NULL, plp_kmem_dev, NULL, "plp_kmem");
+ device_create(plp_kmem_class, NULL, plp_kmem_dev, "plp_kmem");


- class_device_destroy(plp_kmem_class, plp_kmem_dev);
+ device_destroy(plp_kmem_class, plp_kmem_dev);
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Creating a Samba server for a small office. Ubuntu Linux and Samba can breathe new life into a retired PC and save an office money on new hardware/software. Our example server will have two hard disks, one exclusively for storing shared data. …
Are you sitting there reading this and wondering how to get started with Linux? It almost seems like picking the right Linux distribution is about like picking the right college or buying a new car if you read some of the article out there. Relax… l…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

929 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now