Salut,
je n’arrive plus à télécharger mklibs.sh sur le CVS de Debian.
Y’aurait t’il un lien valide quelque part ?
Merci
Salut,
je n’arrive plus à télécharger mklibs.sh sur le CVS de Debian.
Y’aurait t’il un lien valide quelque part ?
Merci
Bonsoir,
tu as des messages d’erreurs quand tu fais ça ? :
~$ apt-cache search mklibs
mklibs - Shared library reduction script
mklibs-copy - Shared library reduction script
Je suis sous fedora6. Elle me sert de plate forme de développement. La debian est sur une compact flash tournant sur une mini itx.
J’aimerai simplement sous fedora 6 ne pas me prendre la tete avec des ldd, pour remplir sur la partition dédiée les librairies du systeme debian en fonction des commandes que je veux lui inclure.
Donc, je cherche les sources du script mklibs.sh et eventuellement les programmes et librairies associées. Quelqu’un pourrait peut-etre les mettre à disposition directement ici en téléchargement ?
Merci de ta réponse.
Je comprends pas trop ce que tu veux mais ceci peut t’aider :
$ apt-file search mklibs.sh
mkinitrd-cd: usr/sbin/mklibs.sh
donc ton script apparient à mkinitrd-cd, que tu trouves là (source et tout) :
bonsoir,
tu pourrais nous dire si ceci équivaut au même :
jcode@debian:~$ sudo apt-get -s source mklibs
Lecture des listes de paquets... Fait
Construction de l'arbre des dépendances... Fait
Nécessité de prendre 10,8ko dans les sources.
Récupération des sources mklibs
en virant l’option -s qui simule (oui moi je n’ai pas besoin de ces sources …).
salut, le mieux est que tu compares :
[code]#!/bin/bash
usage="Usage: $0 [OPTION]… -d DEST FILE …“
try=“Try “`”$0 --help’ for more information"
version=”$0 0.1, Copyright 1999 Marcus Brinkmann”
PATH=/bin:/usr/bin
default_src_path=/lib:/usr/lib
dest="“
exec=”“
action=”"
verbose="false"
no_default_libs=“false”
gcc=${GCC-gcc}
objdump=${OBJDUMP-objdump}
objcopy=${OBJCOPY-objcopy}
check-node () {
local node
for node in “$@” ; do
if [ “xecho $node | sed -e '/ /d'
” = x ] ; then
echo 1>&2 $0: check-node: invalid node "$node"
exit 1
fi
done
return 0
}
is-graph () {
local file
for file in “$@” ; do
if [ ! -e “$file” ] ; then
touch "$qfile"
fi
done
}
add-node () {
if [ $# != 2 ] ; then
echo 1>&2 $0: add-node: internal error: called with invalid number of arguments
exit 1
fi
check-node "$2"
echo “$2 $2” >> "$1"
return 0
}
add-arrow () {
if [ $# != 3 ] ; then
echo 1>&2 $0: add-arrow: internal error: called with invalid number of arguments
exit 1
fi
check-node “$2” "$3"
echo “$2 $3” >> "$1"
return 0
}
find-cycle () {
if [ $# != 1 ] ; then
echo 1>&2 $0: find-cycle: internal error: called with invalid number of arguments
exit 1
fi
tsort “$1” 2> “$fl_dir/find-cycle” > /dev/null
if [ ! -s $fl_dir/find-cycle ] ; then
return 1
else
if [ “xhead -1 $fl_dir/find-cycle
” != “xtsort: cycle in data” ] ; then
echo 1>&2 $0: find-cycle: internal error: tsort has invalid output format
return 2
fi
cat “$fl_dir/find-cycle” | sed -e ‘1d’ -e ‘/tsort: cycle in data/,$d’ -e 's/^tsort: //'
fi
}
equal-match () {
local string
local stringk
string="$1"
shift
for stringk in “$@” ; do
if [ “x$string” = “x$stringk” ] ; then
return 0
fi
done
return 1
}
shrink-nodes () {
local head
local lnode
local rnode
local graph="$1"
shift
is-graph "$graph"
check-node “$@“
local cnode=”[echo "$@" | sed 's/ /,/g'
]”
cat /dev/null > “$fl_dir/shrink-cycle"
while head=get-top-of-queue "$graph"
; do
lnode=echo $head|sed 's/ [^ ]*$//'
if equal-match “$lnode” “$@” ; then
lnode=”$cnode"
fi
rnode=echo $head|sed 's/^[^ ]* //'
if equal-match “$rnode” “$@” ; then
rnode="$cnode"
fi
echo “$lnode $rnode” >> "$fl_dir/shrink-cycle"
done
cat “$fl_dir/shrink-cycle” | sort -u > “$graph”
}
QUEUE_SEPERATOR=SEPERATOR___ABOVE_IS_QUEUE__BELOW_IS_BUCKET___SEPERATOR
check-queue-entry () {
local qentry
for qentry in “$@” ; do
if [ “xecho $qentry | sed "/^$QUEUE_SEPERATOR$/d"
” = x ] ; then
echo 1>&2 $0: check-queue-entry: invalid qentry name "$qentry"
exit 1
fi
done
return 0
}
is-queue () {
local qfile
for qfile in “$@” ; do
if [ ! -e “$qfile” ] ; then
echo “$QUEUE_SEPERATOR” > "$qfile"
else
if ! grep -q “^$QUEUE_SEPERATOR$” “$qfile” ; then
echo “$QUEUE_SEPERATOR” >> “$qfile”;
fi
fi
done
}
get-top-of-queue () {
if [ $# != 1 ] ; then
echo 1>&2 $0: get-top-of-queue: internal error: called with invalid number of arguments
exit 1
fi
is-queue "$1"
local head=head -1 "$1"
if [ “x$head” = “x$QUEUE_SEPERATOR” ] ; then
return 1
else
sed -e 1d “$1” > "$fl_dir/get-top-of-queue"
echo “$head” | tee --append "$fl_dir/get-top-of-queue"
cat “$fl_dir/get-top-of-queue” > "$1"
return 0
fi
}
add-to-queue-if-not-there () {
local qentry
local qfile="$1"
shift
check-queue-entry "$@"
is-queue "$qfile"
for qentry in “$@” ; do
if ! grep -q “^$qentry$” “$qfile” ; then
echo “$qentry” > "$fl_dir/add-to-queue-if-not-there"
cat “$qfile” >> "$fl_dir/add-to-queue-if-not-there"
cat “$fl_dir/add-to-queue-if-not-there” > "$qfile"
fi
done
return 0
}
get-library-depends () {
if [ $# = 0 ] ; then
echo 1>&2 $0: get-library-depends: internal error: no arguments
exit 1
fi
$objdump --private-headers “$@” 2> /dev/null
| sed -n ‘s/^ *NEEDED ([^ ])$/\1/p’
}
get-undefined-symbols () {
if [ $# = 0 ] ; then
echo 1>&2 $0: get-undefined-symbols: internal error: no arguments
exit 1
fi
$objdump --dynamic-syms “$@” 2> /dev/null
| sed -n ‘s/^.* ([^ ]*)$/\1/p’
}
get-provided-symbols () {
if [ $# = 0 ] ; then
echo 1>&2 $0: get-provided-symbols: internal error: no arguments
exit 1
fi
$objdump --syms “$@” 2>/dev/null | grep -v ‘*UND*’
| sed -n ‘s/^[0-9a-f]+ (g | w) … .* [0-9a-f]+ (0x8[08])? ([^ ])$/\3/p’
}
get-provided-symbols-of-so-lib () {
if [ $# = 0 ] ; then
echo 1>&2 $0: get-provided-symbols: internal error: no arguments
exit 1
fi
$objdump --dynamic-syms “$@” 2>/dev/null
| sed -e ‘/*UND*/d’ | sed -n ‘s/^.* ([^ ]*)$/\1/p’
}
get-common-symbols () {
if [ $# != 2 ] ; then
echo 1>&2 $0: get-common-symbols: internal error: called with invalid number of arguments
exit 1
fi
sort -u “$1” > $fl_dir/get-common-symbols
cat $fl_dir/get-common-symbols > "$1"
sort -u “$2” > $fl_dir/get-common-symbols
cat $fl_dir/get-common-symbols > “$2”
local symbol=
while symbol=get-top-of-queue $fl_dir/get-common-symbols
; do
grep ^$symbol$\|^$symbol@ "$1"
done
}
create-link () {
if [ $# != 2 ] ; then
echo 1>&2 $0: create-link: internal error: called with invalid number of arguments
exit 1
fi
if [ ! -e “$2” ] ; then
$action ln -sf “$1” "$2"
fi
}
find-file-glob () {
if [ $# != 2 ] ; then
echo 1>&2 $0: find-file-glob: internal error: exactly two arguments required
exit 1
fi
local path=$1
export dir=echo $path | sed -e 's/:.*$//'
export regex=$2
until [ “x$path” = x ] ; do
if [ “x$dir” != x ] ; then
file=/bin/bash -c 'ls $dir/$regex' 2> /dev/null
if [ “$file” ] ; then
second_match=echo $file | cut -s -d " " -f 2
if [ $second_match ] ; then
echo 1>&2 $0: find-file-glob: $dir/$regex internal error: multiple matches
exit 1
fi
echo "$file"
return 0
fi
fi
path=echo $path | sed -e 's/^[^:]*:*//'
dir=echo $path | sed -e 's/:.*$//'
done
return 1
}
find-file () {
if [ $# != 2 ] ; then
echo 1>&2 $0: find-file: internal error: exactly two arguments required
exit 1
fi
local path=$1
local dir=echo $path | sed -e 's/:.*$//'
until [ “x$path” = x ] ; do
if [ “x$dir” != x ] ; then
if [ -e “$dir/$2” ] ; then
echo "$dir/$2"
return 0
fi
fi
path=echo $path | sed -e 's/^[^:]*:*//'
dir=echo $path | sed -e 's/:.*$//'
done
return 1
}
find-files () {
if [ $# -lt 2 ] ; then
echo 1>&2 $0: find-files: internal error: too few arguments
exit 1
fi
local path="$1" ; shift
while [ $# != 0 ] ; do
find-file $path $1
shift
done
}
get-pic-file () {
if [ $# != 1 ] ; then
echo 1>&2 $0: get-pic-file: internal error: called with invalid number of arguments
exit 1
fi
case “$1” in
libc-*.so)
# For libc.so, we have some extra files to include. The older 2.1.x
# lib uses .so for the object names, while newer ones use .o. Also,
# some of them have an interp object. This should work in all cases.
echo find-files $src_path libc_pic/soinit.so libc_pic/soinit.o \ libc_pic.a libc_pic/sofini.so libc_pic/sofini.o \ libc_pic/interp.o
;;
*)
local libname=echo $1 | sed -e 's/^lib\([^-.]*\)[-.].*/\1/'
echo find-file-glob $src_path lib${libname}*_pic.a
;;
esac
return 0
}
get-extra-flags () {
if [ $# != 1 ] ; then
echo 1>&2 $0: get-extra-flags: internal error: called with invalid number of arguments
exit 1
fi
flags=""
case “$1” in
libc-[0-9]*.so)
# libc.so is a special case, we need the dynamic linker aswell
local ver=echo $1 | sed -e 's/^libc-\(.*\).so/\1/'
flags="find-file $src_path ld-${ver}.so
"
;;
esac
local libname=echo $1 | sed -e 's/^lib\([^-.]*\)[-.].*/\1/'
local map=find-file $src_path lib${libname}_pic.map
test -z “$map” ||
flags="$flags -Wl,–version-script=${map}"
echo $flags
return 0
}
install-small-lib () {
if [ $# != 1 ] ; then
echo 1>&2 $0: install-small-lib: internal error: called with invalid number of arguments
exit 1
fi
local src_file=find-file $src_path $1
if echo "$1" | grep -q ^ld
; then
get-provided-symbols “$src_file” >> $fl_dir/provided-symbols
$action $objcopy --strip-unneeded -R .note -R .comment “$src_file” "$dest/$1"
chmod 755 "$dest/$1"
return 0
fi
local pic_objects=get-pic-file "$1"
local extra_flags=get-extra-flags "$1"
if [ “x$pic_objects” = x ] ; then
$verbose 2>&1 No pic archive for library “$1” found, falling back to simple copy.
get-provided-symbols-of-so-lib “$src_file” >> $fl_dir/provided-symbols
get-undefined-symbols “$src_file” >> $fl_dir/undefined-symbols
$action $objcopy --strip-unneeded -R .note -R .comment “$src_file” "$dest/$1"
else
$verbose 2>&1 Make small lib from “$pic_objects” in “$dest/$1”.
# XXX: If ld is NEEDED, we need to include it on the gcc command line
get-library-depends "$src_file" \
| sed -n -e 's/^lib\([^-.]*\)[-.].*/\1/p' > $fl_dir/lib-dependencies
get-provided-symbols $pic_objects > $fl_dir/lib-provided-symbols
# Argument order does matter:
get-common-symbols $fl_dir/lib-provided-symbols \
$fl_dir/undefined-symbols > $fl_dir/lib-symbols-to-include
local soname=`objdump -x $src_file 2>&1 | grep SONAME | awk '{print $2}'`
($verbose && set -x; ${gcc} \
-nostdlib -nostartfiles -shared \
"-Wl,-soname=$soname" \
`cat $fl_dir/lib-symbols-to-include | sed 's/^/-u/'` \
-o $fl_dir/lib-so $pic_objects $extra_flags -lgcc "-L$dest" \
-L`echo $src_path | sed -e 's/::*/:/g' -e 's/^://' -e 's/:$//' \
-e 's/:/ -L/g'` \
`cat $fl_dir/lib-dependencies | sed 's/^/-l/'`) \
&& $objcopy --strip-unneeded -R .note -R .comment $fl_dir/lib-so $fl_dir/lib-so-stripped \
|| {
echo 1>&2 $0: install-small-lib: $gcc or $objcopy failed.
exit 1
}
get-undefined-symbols $fl_dir/lib-so-stripped \
>> $fl_dir/undefined-symbols
get-provided-symbols-of-so-lib $fl_dir/lib-so-stripped >> $fl_dir/provided-symbols
$action cp $fl_dir/lib-so-stripped "$dest/$1"
fi
}
install-libs-in-sphere () {
if [ $# != 1 ] ; then
echo 1>&2 $0: install-libs-in-sphere: internal error: called with invalid number of arguments
exit 1
fi
local string=echo "$1" | sed -e 's/^\[//' -e 's/\]$//'
local char
local result=
local depth=0
while [ “x$string” != x ] ; do
# Jump to next special char for faster operation.
# Don’t be confused by the regex, it matches everything but ],[
char=echo $string | sed -e 's/^\([^],[]*\).*$/\1/'
string=echo $string | sed -e 's/^[^],[]*//'
result="$result$char";
# Read special char
char=echo $string | sed -e 's/^\(.\).*$/\1/'
string=echo $string | sed -e 's/^.//'
case “$char” in
[) depth=$(($depth+1));;
]) depth=$(($depth-1));;
,) if [ $depth = 0 ] ; then
char=’ ';
fi;;
esac
result="$result$char";
done
$verbose 2>&1 "RESOLVING LOOP…echo $result | md5sum
"
echo XXX: CODE NOT FINISHED
install-libs $result
$verbose 2>&1 "END OF LOOP… echo $result | md5sum
"
}
install-libs () {
local cur_lib
local lib
for cur_lib in “$@” ; do
if echo “$cur_lib” | grep -q ‘^[’ ; then
install-libs-in-sphere "$cur_lib"
else
lib=find-file $src_path $cur_lib
if [ -L “$lib” ] ; then
lib=basename \
readlink $lib``
create-link $lib $dest/$cur_lib
else
install-small-lib $cur_lib
fi
fi
done
}
while :; do
case “$1” in
-L) src_path="$src_path:$2"; shift 2;;
-d|–dest-dir) dest=$2; shift 2;;
-n|–dry-run) action=“echo”; shift;;
-v|–verbose) verbose=“echo”; shift;;
-V|–version) echo “$version”; exit 1;;
-D|–no-default-lib) no_default_libs=“true”; shift;;
-h|–help)
echo "$usage"
echo "Make a set of minimal libraries for FILE … in directory DEST."
echo ''
echo "
Options:
-L DIRECTORY Add DIRECTORY to library search path.
-D, --no-default-lib Do not use default lib directories of $default_src_path
-n, --dry-run Don’t actually run any commands; just print them.
-v, --verbose Print additional progress information.
-V, --version Print the version number and exit.
-h, --help Print this help and exit.
-d, --dest-dir DIRECTORY Create libraries in DIRECTORY.
Required arguments for long options are also mandatory for the short options.“
exit 0;;
-) echo 1>&2 $0: $1: unknown flag; echo 1>&2 “$usage”; echo 1>&2 “$try”; exit 1;;
?) exec=”$exec $1"; shift;;
*) break;;
esac
done
if $no_default_libs; then
src_path=${src_path:-$default_src_path}
else
src_path=${src_path-$default_src_path}
fi
src_path=echo $src_path | sed 's,^:*,,'
if [ “x$exec” = x ] ; then
exit 0
fi
if [ “x$dest” = x ] ; then
echo 1>&2 $0: no destination directory given; echo 1>&2 “$usage”; exit 1
fi
$verbose -n 2>&1 "Initializing data objects… "
fl_dir="/tmp/,mklibs.$$"
set -e
mkdir $fl_dir
set +e
trap “rm -fr $fl_dir” EXIT
get-undefined-symbols $exec > $fl_dir/undefined-symbols
add-to-queue-if-not-there $fl_dir/library-depends get-library-depends $exec
$verbose 2>&1 “done.”
$verbose -n 2>&1 “Constructing dependency graph… (”
while cur_lib=get-top-of-queue $fl_dir/library-depends
do
lib=find-file $src_path $cur_lib
if [ -L “$lib” ] ; then
$verbose -n 2>&1 L
lib=basename \
readlink $lib`add-to-queue-if-not-there $fl_dir/library-depends "$lib" add-arrow $fl_dir/dependency-graph "$cur_lib" "$lib" else get-library-depends "$lib" > $fl_dir/backup if [ "x
head -1 $fl_dir/backup" = x ] ; then $verbose -n 2>&1 N add-node $fl_dir/dependency-graph "$cur_lib" else $verbose -n 2>&1 A for lib in
cat $fl_dir/backup` ; do
add-to-queue-if-not-there $fl_dir/library-depends "$lib"
add-arrow $fl_dir/dependency-graph “$cur_lib” "$lib"
done
fi
fi
done
$verbose 2>&1 “) done.”
if [ ! -f $fl_dir/dependency-graph ]; then
echo 1>&2 mklibs: internal error: $fl_dir/dependency-graph not generated
exit 1
fi
$verbose -n 2>&1 “Eliminating cycles… (”
while cycle=find-cycle "$fl_dir/dependency-graph"
; do
$verbose -n 2>&1 C
shrink-nodes “$fl_dir/dependency-graph” $cycle
done
$verbose 2>&1 “) done.”
tsort $fl_dir/dependency-graph > $fl_dir/backup
install-libs cat $fl_dir/backup
#sort -u $fl_dir/provided-symbols > $fl_dir/diag1
#sort -u $fl_dir/undefined-symbols > $fl_dir/diag2
#cat $fl_dir/diag1 $fl_dir/diag2 | sort | uniq -u > $fl_dir/diag3
#cat $fl_dir/diag3 $fl_dir/diag2 | sort | uniq -d > $fl_dir/diag1
##cat $fl_dir/diag1 | wc
exit 0
[/code]
Non j’ai pas pu, dans les sources, il n’y a pas de script sh …
Par contre j’ai vu que le paquet mkinitrd-cd le contenait, mais est-ce le même ? et je peux pas l’installer ça va m’enlever des paquets que je veux garder.
salut,
euh, je ne comprend pas ce que tu veux faire.
Concernant mklibs.sh tu ne l’installes pas. Tu l’exécutes.
Ce script me sert à remplir le répertoire lib contenant les bibliothèques nécessaires au fonctionnement des programmes installés dans /bin et /sbin dans le cadre de la création d’un système linux embarqué minimal.
Il ne sert qu’à cela.
ah oui, ben c’est bien ce que je dis, ce script se trouve dans le paquet mkinitrd-cd notamment. donc apt-get install mkinitrd-cd nous le fourni … ça doit être le même, c’est juste ce que je voulais dire …
Bon ok, ça y’est, je viens de relire le post du début, et je ne m’étonne plus de ton étonnement … pardon, je suis à la masse en ce moment.
Salut,
pas de problème. La brume s’est dissipée …
On l’a été je crois plus ou moins ces jours çi.
Cela doit être surement les bulles de champagne …
a++