[Ubuntu]Compile/CLI probleem

Pagina: 1
Acties:

Onderwerpen


Acties:
  • 0 Henk 'm!

Verwijderd

Topicstarter
Ik ben bezig om een eigen besturingssysteem te maken, hiervoor moet ik een bibliotheek maken met alle standaard functies volgens ANSI C. Nu is het probleem dat als ik het volgende script uitvoer, gcc het bestand niet kan zien :S (btw.. ik weet niet of dit nou in de DevSchuur hoort, maar aangezien het met djgpp in windows wel werkt leek het mij het best om in NOS te posten ;))

code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
build.sh:

echo "Building Operating System Library..."
echo "Compiling math.c..."
gcc -g -Wall -W -O2 -fno-builtin -nostdinc -c -Iinclude -nostdlib  math.c
echo "Compiling stdio.c..."
gcc -g -Wall -W -O2 -fno-builtin -nostdinc -c -Iinclude -nostdlib  stdio.c
echo "Compiling stdlib.c..."
gcc -g -Wall -W -O2 -fno-builtin -nostdinc -c -Iinclude -nostdlib  stdlib.c
echo "Compiling string.c..."
gcc -g -Wall -W -O2 -fno-builtin -nostdinc -c -Iinclude -nostdlib  string.c
echo "Compiling time.c..."
gcc -g -Wall -W -O2 -fno-builtin -nostdinc -c -Iinclude -nostdlib  time.c

echo "generating library..."
ar rcs osc.lib math.o stdio.o stdlib.o string.o time.o

echo "cleaning object files..."
rm *.o

echo "build finished."


Alles gaat goed tot ik bij de regel kom waar ik time.c wil compilen, dan geeft de shell de volgende melding:

(Totale output)

code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
matthias@athena:~/OSCLibrary$ ./build.sh
Building Operating System Library...
Compiling math.c...
Compiling stdio.c...
Compiling stdlib.c...
Compiling string.c...
Compiling time.c...
: Onbekend bestand of map
gcc: geen invoerbestanden
generating library...
ar: time.o: Onbekend bestand of map
cleaning object files...
build finished.
matthias@athena:~/OSCLibrary$ ls
build.sh   include  osc.lib  stdlib.c  string.c~
build.sh~  math.c   stdio.c  string.c  time.c
matthias@athena:~/OSCLibrary$


Zoals je kunt zien bestaat time.c, maar toch zegt de cli, dat hij niet bestaat :'(

Echt vaag, vooral omdat de andere wel normaal compilen. Als iemand een idee heeft -> _/-\o_

Acties:
  • 0 Henk 'm!

Verwijderd

Wat doet:
gcc -g -Wall -W -O2 -fno-builtin -nostdinc -c -Iinclude -nostdlib time.c?
Geeft dat wel gewoon een time.o?

Acties:
  • 0 Henk 'm!

Verwijderd

Topicstarter
Had ik al geprobeerd, vergeten te melden dat, dat werkt, alleen niet als ik die regel in mijn build.sh stop :S

kijk maar:

code:
1
2
3
4
5
6
7
8
9
10
11
12
13
matthias@athena:~/OSCLibrary$ gcc -g -Wall -W -O2 -fno-builtin -nostdinc -c -Iinclude -nostdlib time.c
matthias@athena:~/OSCLibrary$ ./build.sh Building Operating System Library...
Compiling math.c...
Compiling stdio.c...
Compiling stdlib.c...
Compiling string.c...
Compiling time.c...
: Onbekend bestand of map
gcc: geen invoerbestanden
generating library...
cleaning object files...
build finished.
matthias@athena:~/OSCLibrary$

[ Voor 90% gewijzigd door Verwijderd op 22-03-2006 19:14 ]


Acties:
  • 0 Henk 'm!

Verwijderd

Topicstarter
Oplossing gevonden, lelijke oplossing dat wel, en nog steeds vaag waarom hij het eerst niet deed :S

code:
1
2
3
4
5
6
7
8
9
10
matthias@athena:~/OSCLibrary$ ./build.sh
Building Operating System Library...
Compiling math.c...
Compiling stdio.c...
Compiling stdlib.c...
Compiling string.c...
Compiling time.c...
generating library...
cleaning object files...
build finished.


Oplossing:

code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
echo "Building Operating System Library..."
echo "Compiling math.c..."
gcc -g -Wall -W -O2 -fno-builtin -nostdinc -c -Iinclude -nostdlib  math.c
echo "Compiling stdio.c..."
gcc -g -Wall -W -O2 -fno-builtin -nostdinc -c -Iinclude -nostdlib  stdio.c
echo "Compiling stdlib.c..."
gcc -g -Wall -W -O2 -fno-builtin -nostdinc -c -Iinclude -nostdlib  stdlib.c
echo "Compiling string.c..."
gcc -g -Wall -W -O2 -fno-builtin -nostdinc -c -Iinclude -nostdlib  string.c
echo "Compiling time.c..."
gcc -g -Wall -W -O2 -fno-builtin -nostdinc -c -Iinclude -nostdlib  time.c
#
echo "generating library..."
ar rcs osc.lib math.o stdio.o stdlib.o string.o time.o
echo "cleaning object files..."
rm *.o
echo "build finished."


De oplossing is een comment-teken (#) plaatsen :? 8)7

[ Voor 26% gewijzigd door Verwijderd op 22-03-2006 19:44 ]


Acties:
  • 0 Henk 'm!

  • Bergen
  • Registratie: Maart 2001
  • Laatst online: 07-09 11:44

Bergen

Spellingscontroleur

Mogen er soms geen lege regels in een script? En ziet hij #10#13 (of een van die 2) daardoor misschien alsof 't bij de bestandsnaam time.c hoort?

[ Voor 13% gewijzigd door Bergen op 22-03-2006 22:50 ]


Acties:
  • 0 Henk 'm!

Verwijderd

Topicstarter
Toen ik rm *.lib achter de line van time.c plaatste kreeg ik dit:

rm: cannot remove `*.lib\r': Onbekend bestand of map

lijkt net of mijn editor een \r erachter plakt. Zou dan kunnnen zijn dat hij bestandje niet in plain-text opslaat mij dunkt.

Acties:
  • 0 Henk 'm!

Verwijderd

Topicstarter
Bergen schreef op woensdag 22 maart 2006 @ 19:46:
Mogen er soms geen lege regels in een script? En zie hij #10#13 (of een van die 2) daardoor misschien alsof 't bij de bestandsnaam time.c hoort?
Ook zonder lege regel werkte het niet :X

Het is nu iig opgelost, maar de manier waarop is natuurlijk niet ok, blijf het toch vaag vinden :X

Acties:
  • 0 Henk 'm!

  • Bergen
  • Registratie: Maart 2001
  • Laatst online: 07-09 11:44

Bergen

Spellingscontroleur

Verwijderd schreef op woensdag 22 maart 2006 @ 19:51:
Toen ik rm *.lib achter de line van time.c plaatste kreeg ik dit:

rm: cannot remove `*.lib\r': Onbekend bestand of map

lijkt net of mijn editor een \r erachter plakt. Zou dan kunnnen zijn dat hij bestandje niet in plain-text opslaat mij dunkt.
\r is een carriage return (ASCII code 13). Een editor als kladblok/notepad eindigt elke regel met #13#10 (carriage return, line feed), maar als je in de console files edit met bijvoorbeeld vi(m), dan eindigt elke regel met alleen #10. Misschien is time.c dus in notepad gemaakt en de rest met een grotemensen-editor?

[ Voor 3% gewijzigd door Bergen op 22-03-2006 23:33 ]

Pagina: 1