LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Coreutils recompilation (https://www.linuxquestions.org/questions/linux-newbie-8/coreutils-recompilation-4175525398/)

jena_arch 11-14-2014 10:26 AM

Coreutils recompilation
 
Hello everybody, that's my 1st post, I hope I won't do anything wrong.. (sorry for my not british-english language)

My problem:
I have to recompile coreutils on arch linux
- with debug symbols
- without doing any binary stripping
- forcing the use of frame pointer register

besides I've alredy done that for glibc, and fortunately it worked, but the same commands didn't do the same for coreutils

Here what I did with glibc:


Code:

git clone git://sourceware.org/git/glibc.git
cd glibc
git checkout --track -b local_glibc-2.20 master
mkdir build_glibc
cd build_glibc
../glibc-2.20/configure CFLAGS='-g -Og -fno-omit-frame-pointer -ggdb3' --prefix=/usr
make -j 8
make install -j 8



and here what I get:
Code:

file /usr/lib/libc-2.20.so
(ELF 64-bit … dynamically linked … not stripped !)
Code:

readelf --debug-dump /usr/lib/libc-2.20.so | less -Mr
(more or less 3'484'620 rows, brilliant!)


For coreutils:
Code:

wget -c http://ftp.gnu.org/gnu/coreutils/coreutils-8.23.tar.xz
tar -xvJf coreutils-8.23.tar.xz
./configure CFLAGS='-g -Og -fno-omit-frame-pointer -ggdb3'
make -j 8
make install -j 8



but ...
Code:

file /bin/ls
(/bin/ls: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=... ... ..., stripped )

(:banghead:oh no it's stripped and there aren't symbols!)

thank you,
jena_arch

Keith Hedger 11-14-2014 06:31 PM

It is probably the makefile doing the stripping automatically,, have a look there first, why do you 'HAVE' to build it with out striping etc, if this is homework then please say so.

jena_arch 11-15-2014 03:12 AM

Thank you for your answer Keith Hedger,
it's not properly a homework, it' more like a optional exercise in three parts (that one which I posted is just one of them) suggested by my o.s. professor for those who want to go beyond the mere teaching..

Quote:

It is probably the makefile doing the stripping automatically
saying that are you saying "there is no way avoiding stripping" or I can give to make command arguments to avoid it?

I tried
Code:

make --help
but it wasn't enlighten..
Quote:

Usage: make [options] [target] ...
Options:
-b, -m Ignored for compatibility.
-B, --always-make Unconditionally make all targets.
-C DIRECTORY, --directory=DIRECTORY
Change to DIRECTORY before doing anything.
-d Print lots of debugging information.
--debug[=FLAGS] Print various types of debugging information.
-e, --environment-overrides
Environment variables override makefiles.
--eval=STRING Evaluate STRING as a makefile statement.
-f FILE, --file=FILE, --makefile=FILE
Read FILE as a makefile.
-h, --help Print this message and exit.
-i, --ignore-errors Ignore errors from recipes.
-I DIRECTORY, --include-dir=DIRECTORY
Search DIRECTORY for included makefiles.
-j [N], --jobs[=N] Allow N jobs at once; infinite jobs with no arg.
-k, --keep-going Keep going when some targets can't be made.
-l [N], --load-average[=N], --max-load[=N]
Don't start multiple jobs unless load is below N.
-L, --check-symlink-times Use the latest mtime between symlinks and target.
-n, --just-print, --dry-run, --recon
Don't actually run any recipe; just print them.
-o FILE, --old-file=FILE, --assume-old=FILE
Consider FILE to be very old and don't remake it.
-O[TYPE], --output-sync[=TYPE]
Synchronize output of parallel jobs by TYPE.
-p, --print-data-base Print make's internal database.
-q, --question Run no recipe; exit status says if up to date.
-r, --no-builtin-rules Disable the built-in implicit rules.
-R, --no-builtin-variables Disable the built-in variable settings.
-s, --silent, --quiet Don't echo recipes.
-S, --no-keep-going, --stop
Turns off -k.
-t, --touch Touch targets instead of remaking them.
--trace Print tracing information.
-v, --version Print the version number of make and exit.
-w, --print-directory Print the current directory.
--no-print-directory Turn off -w, even if it was turned on implicitly.
-W FILE, --what-if=FILE, --new-file=FILE, --assume-new=FILE
Consider FILE to be infinitely new.
--warn-undefined-variables Warn when an undefined variable is referenced.

This program built for x86_64-unknown-linux-gnu
Report bugs to <bug-make@gnu.org>
what should I do?

Keith Hedger 11-15-2014 04:52 AM

Well to start make --help gives help info for the make program, which is controlled by a makefile which in turn does the actual compiling/installing etc, so in this case 'make --help' doesn't really help, some make files have a 'help' target which can hold useful info wnad would be used like so:
Code:

make help
but this is far from the norm, and is not available in coreutils.

Usually the strip is done separately from the make/install, again not always.

I have had a look at the makefile, it does no stripping, also the commands you give:
Code:

./configure CFLAGS='-g -Og -fno-omit-frame-pointer -ggdb3'
make -j 8
make install DESTDIR=/tmp/xxxx

And they work fine and give this:
Code:

file /tmp/xxxx/usr/local/bin/ls
/tmp/xxxx/usr/local/bin/ls: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, not stripped

So maybe use the DESTDIR=xxx method to make sure you are checking the right file?

jena_arch 11-16-2014 04:14 PM

[solved]
 
thank you very much keith hedger:hattip:, I understood something more about makefiles, and the idea to use "DESTDIR" was great, it worked perfectly at first attempt!!

I think that thread can be closed because, alredy solved.

jena_arch


All times are GMT -5. The time now is 06:11 AM.