LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 06-09-2009, 06:51 AM   #1
nekkro-kvlt
LQ Newbie
 
Registered: May 2009
Posts: 20

Rep: Reputation: 0
Compil LDasm under ubuntu


I all, I got this error when I try to compile LDasm

Code:
bastien@bastien-laptop:~/disassemblers/LDasm-0.04.53$ make
cd ptrace && make
make[1]: entrant dans le répertoire « /home/bastien/disassemblers/LDasm-0.04.53/ptrace »
gcc -O3 -Wall -lbfd -liberty -o ptrace ptrace.c
ptrace.c:29:24: erreur: linux/user.h : Aucun fichier ou dossier de ce type
"Aucun fichier ou dossier de ce type" means file not found

So i did
Code:
bastien@bastien-laptop:~/disassemblers/LDasm-0.04.53$ locate linux/user.h
/usr/src/linux-headers-2.6.28-11/include/linux/user.h
/usr/src/linux-headers-2.6.28-11-generic/include/linux/user.h
And modified makefile
Code:
DEST_DIR = /opt/ldasm
BIN_DIR  = /usr/local/bin
INCLUDEPATH += /usr/src/linux-headers-2.6.28-11/include/ \
		/usr/src/linux-headers-2.6.28-11-generic/include/
But still same error... Any idea ?

Thanks.
 
Old 06-09-2009, 07:47 AM   #2
weibullguy
ReliaFree Maintainer
 
Registered: Aug 2004
Location: Kalamazoo, Michigan
Distribution: Slackware 14.2
Posts: 2,815
Blog Entries: 1

Rep: Reputation: 261Reputation: 261Reputation: 261
What happens if you call make like this?
Code:
make CC="gcc -I/usr/src/linux-headers-2.6.28-11/include/"

Last edited by weibullguy; 06-09-2009 at 07:59 AM.
 
Old 06-09-2009, 08:56 AM   #3
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
'LDasm-0.04.53'
Dependencies : binutils-dev

Sorry, @ weibullguy, your suggestion doesn't work, don't know why, the
first header asked for ( linux/user.h ) should have been found then.
.....
'linux/user.h' will require some headers too ....

cd /usr/include/
sudo ln -s /usr/src/linux-headers-2.6.28-11/arch/x86/include/asm/user_64.h

cd linux/
sudo ln -s /usr/src/linux-headers-2.6.28-11/include/linux/user.h

cd ../asm/
sudo ln -s /usr/src/linux-headers-2.6.28-11/arch/x86/include/asm/user.h
sudo ln -s /usr/src/linux-headers-2.6.28-11/arch/x86/include/asm/page.h
..... then all headers are found.

But 'LDasm-0.04.53' is from Dec. 18' 2002 and doesn't compile on
Ubuntu 9.04 with gcc-4.3.3 or gcc-3.4 .
May be the headers and the compiler should be 2002 style ? gcc-2.95 ?
Or the code is buggy ?
.....

Last edited by knudfl; 06-10-2009 at 12:09 AM.
 
Old 06-09-2009, 09:43 AM   #4
nekkro-kvlt
LQ Newbie
 
Registered: May 2009
Posts: 20

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by weibullguy View Post
What happens if you call make like this?
Code:
make CC="gcc -I/usr/src/linux-headers-2.6.28-11/include/"
Hi, I tried, then I got an error with asm/user.h, so I add the path like that:
Code:
make CC="gcc -I/usr/src/linux-headers-2.6.28-11/include/ -I/usr/src/linux-headers-2.6.28-11/arch/x86/include/asm/"
And then I got new errors about the file mc146818rtc.h, and I add it with:
Code:
make CC="gcc -I/usr/src/linux-headers-2.6.28-11/include/ -I/usr/src/linux-headers-2.6.28-11/arch/x86/include/asm/ -I/usr/src/linux-headers-2.6.28-11/arch/x86/include/asm/ -I/usr/src/linux-headers-2.6.28-11/include/linux/" 2> trace.log
Then come a lot of errors:
Code:
n file included from /usr/include/stdio.h:75,
                 from ptrace.c:22:
/usr/include/libio.h:332: erreur: expected specifier-qualifier-list before ‘size_t’
/usr/include/libio.h:364: erreur: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/libio.h:373: erreur: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/libio.h:493: erreur: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_IO_sgetn’
In file included from ptrace.c:22:
/usr/include/stdio.h:312: erreur: expected declaration specifiers or ‘...’ before ‘size_t’
It's like none of the include files are detected !!!

BTW, why doesn't it work if i Set CC into the make file ?
 
Old 06-09-2009, 11:31 AM   #5
weibullguy
ReliaFree Maintainer
 
Registered: Aug 2004
Location: Kalamazoo, Michigan
Distribution: Slackware 14.2
Posts: 2,815
Blog Entries: 1

Rep: Reputation: 261Reputation: 261Reputation: 261
Quote:
Originally Posted by nekkro-kvlt View Post
BTW, why doesn't it work if i Set CC into the make file ?
It does, but you didn't set CC in your original post. Open the file ptrace/Makefile and you'll see CC = gcc at the very top. Change this to add the paths to the kernel headers like this.
Code:
CC = gcc -I/usr/src/linux-headers-2.6.28-11/include/
The other option is to create the symlinks like knudfl suggests. Either way, I think you're going to be doing some editing of the code in LDasm to make it compatible with more recent headers. After making a handful of changes, I did manage to get LDasm to build. I don't know if it works, but it did build on my machine.
 
Old 06-09-2009, 01:16 PM   #6
nekkro-kvlt
LQ Newbie
 
Registered: May 2009
Posts: 20

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by weibullguy View Post
It does, but you didn't set CC in your original post. Open the file ptrace/Makefile and you'll see CC = gcc at the very top. Change this to add the paths to the kernel headers like this.
Code:
CC = gcc -I/usr/src/linux-headers-2.6.28-11/include/
The other option is to create the symlinks like knudfl suggests. Either way, I think you're going to be doing some editing of the code in LDasm to make it compatible with more recent headers. After making a handful of changes, I did manage to get LDasm to build. I don't know if it works, but it did build on my machine.
Hi, could you please tell me which canges ? Only symlinks or code source tweaking ? I have to admin that I didn't make C for a while, I'm more into networking stuff
 
Old 06-09-2009, 03:10 PM   #7
weibullguy
ReliaFree Maintainer
 
Registered: Aug 2004
Location: Kalamazoo, Michigan
Distribution: Slackware 14.2
Posts: 2,815
Blog Entries: 1

Rep: Reputation: 261Reputation: 261Reputation: 261
I had to change ptrace/ptrace.c. Changed
Code:
typedef enum { FALSE = 0,TRUE } Bool;
to
Code:
#define FALSE 0
#define TRUE 1
typedef int Bool;
Changed all instances of _cooked_size to simply size. Changed all references to .eip to .ip. I included all of the kernel header include paths in the CC variable in ptrace/Makefile. I didn't make the symlinks because:

a. I didn't need the headers except to build LDasm.
b. If the kernel devs wanted those headers available to the system, they would have included them in the install headers target. The symlinks probably won't cause any problems, but who knows?

Last edited by weibullguy; 06-09-2009 at 03:13 PM.
 
Old 06-09-2009, 03:13 PM   #8
nekkro-kvlt
LQ Newbie
 
Registered: May 2009
Posts: 20

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by weibullguy View Post
I had to change ptrace/ptrace.c. Changed
Code:
typedef enum { FALSE = 0,TRUE } Bool;
to
Code:
#define FALSE 0
#define TRUE 1
typedef int Bool;
Changed all instances of _cooked_size to simply size. Changed all references to .eip to .ip. I included all of the kernel header include paths in the CC variable in ptrace/Makefile. I didn't make the symlinks because:

a. I didn't need the headers except to build LDasm.
b. If the kernel devs wanted those headers available to the system, they would have included them in the install headers target. The symlinks probably won't cause any problems, but who knows?
Thanks, i'll try it tomorrow
 
Old 11-20-2010, 10:00 PM   #9
nenopera
LQ Newbie
 
Registered: Nov 2010
Posts: 1

Rep: Reputation: 0
deep changes on kernel sources

Actually, the problems are the changes on kernel sources. I googled this problem and found there was several kernel sources without the asm symlink -and a lot of obscured and wrong solutions- You only need this changes:

TRUE and FALSE are defines on bfd.h so change

Code:
typedef enum { FALSE = 0,TRUE } Bool;
to

Code:
typedef bfd_boolean Bool;
Thus, perpetuating the "reinvented the wheel" case of boolean in C (Why not?, It seems to be a once in lifetime must-do, at least for programmers). I think there are few uses of Bool typedef in this code, refactor it if you prefer.

Another change is a member called _cooked_size, His new name is size. Change it, there is two occurrences in code.

Next problem. There is no more need for asm-x86 or sibling links, seems that a change in sources avoid this type of architectural link. I think asm was left intented to reveal old code.

If you look in /usr/src/linux-headers`uname -r`/arch/x86/include/ you will find this sources, and instruccions for changes.

There is nothing remarked on arch/user.h, so remove it. Change

#include <linux/users.h>

to

(well, just wait a minute)

Recompile. You will get and error about users_regs_struct. Look for it on "arch" and you will find in the comments that it is replaced by pt_regs. Ok, where the hell is pt_regs defined?

Relaying on ANSI sources coding conventions, you can look for (read grep)
Code:
struct pt_regs {
, and you'll find it is defined on linux/ptrace.h

then replace last include with

#include <linux/ptrace.h>

You are done.

Last edited by nenopera; 11-20-2010 at 10:06 PM.
 
  


Reply



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
ldasm run error vexer Linux - Software 1 06-09-2009 06:19 AM
problem with compil kernel!! kaktous Debian 5 03-18-2005 11:53 PM
error to compil glibc-2.3.3 2mk-master Linux From Scratch 0 02-26-2005 07:07 PM
freecraft 1.18.. compil problems... trey85stang Linux - Games 0 04-26-2004 09:24 AM
compil abiword ! ShiShi *BSD 0 03-18-2003 08:05 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:23 PM.

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