Previous Next Table of Contents

5. Metafora kai metaglwttisn programmatwv

Please see also the Linux GCC-FAQ, available in HTML format by FTP from www.mrc-apu.cam.ac.uk in /pub/linux/GCC-FAQ.html.

---------------------------------------------------------------------

5.1 Pws mporw va metaferw eva programma sto linux apo alla leitourgika sustnmata;

Gevika ta programmata se eva unix sustnma xreiazovtai liges allages gia va metafer8ouv se eva allo unix. Apla akolou8nste tis odngies egkatastasns. Eav dev 3erete pws va apavtnsete se merikes erwtnseis kata tnv diadikasia tns egkatastasns mporeite va mavteyete apla, alla autn n avtimetwpisn mporei va odngnsei se programmata me bugs. Se autnv tnv periptwsn to kalutero pou exete va kavete eivai va balete kapoiov allov va kavei to porting tou programmatos gia esas.

Eav exete programmata apo to bsd prepei va dokimasete va xrnsimopoinsete sta katallnla snmeia twv grammwv tou compile tis parametrous: -I/usr/include/bsd kai -lbsd

---------------------------------------------------------------------

5.2 Ti eivai to ld.so kai pou mporw va to brw;

To ld.so eivai o dynamic libary loader. Ka8e diadiko arxeio pou xrnsimopoiei shared libraries paliotera eixe peripou 3K kwdika stnv arxn tou, pou to bon8ouse stnv aveuresn kai to fortwma twv shared libraries. Twra autos o kwdikas exei topo8etn8ei se mia eidikn shared library, /lib/ld.so, opou kai ola ta diadika arxeia mporouv va tov brouv. Etsi ta binaries spatalouv ligotero xwro stov disko kai mporouv va avaba8mistouv eukolotera.

Mporei kaveis va to katebasei apo to tsx-11.mit.edu apo to directory /pub/linux/packages/GCC kai sta mirror site tou. Tn stigmn pou grafetai auto to faq n teleutaia version tou ld.so eivai n ld.so.1.7.11.tar.gz. Evw to /lib/ld-linux.so.1 eivai to idio pragma gia ta ELF binaries kai pngaivei me to idio paketo me tov a.out loader.

---------------------------------------------------------------------

5.3 Exei kaveis metaferei / kavei compile / grayei kapoio XXX programma gia to linux;

Prwta ap'ola, koita3te sto Linux Software Map (LSM) --- eivai sto directory docs sto sunsite.unc.edu, kai se alla ftp sites. Mia mnxavn avazntnsns eivai dia8esimn stov web server http://www.boutell.com/lsm.

Elev3te ta ftp sites (deite to Q2.5 'Pou mporw va brw programmata gia to linux mesw ftp ;') prwta --- elev3te ta find-ls n index arxeia gia ta katallnla strings. Elev3te kai to Linux Projects Map (LPM), sto ftp.ix.de sto /pub/Linux/docs/Projects-Map.gz.

Eav dev breite tipota, mporeite n va katebasete tov kwdika tou programmatos kai va tov kavete compile movoi sas -- deite to Q5.1 'Pws mporw va metaferw eva programma sto Linux ;' -- n, eav eivai megalo paketo pou mporei va xreiazetai allages stov kwdika, steilte eva mnvuma sto newsgroup : comp.os.linux.development.apps.

Eav kavete compile eva megalo programma parakalw avebaste to se eva n kai perissotera ftp sites kai steilte eva mail sto comp.os.linux.announce (steilte to mnvuma sto linux-announce@news.ornl.gov).

Eav yaxvete gia eva efarmogns-tupou programma tote polles pi8avotntes uparxouv va exei grayei kapoios mia dwreav ekdosn. Dokimaste va diabasete to FAQ sto comp.sources.wanted gia odngies sto pws 8a breite kwdikes programmatwv.

8a prepei episns va elev3ete to Projects-FAQ, pou brisketai sto directory /pub/Linux/docs/faqs/Projects-FAQ sto sunsite.unc.edu.

---------------------------------------------------------------------

5.4 Mporw va xrnsimopoinsw se evav 386, kwdika n evav compiler pou exei givei compile se evav 486;

Gevika vai, ektos eav eivai o kernel.

H epilogn -m486 tou GCC, n opoia xrnsimopoieitai gia va dnmiourgn8ouv diadika arxeia gia 486 upologistes odngei stnv dnmiourgia arxeiwv ligo megaluterwv pou ektelouvtai grngorotera sta 486. Omws douleuouv kavovika kai se eva 386, me mia mikrn ptwsn tns apodosns opws eivai fusiko.

Omws apo tnv ekdosn 1.3.35 o kernel xrnsimopoiei kwdika tou 486 n kai tou pentium eav eivai ru8mismevos gia evav 486 n eva pentium avtistoixa, etsi givetai axrnstos gia eva 386.

To GCC mporei va ru8mistei gia evav 386 n 486. H movn diafora eivai oti eav ru8mistei gia 386 n arxikn epilogn 8a eivai to -m386 evw eav exei ru8mistei gia 486 8a eivai to -m486. Se ka8e periptwsn auto mporei va 3eperastei me tnv katallnln parametro se ka8e compile n eav allax8ei katallnla to arxeio : /usr/lib/gcc-lib/i*-linux/n.n.n/specs.

Uparxei mia alpha ekdosn tou GCC n opoia gvwrizei pws 8a epitaxuvei to binary gia tov pentium, alla eivai ligo asta8ns, eidika eav dnlw8ouv parametroi gia uynln epitaxuvsn. To pentium GCC mporei va bre8ei sto tsx-11.mit.edu sto directory /pub/linux/ALPHA/pentium-gcc. Sustnvw tnv xrnsn tou kavovikou 486 GCC stn 8esn tou. Eivai protimotero va xrnsimopoieitai to -m386 sta pentium giati prokuptei kwdikas pou eivai kaluteros, n to elaxisto ligo mikroteros.

---------------------------------------------------------------------

5.5 Ti kavei to gcc -O6;

Autn tn stigmn eivai to idio me to -O2 (GCC 2.5) n -O3 (GCC 2.6, 2.7) n me ka8e ari8mo megalutero apo autous kavei to idio pragma. Ta Makefiles twv kaivouriwv kernel xrnsimopoiouv to -O2, eseis prepei va kavete to idio.

---------------------------------------------------------------------

5.6 Pou eivai ta linux/*.h kai ta asm/*.h;

Auta ta arxeia eivai sta directories /usr/include/linux kai /usr/include/asm.

Ta directories auta prepei va eivai symbolic links stov kwdika tou kernel sto /usr/src/linux kai oxi aln8iva directories.

Eav dev exete tov kwdika tou kernel katebaste tov --- deite tnv (Erwtnsn 7.6 "Pws mporw va avaba8misw / kavw compile 3ava tov kernel mou ;").

Xrnsimopoinste tnv rm gia va apomakruvete peritta arxeia, kai ln gia va dnmiourgnsete ta links :

rm -rf /usr/include/linux /usr/include/asm
ln -sf /usr/src/linux/include/linux /usr/include/linux
ln -sf /usr/src/linux/include/asm /usr/include/asm
Stis meres mas to /usr/src/linux/include/asm eivai eva symbolic link se eva sugkekrimevo asm-$ARCH (???) directory - eav exete evav prosfata 3esumpiesmevo kwdika tou kernel prepei va xrnsimopoinsete tnv evtoln make symlinks. 8a breite episns oti mporei va xreiastei va kavete eva make config se evav tetoio kernel, gia va dnmiourgn8ei to <linux/autoconf.h>.

---------------------------------------------------------------------

5.7 Uparxouv la8n otav dokimazw va kavw compile tov kernel.

Sigoureuteite oti ta /usr/include/linux kai /usr/include/asm dev eivai kavovika directories alla symbolic links sta /usr/src/linux/include/linux kai /usr/src/linux/include/asm avtistoixa.

Eav xreiazetai, sbnste ta xrnsimopoiwvtas tnv rm kai meta tnv ln -s gia va dnmiourgnsete ta links opws stnv Erwtnsn 5.6 'Pou eivai ta arxeia linux/*.h kai ta asm/*.h;'.

8umn8eite oti otav xrnsimopoieite eva patch stov kernel prepei va xrnsimopoinsete tnv parametro -p0 n tnv -p1. Alliws to patch mporei va topo8etn8ei la8os. Deite tnv selida tou man gia tnv evtoln patch gia perissoteres leptomereies.

Eav kavete patch gia evav kernel poio prosfato apo tov 1.1.44 prepei va breite oti uparxouv vea directories /usr/src/linux/include/asm-i386. To directory asm ekei prepei va sbnstei. H evtoln make symlinks 8a dnmiourgnsei auta sav symbolic links sta asm-i36 kai arch/i386/boot avtistoixa. O poio eukolos tropos gia va eiste sigouroi oti n diadikasia exei givei swsta eivai va mnv pate stov kernel 1.1.45 me patch apo tov 1.1.44, alla va katebasete tov linux-1.1.45.tar.gz.

To mnvuma ld: unrecognised option `-qmagic' snmaivei oti prepei va parete evav kaivourio linker, apo to tsx-11.mit.edu sto /pub/linux/packages/GCC, sto arxeio binutils-2.6.0.2.bin.tar.gz.

---------------------------------------------------------------------

5.8 Pws mporw va dnmiourgnsw mia shared library;

Gia ta ELF executables :

   gcc -fPIC -c *.c
   gcc -shared -Wl,-soname,libfoo.so.1 -o libfoo.so.1.0 *.o
Gia ta a.out, parte to paketo tools-n.nn.tar.gz apo to tsx-11.mit.edu, sto /pub/linux/packages/GCC/src. Erxetai mazi me odngies oi opoies 8a sas pouv ti va kavete. Prose3te oti oi koives biblio8nkes gia a.out eivai mia mallov duskoln upo8esn.

---------------------------------------------------------------------

5.9 Ta ektelesima mou eivai (polu) megala.

Me eva metaglwttistn gia ELF (see Q8.2 `What's all this about ELF ?') n suxvotern aitia megalwv ektelesimwv eivai n elleiyn evos katallnlou suvdesmou se .so library gia mia apo tis biblio8nkes pou xrnsimopoieite. Prepei va uparxouv suvdesmoi opws to libc.so gia ka8e biblio8nkn opws n libc.so.5.2.18. Me evav metaglwttistn gia a.out (see Q8.2 `What's all this about ELF ?') n suxvotern aitia megalwv eketelesimwv eivai o orismos tou metaglwttistn -g. Auto paragei (ektos apo mnvumata la8ous sto arxeio e3odou) eva programma statika suvdedemevo, dnladn eva to opoio sumperilambavei eva avtigrafo tns biblio8nkes tns C avti va xrnsimopoiei eva duvamika suvdedemevo avtigrafo. Alla pragmata ta opoia a3izei tov kopo va ereuvnsete eivai ta -O kai -O2 ta opoia evergopoiouv tnv beltistopoinsn (eleg3te tis odngies tou GCC ) kai to -s (n tnv evtoln strip ) n opoia bgazei oles tis plnrofories sumbolwv apo to ektelesimo (kavovtas tov elegxo la8wv - debugging - evtelws aduvato). Mporei va 8elete va xrnsimopoinsete to -N se polu mikra ektelesima (mikrotera apo 8K me to -N), alla dev 8a eprepe va to kavete auto ektos eav katalabaivete ta 8emata apodosns, kai pote me daemons.

---------------------------------------------------------------------

5.10 Upostnrizei to Linux vnmatikes (threads) n lightweight epe3ergasies;

Opws to poluepe3ergastiko movtelo tou Unix sumperilambavei baries epe3ergasies, to opoio eivai fusika meros tou stavtarvt purnva tou Linux, uparxouv diafores ulopoinseis elafriwv epe3ergasiwv n vnmatikwv, oi perissoteres ek twv opoiwv eivai gevika paketa gia Unix:

Parakalw epikoivwvnste me tous dnmiourgous twv paketwv gia plnrofories.

H ekdosn 1.3.35 tou purnva periexei kapoia upostnri3n gia vnmata tou purnva, alla o kwdikas dev exei elegx8ei kala.

S.t.M.: Me tov oro vnmata upo8etw oti o suggrafes evvoei vnmatikn epe3ergasia. H metafrasn egive me auto sav basn.

---------------------------------------------------------------------

5.11 Pou mporw va brw to `lint' gia Linux;

Peripou idia leitourgikotnta sumperilambavetai sto GNU C metaglwttistn (gcc) o opoios xrnsimopoieitai apo ta sustnmata Linux. Xrnsimopoieiste tnv epilogn -Wall gia va evergopoinsete tis perissoteres apo tis xrnsimes e3tra proeidopoinseis. Eleg3te tis odngies xrnsns gia to GCC gia perissoteres plnrofories. (patnste control-h askolou8oumevo apo i sto Emacs kai epile3te tnv kataxwrisn gia to GCC).

Uparxei eva eleu8era dia8esimo programma pou legetai `lclint' pou kavei peripou ta idia pragmata opws to paradosiako lint. H avakoivwsn kai o pngaios kwdikas eivai dia8esima sto larch.lcs.mit.edu in /pub/Larch/lclint sto World Wide Web koita3te sto http://larch-www.lcs.mit.edu:8001/larch/lclint.html.

---------------------------------------------------------------------

5.12 Pou mporw va brw to `kermit' gia Linux;

To austnro copyright tou Kermit exei amvagkasei tous perissoterous diavomeis va to afairesouve apo tis tupikes Linux diavomes. O kwdikas kai merika ektelesima eivai dia8esima sto kermit.columbia.edu ws

kermit/archives/ckermit-6.0.192-7.i386.rpm         # RedHat 
kermit/archives/ckermit-6.0.192-7.sparc.rpm
kermit/archives/ckermit-6.0.192-7.alpha.rpm
kermit/archives/ckermit-6.0.192-7.src.rpm
kermit/archives/cku192.debian.tar                  # Debian
kermit/archives/cku192.slackware-i386.tgz                           # Slackware
Ektelesima gia alla Linux eivai dia8esima sta
kermit/bin/ckuker.linux-2.0-alpha
kermit/bin/ckuker.linux-2.0.27-sparc
kermit/bin/ckuker.linux-2.0.28-mklinux-mach3.0-ppc
kermit/bin/ckuker.linux-1.2.13-i386-elf
kermit/bin/ckuker.linux-2.1.13-i386-elf
Ta arxeia /kermit/bin/READ.ME kai /kermit/archive/READ.ME exouv peraiterw plnrofories.

=====================================================================


Previous Next Table of Contents