Linux - SoftwareThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511
Rep:
'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 ?
.....
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 ?
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.
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
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.
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?
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)
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.