Problème à la compilation
22 posts
• Page 1 of 3 • 1, 2, 3
Problème à la compilation
Bonjour,
Je souhaite utiliser la fonction sleep() mais il y a une erreur à la compilation. Ci-dessous le code source :
#include
int main(void) {
sleep(2000);
}
Le message d'erreur est le suivant :
$ make
nspire-gcc -Os -Wall -W -c toutnoir.c
toutnoir.c: In function 'main':
toutnoir.c:5:1: warning: control reaches end of non-void function
nspire-ld -nostdlib toutnoir.o -o toutnoir.elf
c:/ti/yagarto/bin/../lib/gcc/arm-none-eabi/4.5.2/../../../../arm-none-eabi/bin/ld.exe: c:/ti/ndless20/sdk/bin/../liblibndls.a(sleep.o): Unknown mandatory EABI object attribute 44
c:/ti/yagarto/bin/../lib/gcc/arm-none-eabi/4.5.2/../../../../arm-none-eabi/bin/ld.exe: failed to merge target specific data of file c:/ti/ndless20/sdk/bin/../liblibndls.a(sleep.o)
c:/ti/yagarto/bin/../lib/gcc/arm-none-eabi/4.5.2/../../../../arm-none-eabi/bin/ld.exe: c:/ti/ndless20/sdk/bin/../liblibndls.a(idle.o): Unknown mandatory EABI object attribute 44
c:/ti/yagarto/bin/../lib/gcc/arm-none-eabi/4.5.2/../../../../arm-none-eabi/bin/ld.exe: failed to merge target specific data of file c:/ti/ndless20/sdk/bin/../liblibndls.a(idle.o)
collect2: ld returned 1 exit status
make: *** [toutnoir.tns] Error 1
Ci dessous le makefile pour information :
GCC = nspire-gcc
LD = nspire-ld
GCCFLAGS = -Os -Wall -W
LDFLAGS = -nostdlib
OBJCOPY := "$(shell which arm-elf-objcopy 2/dev/null)"
ifeq (${OBJCOPY},"")
OBJCOPY := arm-none-eabi-objcopy
endif
EXE = hexeditor.tns
OBJS = hexeditor.o
DISTDIR = ../../calcbin/samples
vpath %.tns $(DISTDIR)
all: $(EXE)
%.o: %.c
$(GCC) $(GCCFLAGS) -c $
$(EXE): $(OBJS)
$(LD) $(LDFLAGS) $^ -o $(@:.tns=.elf)
mkdir -p $(DISTDIR)
$(OBJCOPY) -O binary $(@:.tns=.elf) $(DISTDIR)/$@
clean:
rm -f *.o *.elf
rm -f $(DISTDIR)/$(EXE)
Ca ne marche plus depuis que je suis passé à ndless2.0. J'ai le même genre d'erreur avec la fonction wait_key_pressed(void)
Quelqu'un pourrait t'il m'éclairer ?
Je souhaite utiliser la fonction sleep() mais il y a une erreur à la compilation. Ci-dessous le code source :
#include
int main(void) {
sleep(2000);
}
Le message d'erreur est le suivant :
$ make
nspire-gcc -Os -Wall -W -c toutnoir.c
toutnoir.c: In function 'main':
toutnoir.c:5:1: warning: control reaches end of non-void function
nspire-ld -nostdlib toutnoir.o -o toutnoir.elf
c:/ti/yagarto/bin/../lib/gcc/arm-none-eabi/4.5.2/../../../../arm-none-eabi/bin/ld.exe: c:/ti/ndless20/sdk/bin/../liblibndls.a(sleep.o): Unknown mandatory EABI object attribute 44
c:/ti/yagarto/bin/../lib/gcc/arm-none-eabi/4.5.2/../../../../arm-none-eabi/bin/ld.exe: failed to merge target specific data of file c:/ti/ndless20/sdk/bin/../liblibndls.a(sleep.o)
c:/ti/yagarto/bin/../lib/gcc/arm-none-eabi/4.5.2/../../../../arm-none-eabi/bin/ld.exe: c:/ti/ndless20/sdk/bin/../liblibndls.a(idle.o): Unknown mandatory EABI object attribute 44
c:/ti/yagarto/bin/../lib/gcc/arm-none-eabi/4.5.2/../../../../arm-none-eabi/bin/ld.exe: failed to merge target specific data of file c:/ti/ndless20/sdk/bin/../liblibndls.a(idle.o)
collect2: ld returned 1 exit status
make: *** [toutnoir.tns] Error 1
Ci dessous le makefile pour information :
GCC = nspire-gcc
LD = nspire-ld
GCCFLAGS = -Os -Wall -W
LDFLAGS = -nostdlib
OBJCOPY := "$(shell which arm-elf-objcopy 2/dev/null)"
ifeq (${OBJCOPY},"")
OBJCOPY := arm-none-eabi-objcopy
endif
EXE = hexeditor.tns
OBJS = hexeditor.o
DISTDIR = ../../calcbin/samples
vpath %.tns $(DISTDIR)
all: $(EXE)
%.o: %.c
$(GCC) $(GCCFLAGS) -c $
$(EXE): $(OBJS)
$(LD) $(LDFLAGS) $^ -o $(@:.tns=.elf)
mkdir -p $(DISTDIR)
$(OBJCOPY) -O binary $(@:.tns=.elf) $(DISTDIR)/$@
clean:
rm -f *.o *.elf
rm -f $(DISTDIR)/$(EXE)
Ca ne marche plus depuis que je suis passé à ndless2.0. J'ai le même genre d'erreur avec la fonction wait_key_pressed(void)
Quelqu'un pourrait t'il m'éclairer ?
-
caviar
Niveau 3: MH (Membre Habitué)- Posts: 18
- Joined: 15 May 2011, 00:00
- Gender:
- Calculator(s):→ MyCalcs profile
- Class: TS
Re: Problème à la compilation
Déjà, à la fin de la fonction main(), il faut mettre un "return 0;"
Ensuite tu peux virer dans le makefile la ligne "LDFLAGS = -nostdlib", qui a peu d’intérêt et surtout qui t'empêche d'utiliser la bibli standard.
Ensuite, Ndless a besoin d'une version plus à jour du compilo, j'ai également eu le problème des "Unknown mandatory object..."
Je t'invite à regarder ici, peut-être trouveras tu la solution. Critor explique très bien. En gros, il faut mettre à jour Yagarto, avec binutils 2.21
Ensuite tu peux virer dans le makefile la ligne "LDFLAGS = -nostdlib", qui a peu d’intérêt et surtout qui t'empêche d'utiliser la bibli standard.
Ensuite, Ndless a besoin d'une version plus à jour du compilo, j'ai également eu le problème des "Unknown mandatory object..."
Je t'invite à regarder ici, peut-être trouveras tu la solution. Critor explique très bien. En gros, il faut mettre à jour Yagarto, avec binutils 2.21
Mes programmes en Lua pour TI-Nspire : Snake, Space invaders, Bobby Carrot, Minesweeper, Mazes 3D, nSpaint, FreeCell, Tiny3D-Viewer, CubeField
-
ChockostaPremium
Niveau 10: GR (Guide de Référence)- Posts: 213
- Joined: 24 Feb 2011, 00:00
- Gender:
- Calculator(s):→ MyCalcs profile
- Class: Math sup
Re: Problème à la compilation
Merci pour ton aide Chokosta, la solution était bien de mettre à jour Yagarto avec binutils 2.21.
Merci encore
Merci encore
-
caviar
Niveau 3: MH (Membre Habitué)- Posts: 18
- Joined: 15 May 2011, 00:00
- Gender:
- Calculator(s):→ MyCalcs profile
- Class: TS
Re: Problème à la compilation
Je me permets de reposer une nouvelle question dans la foulée. J'ai le code source suivant :
#include
int main(void) {
wait_key_pressed();
return 0;
}
Et le message d'erreur suivant :
nspire-ld toutnoir.o -o toutnoir.elf
c:/ti/ndless20/sdk/bin/../liblibndls.a(touchpad.o): In function `touchpad_getinfo':
touchpad.c:(.text+0x100): undefined reference to `is_touchpad'
c:/ti/ndless20/sdk/bin/../liblibndls.a(touchpad.o): In function `touchpad_scan':
touchpad.c:(.text+0x188): undefined reference to `is_touchpad'
collect2: ld returned 1 exit status
make: *** [toutnoir.tns] Error 1
et le makefile suivant :
GCC = nspire-gcc
LD = nspire-ld
GCCFLAGS = -Os -Wall -W
LDFLAGS =
OBJCOPY := "$(shell which arm-elf-objcopy 2/dev/null)"
ifeq (${OBJCOPY},"")
OBJCOPY := arm-none-eabi-objcopy
endif
EXE = toutnoir.tns
OBJS = toutnoir.o
DISTDIR = ../../calcbin/samples
vpath %.tns $(DISTDIR)
all: $(EXE)
%.o: %.c
$(GCC) $(GCCFLAGS) -c $
$(EXE): $(OBJS)
$(LD) $(LDFLAGS) $^ -o $(@:.tns=.elf)
mkdir -p $(DISTDIR)
$(OBJCOPY) -O binary $(@:.tns=.elf) $(DISTDIR)/$@
clean:
rm -f *.o *.elf
rm -f $(DISTDIR)/$(EXE)
D'où vient le problème ?
#include
int main(void) {
wait_key_pressed();
return 0;
}
Et le message d'erreur suivant :
nspire-ld toutnoir.o -o toutnoir.elf
c:/ti/ndless20/sdk/bin/../liblibndls.a(touchpad.o): In function `touchpad_getinfo':
touchpad.c:(.text+0x100): undefined reference to `is_touchpad'
c:/ti/ndless20/sdk/bin/../liblibndls.a(touchpad.o): In function `touchpad_scan':
touchpad.c:(.text+0x188): undefined reference to `is_touchpad'
collect2: ld returned 1 exit status
make: *** [toutnoir.tns] Error 1
et le makefile suivant :
GCC = nspire-gcc
LD = nspire-ld
GCCFLAGS = -Os -Wall -W
LDFLAGS =
OBJCOPY := "$(shell which arm-elf-objcopy 2/dev/null)"
ifeq (${OBJCOPY},"")
OBJCOPY := arm-none-eabi-objcopy
endif
EXE = toutnoir.tns
OBJS = toutnoir.o
DISTDIR = ../../calcbin/samples
vpath %.tns $(DISTDIR)
all: $(EXE)
%.o: %.c
$(GCC) $(GCCFLAGS) -c $
$(EXE): $(OBJS)
$(LD) $(LDFLAGS) $^ -o $(@:.tns=.elf)
mkdir -p $(DISTDIR)
$(OBJCOPY) -O binary $(@:.tns=.elf) $(DISTDIR)/$@
clean:
rm -f *.o *.elf
rm -f $(DISTDIR)/$(EXE)
D'où vient le problème ?
-
caviar
Niveau 3: MH (Membre Habitué)- Posts: 18
- Joined: 15 May 2011, 00:00
- Gender:
- Calculator(s):→ MyCalcs profile
- Class: TS
Re: Problème à la compilation
Hmm, j'ai déjà vu cette erreur... Ca n'est pas que tu compiles avec -nostdlib, mais il doit falloir mettre -lndls ?
Membre de la TI-Chess Team.
Co-mainteneur de GCC4TI (documentation en ligne de GCC4TI), TIEmu et TILP.
Co-mainteneur de GCC4TI (documentation en ligne de GCC4TI), TIEmu et TILP.
-
Lionel DebrouxSuper Modo
Niveau 14: CI (Calculateur de l'Infini)- Posts: 6869
- Joined: 23 Dec 2009, 00:00
- Location: France
- Gender:
- Calculator(s):→ MyCalcs profile
- Class: -
- GitHub: debrouxl
Re: Problème à la compilation
Peux tu retester une compilation après avoir supprimé les différents fichiers ".o" du dossier system/ du SDK Ndless?
-
ExtendeDPremium
Niveau 8: ER (Espèce Rare: nerd)- Posts: 204
- Joined: 30 Dec 2004, 00:00
- Gender:
- Calculator(s):→ MyCalcs profile
- Class: N/A
Re: Problème à la compilation
Bonjour,
Je viens d'essayer une compilation avec le paramètre -lndls mais rien n'y fait. De même, aucun résultat si je supprime les fichiers *.o du dossier system.
Peux être est-ce un bug de Ndless ?
Je viens d'essayer une compilation avec le paramètre -lndls mais rien n'y fait. De même, aucun résultat si je supprime les fichiers *.o du dossier system.
Peux être est-ce un bug de Ndless ?
-
caviar
Niveau 3: MH (Membre Habitué)- Posts: 18
- Joined: 15 May 2011, 00:00
- Gender:
- Calculator(s):→ MyCalcs profile
- Class: TS
Re: Problème à la compilation
Peux-tu montrer la sortie de la compilation que tu obtiens juste après suppression de *.o de system/ ?
-
ExtendeDPremium
Niveau 8: ER (Espèce Rare: nerd)- Posts: 204
- Joined: 30 Dec 2004, 00:00
- Gender:
- Calculator(s):→ MyCalcs profile
- Class: N/A
Re: Problème à la compilation
Voici le message d'erreur à la compilation :
$ make
nspire-ld toutnoir.o -o toutnoir.elf
c:/ti/ndless20/sdk/bin/../liblibndls.a(touchpad.o): In function `touchpad_getinfo':
touchpad.c:(.text+0x100): undefined reference to `is_touchpad'
c:/ti/ndless20/sdk/bin/../liblibndls.a(touchpad.o): In function `touchpad_scan':
touchpad.c:(.text+0x188): undefined reference to `is_touchpad'
collect2: ld returned 1 exit status
make: *** [toutnoir.tns] Error 1
$ make
nspire-ld toutnoir.o -o toutnoir.elf
c:/ti/ndless20/sdk/bin/../liblibndls.a(touchpad.o): In function `touchpad_getinfo':
touchpad.c:(.text+0x100): undefined reference to `is_touchpad'
c:/ti/ndless20/sdk/bin/../liblibndls.a(touchpad.o): In function `touchpad_scan':
touchpad.c:(.text+0x188): undefined reference to `is_touchpad'
collect2: ld returned 1 exit status
make: *** [toutnoir.tns] Error 1
-
caviar
Niveau 3: MH (Membre Habitué)- Posts: 18
- Joined: 15 May 2011, 00:00
- Gender:
- Calculator(s):→ MyCalcs profile
- Class: TS
Re: Problème à la compilation
Peux-tu faire un autre test? Désolé pour ce ping-pong, tu es le premier a reporter ce problème et il n'est pas reproduisible chez moi. C'est malheureusement la seule manière de diagnostiquer ce qui ne va pas.
1) Que retourne la commande "nspire-gcc --version"?
2)
- Edite le fichier bin/nspire-gcc, et remplace la ligne "(cd "$DIRNAME/../system" make -s all)" par "(cd "$DIRNAME/../system" make all)"
- Supprime une nouvelle fois les fichier .o dans le dossier system/
- Qu'indique alors une nouvelle compilation?
1) Que retourne la commande "nspire-gcc --version"?
2)
- Edite le fichier bin/nspire-gcc, et remplace la ligne "(cd "$DIRNAME/../system" make -s all)" par "(cd "$DIRNAME/../system" make all)"
- Supprime une nouvelle fois les fichier .o dans le dossier system/
- Qu'indique alors une nouvelle compilation?
-
ExtendeDPremium
Niveau 8: ER (Espèce Rare: nerd)- Posts: 204
- Joined: 30 Dec 2004, 00:00
- Gender:
- Calculator(s):→ MyCalcs profile
- Class: N/A
22 posts
• Page 1 of 3 • 1, 2, 3
Return to Native: Ndless, Linux, ...
Who is online
Users browsing this forum: ClaudeBot [spider] and 4 guests