Linux-Bulgaria.ORG
навигация

 

начало

пощенски списък

архив на групата

семинари ...

документи

как да ...

 

 

Предишно писмо Следващо писмо Предишно по тема Следващо по тема По Дата По тема (thread)

Re: lug-bg: LKM compilation


  • Subject: Re: lug-bg: LKM compilation
  • From: mitko@xxxxxxx (Dimitar Peikov)
  • Date: Mon, 15 Apr 2002 09:40:19 +0300



On Sat, 13 Apr 2002 19:19:35 +0300 (EEST)
Alexander Atanasov <alex@xxxxxx> wrote:

> On Fri, 12 Apr 2002, Dimitar Peikov wrote:
> 
> > BTW: Njakoj na Slackware da e podkarval shared library kojato
> > izpolzva funkcia 'stat' s libc.so? Ne govorja za compilirane a za
> > trugvane!
> 
> ts.c:
> #include <sys/stat.h>
> #include <unistd.h>
> 
> 
> int my_stat(struct stat *s, const char *path)
> {
>         return stat(path,s);
> }
> 
> gcc -Wall -fPIC -shared -o libts.so ts.c
> 
> tsm.c:
> #include <stdio.h>
> #include <sys/stat.h>
> #include <unistd.h>
> #include <errno.h>
> #include <string.h>
> 
> 
> int my_stat(struct stat *s, const char *path);
> 
> int main(int argc, char **argv)
> {
>         struct stat st;
>         int rc;
> 
>         rc=my_stat(&st,((argc>1)?argv[1]:argv[0]));
> 	if(!rc)
> 	{
> 	        printf("size: %lu\n",st.st_size);
> 	} else {
> 	                printf("rc=%d errno=%d
> 	                (%s)\n",rc,errno,strerror(errno));}
>         return 0;
> }
> 
> gcc -Wall -o tsm tsm.c -L. -lts
> 
> export LD_LIBRARY_PATH=.
> ./tsm
> size: 19629
> ls -al tsm
> -rwxr-xr-x   1 root     root        19629 Apr 13 19:10 tsm*
> ./tsm a
> rc=-1 errno=2 (No such file or directory)
> 
> ldd ./tsm
> 
>         libts.so => ./libts.so (0x40016000)
>         libc.so.6 => /lib/libc.so.6 (0x40027000)
>         /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
> 
> lrwxrwxrwx   1 root     root           13 Mar 19 02:14 /lib/libc.so.6
> -> libc-2.2.5.so*
> gcc --version
> egcs-2.91.66
> 
> Tova stava li, na slackware e?
> 
> -- 
> have fun,
> alex
> 

Problema se okazva v podavaneto na argumentite na 'ld'. Po princip sam
fen na FreeBSD, a tam kak shte podadesh parametrite na ld njama
znachenie, vse go smila. Samo che ne taka stoi problema s Slackware:-((

Generiraneto na libxxx.so po star priom go pravia na 2 pass-a ->

1)
gcc -c -o $@ $<

2)
ld -shared -lc *.o

I problema e tochno v 2). Ako se prexvurli -lc sled *.o vsichko si
varvi, njama problemi. Za tova i tova koeto si napravil raboti, zashtoto
gcc-to prashta parametrite pravilno na ld. prosto mi otne malko vreme da
se usetja kade e problema. :-((

BTW: Podoben problem imam samo na Slackware. Sashta code pod *BSD, Red
Hat, SuSE, Solaris raboti bez problemi! Imam predvid che linker-a na
drugite platformi se useshta za bibliotekite :-))

10x za otgovora.

> 
> =====================================================================
> ====== A mail-list of Linux Users Group - Bulgaria (bulgarian
> linuxers) http://www.linux-bulgaria.org/ Hosted by Internet Group Ltd.
> - Stara Zagora
> 


-- 
Dimitar Peikov
Programmer Analyst
Globalization Group
"We Build e-Business"  

RILA Solutions  
27 Building, Acad.G.Bonchev Str.  
1113 Sofia, Bulgaria  

phone: (+359 2) 9797320 
phone: (+359 2) 9797300 
fax:   (+359 2) 9733355  
http://www.rila.com 
===========================================================================
A mail-list of Linux Users Group - Bulgaria (bulgarian linuxers)
http://www.linux-bulgaria.org/ Hosted by Internet Group Ltd. - Stara Zagora




 

наши приятели

 

линукс за българи
http://linux-bg.org

FSA-BG
http://fsa-bg.org

OpenFest
http://openfest.org

FreeBSD BG
http://bg-freebsd.org

KDE-BG
http://kde.fsa-bg.org/

Gnome-BG
http://gnome.cult.bg/

проект OpenFMI
http://openfmi.net

NetField Forum
http://netField.ludost.net/forum/

 

 

Linux-Bulgaria.ORG

Mailing list messages are © Copyright their authors.