LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-31-2014, 05:42 AM   #1
zerop
Member
 
Registered: Jul 2014
Posts: 65

Rep: Reputation: Disabled
Thumbs up how to include bits/setjmp.h for Make module


i already comment the never include bits/setjmp.h

tried many command to make module, how to make for the file include <bits/setjmp.h> ?

for try and catch exception in module

wonder@wonder-VirtualBox:~/layer$ sudo make -C /usr/src/linux-headers-3.8.0-29-generic hello.c M=/home/wonder/layer modules
make: Entering directory `/usr/src/linux-headers-3.8.0-29-generic'
make: Nothing to be done for `/home/wonder/layer/hello.c'.
CC [M] /home/wonder/layer/hello.o
/home/wonder/layer/hello.c:10:25: fatal error: bits/setjmp.h: No such file or directory
compilation terminated.
make[1]: *** [/home/wonder/layer/hello.o] Error 1
make: *** [_module_/home/wonder/layer] Error 2
make: Leaving directory `/usr/src/linux-headers-3.8.0-29-generic'
wonder@wonder-VirtualBox:~/layer$ sudo make -C /usr/src/linux-headers-3.8.0-29-generic -C /usr/include/i386-linux-gnu/sys -C /usr/include/i386-linux-gnu hello.c M=/home/wonder/layer modules
make: Entering directory `/usr/include/i386-linux-gnu'
make: *** No rule to make target `hello.c'. Stop.
make: Leaving directory `/usr/include/i386-linux-gnu'
wonder@wonder-VirtualBox:~/layer$



Makefile
Code:
ccflags-y += -pg # enable profiling
obj-m += hello.o

hello.o:
    make -o hello -C /usr/src/linux-headers-3.8.0-29-generic -C /usr/include/i386-linux-gnu/sys -C /usr/include/i386-linux-gnu M=$(PWD) modules

clean:
    make -C /usr/src/linux-headers-3.8.0-29-generic -C /usr/include/i386-linux-gnu/sys M=$(PWD) clean
 
Old 07-31-2014, 06:43 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,692

Rep: Reputation: 7274Reputation: 7274Reputation: 7274Reputation: 7274Reputation: 7274Reputation: 7274Reputation: 7274Reputation: 7274Reputation: 7274Reputation: 7274Reputation: 7274
you definitely mixed something.
Code:
hello.o:
    make -o hello -C /usr/src/linux-headers-3.8.0-29-generic -C /usr/include/i386-linux-gnu/sys -C /usr/include/i386-linux-gnu M=$(PWD) modules
it means you want to create the file hello.o, but the command you specified will not do that.
make accepts only one -C argument (or at least in your case those -C options have no meaning).
I think you wanted to invoke gcc instead of make, but I'm not really sure about that, because that line confuses me.
 
Old 07-31-2014, 07:00 AM   #3
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,852
Blog Entries: 1

Rep: Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868
What do you really want to do? Use setjmp and longjmp in your program? Read the manuals.

PS: You shouldn't ever directly include any <bits/*.h> files into your program.

Last edited by NevemTeve; 07-31-2014 at 07:02 AM.
 
Old 07-31-2014, 09:38 PM   #4
zerop
Member
 
Registered: Jul 2014
Posts: 65

Original Poster
Rep: Reputation: Disabled
Question

it can create hello.o

the question is how to include bits/setjmp.h for compilation of module
 
Old 07-31-2014, 11:34 PM   #5
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,852
Blog Entries: 1

Rep: Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868
You shouldn't ever directly include any <bits/*.h> files into your program.

PS: if you have a problem with compilation, then quote the error message you got; if you have a problem with linking, then quote the error message you got.

Last edited by NevemTeve; 07-31-2014 at 11:35 PM.
 
Old 08-01-2014, 12:17 AM   #6
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,692

Rep: Reputation: 7274Reputation: 7274Reputation: 7274Reputation: 7274Reputation: 7274Reputation: 7274Reputation: 7274Reputation: 7274Reputation: 7274Reputation: 7274Reputation: 7274
Quote:
Originally Posted by zerop View Post
it can create hello.o
Actually it does not mean that your posted makefile is correct.
 
Old 08-01-2014, 12:30 AM   #7
zerop
Member
 
Registered: Jul 2014
Posts: 65

Original Poster
Rep: Reputation: Disabled
Question

actually i need to use this for error handling instead of restart virtual machine

if do not include this, how to do error handling when hang?

why kernel source do not use this error handling to prevent panic?

http://www.di.unipi.it/~nids/docs/lo...row_catch.html
 
Old 08-01-2014, 01:46 AM   #8
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,852
Blog Entries: 1

Rep: Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868
Your hello program won't prevent virtual (or physical) computers from hanging, with or without setjmp.

And here is an important note: You shouldn't ever directly include any <bits/*.h> files into your program.

PS: if you have a problem with compilation, then quote the error message you got; if you have a problem with linking, then quote the error message you got.
 
Old 08-01-2014, 04:13 AM   #9
zerop
Member
 
Registered: Jul 2014
Posts: 65

Original Poster
Rep: Reputation: Disabled
i know not to include this,

what will it be after include?

i just want to include to jump to catch statement, then i can rmmod properly
 
Old 08-01-2014, 05:13 AM   #10
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,852
Blog Entries: 1

Rep: Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868
Please don't say you are trying to develop kernel code.
 
Old 08-01-2014, 07:11 AM   #11
zerop
Member
 
Registered: Jul 2014
Posts: 65

Original Poster
Rep: Reputation: Disabled
Question

i just develop kernel module , not kernel code
 
Old 08-01-2014, 07:57 AM   #12
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,852
Blog Entries: 1

Rep: Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868
Good luck.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Kbuild problem when trying to build module with make: cannot find Kbuild.include purnish_dave Linux - Kernel 2 01-13-2014 05:40 PM
cryptography... what's difference between 8bits / 16 bits / 32 bits/ 64 bits/128bits? ybpark81 Linux - Security 4 02-19-2012 08:38 AM
?cause of error? /usr/include/bits/stat.h field 'st_atim' has incomplete type maxreason Programming 2 08-17-2008 01:48 AM
Question about /usr/include/bits/typesizes.h stefaandk Linux - General 2 07-21-2005 07:30 PM
setjmp/longjmp Ctawp Programming 5 12-08-2003 08:23 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:15 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration