Solved

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

Posted on 2009-05-13
6
3,540 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
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
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

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

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

In order for businesses to be compliant with certain information security laws in some countries, you need to be able to prove that a user (which user it was becomes important to the business to take action against the user after an event has occurr…
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…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

828 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