Contenu | Rechercher | Menus

Annonce

Si vous avez des soucis pour rester connecté, déconnectez-vous puis reconnectez-vous depuis ce lien en cochant la case
Me connecter automatiquement lors de mes prochaines visites.

À propos de l'équipe du forum.

#1 Le 17/06/2010, à 21:54

cmarbach

Compilation de lejos 2.1.0 sous Ubuntu 10.04 32bit

Bonjour à tous,

La compilation du code source de lejos 2.1.0 pour développer et compiler des applications en Java pour LEGO Mindstorm RCX Brick (le premier modèle), il est nécessaire de modifier quelques fichiers dans les sources de lejos_1_2_0:
  * lejos_1_2_0/Makefile: ligne 12, effacer " -target 1.1"
  * lejos_2_1_0/rcxcomm/rcxclasses/Makefile: ligne 1, effacer " -target 1.1"
  * lejos_2_1_0/vmsrc/threads.c: ligne 323, ajouter un retour à la ligne et un ; (point-virgule)

Problème de cible (target):

make[1]: quittant le répertoire « /home/cmarbach/Téléchargements/lejos_2_1_0/tools »
javac -target 1.1 -classpath classes `find classes -name '*.java'`
javac: target release 1.1 conflicts with default source release 1.5
make: *** [core_classes] Erreur 2

Problème avec la syntaxe d'un label (il faut ajouter un ";" après le label).

====> Making leJOS Unix binaries (lejos, for emulation)
cd unix_impl; make OSTYPE=linux
make[1]: entrant dans le répertoire « /home/cmarbach/Téléchargements/lejos_2_1_0/unix_impl »
gcc -I../vmsrc -I. -Wall -Wno-unused dump_config.c -o dump_config
dump_config.c: In function ‘main’:
dump_config.c:30: warning: implicit declaration of function ‘exit’
dump_config.c:30: warning: incompatible implicit declaration of built-in function ‘exit’
./dump_config > platform_config.h
gcc -I../vmsrc -I. -Wall -Wno-unused -c ../vmsrc/interpreter.c
gcc -I../vmsrc -I. -Wall -Wno-unused -c ../vmsrc/threads.c
../vmsrc/threads.c: In function ‘switch_thread’:
../vmsrc/threads.c:323: error: label at end of compound statement
make[1]: *** [threads.o] Erreur 1
make[1]: quittant le répertoire « /home/cmarbach/Téléchargements/lejos_2_1_0/unix_impl »
make: *** [tinyvm_emul] Erreur 2

Hors ligne

#2 Le 16/05/2017, à 09:59

LR

Re : Compilation de lejos 2.1.0 sous Ubuntu 10.04 32bit

Bonjour,

J'essaie d'installer lejos 2.1 sur LinuxMint Serena 18.1 (=Ubuntu Xenial).

Mais j'ai des erreurs. Est-ce que qqun peut m'aider? Je ne suis pas trop expert en compilation sous linux...

/opt/lejos_2_1_0 $ make
cd tools; make OSTYPE=linux
make[1] : on entre dans le répertoire « /opt/lejos_2_1_0/tools »
cd firmdl; make
make[2] : on entre dans le répertoire « /opt/lejos_2_1_0/tools/firmdl »
gcc -O2    -c -o mkimg.o mkimg.c
mkimg.c: In function ‘srec_load’:
mkimg.c:63:2: warning: implicit declaration of function ‘exit’ [-Wimplicit-function-declaration]
  exit(1);
  ^
mkimg.c:63:2: warning: incompatible implicit declaration of built-in function ‘exit’
mkimg.c:63:2: note: include ‘<stdlib.h>’ or provide a declaration of ‘exit’
mkimg.c:84:3: warning: incompatible implicit declaration of built-in function ‘exit’
   exit(1);
   ^
mkimg.c:84:3: note: include ‘<stdlib.h>’ or provide a declaration of ‘exit’
mkimg.c:99:3: warning: incompatible implicit declaration of built-in function ‘exit’
   exit(1);
   ^
mkimg.c:99:3: note: include ‘<stdlib.h>’ or provide a declaration of ‘exit’
mkimg.c:111:3: warning: incompatible implicit declaration of built-in function ‘exit’
   exit(1);
   ^
mkimg.c:111:3: note: include ‘<stdlib.h>’ or provide a declaration of ‘exit’
mkimg.c:131:2: warning: incompatible implicit declaration of built-in function ‘exit’
  exit(1);
  ^
mkimg.c:131:2: note: include ‘<stdlib.h>’ or provide a declaration of ‘exit’
mkimg.c: In function ‘main’:
mkimg.c:173:2: warning: incompatible implicit declaration of built-in function ‘exit’
  exit(1);
  ^
mkimg.c:173:2: note: include ‘<stdlib.h>’ or provide a declaration of ‘exit’
gcc -O2    -c -o srec.o srec.c
gcc mkimg.o srec.o -o mkimg -O2 
./mkimg fastdl.srec > fastdl.h
gcc -O2    -c -o firmdl.o firmdl.c
firmdl.c: In function ‘main’:
firmdl.c:631:2: warning: format not a string literal and no format arguments [-Wformat-security]
  fprintf(stderr, usage_string);
  ^
gcc -O2    -c -o rcx_comm.o rcx_comm.c
rcx_comm.c: In function ‘nbread’:
rcx_comm.c:165:31: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long int’ [-Wformat=]
      if (__comm_debug) printf("nbread: enter timeout %d, maxlen %d\n", timer, maxlen);
                               ^
rcx_comm.c:178:32: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘long int’ [-Wformat=]
                fprintf(stderr, "nbread: std exit, read %d\n", len); 
                                ^
rcx_comm.c:184:40: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long int’ [-Wformat=]
               if (__comm_debug) printf("nbread: sleeping %d\n", timer);
                                        ^
rcx_comm.c:195:29: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘long int’ [-Wformat=]
             fprintf(stderr, "nbread: XXL exit, read %d - thought %d\n", maxlen,len);
                             ^
rcx_comm.c: In function ‘mywrite’:
rcx_comm.c:265:31: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘size_t {aka long unsigned int}’ [-Wformat=]
      if (__comm_debug) printf("mywrite: enter len %d\n", len);
                               ^
rcx_comm.c:275:33: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long int’ [-Wformat=]
       if (__comm_debug)  printf("actual: %d  len: %d\n", actual, len);
                                 ^
rcx_comm.c:275:33: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘size_t {aka long unsigned int}’ [-Wformat=]
rcx_comm.c:279:35: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long int’ [-Wformat=]
          if (__comm_debug) printf("error from write: %d\n", rc);
                                   ^
rcx_comm.c:284:35: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long int’ [-Wformat=]
          if (__comm_debug) printf("unknown error from write: %d\n", rc);
                                   ^
rcx_comm.c:290:35: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long int’ [-Wformat=]
          if (__comm_debug) printf("returning actual: %d\n", actual);
                                   ^
rcx_comm.c: In function ‘rcx_wakeup_tower’:
rcx_comm.c:436:13: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long unsigned int’ [-Wformat=]
      printf("writelen = %d\n", sizeof(msg));
             ^
gcc -O2    -c -o util.o util.c
gcc firmdl.o srec.o rcx_comm.o util.o -o ../../bin/lejosfirmdl -O2  
make[2] : on quitte le répertoire « /opt/lejos_2_1_0/tools/firmdl »
gcc -I../vmsrc -Wall -Wno-unused -O2  -c lejosrun.c
lejosrun.c: In function ‘main’:
lejosrun.c:263:2: warning: format not a string literal and no format arguments [-Wformat-security]
  fprintf(stderr, usage_string);
  ^
gcc lejosrun.o firmdl/rcx_comm.o -o ../bin/lejosrun 
gcc -I../vmsrc -Wall -Wno-unused -O2  -c util.c
gcc -DTOOL_NAME=\"javac\" -DTOOL_ALT_VAR=\"JAVAC\" -DJAVA2 -c jtoolexec.c
gcc jtoolexec.o util.o -o ../bin/lejosc
gcc -DTOOL_NAME=\"javap\" -DTOOL_ALT_VAR=\"JAVAP\" -DJAVA2 -c jtoolexec.c
gcc jtoolexec.o util.o -o ../bin/lejosp
gcc -DTOOL_NAME=\"javac\" -DTOOL_ALT_VAR=\"JAVAC\" -c jtoolexec.c
gcc jtoolexec.o util.o -o ../bin/lejosc1
gcc -DTOOL_NAME=\"javap\" -DTOOL_ALT_VAR=\"JAVAP\" -c jtoolexec.c
gcc jtoolexec.o util.o -o ../bin/lejosp1
gcc -DWRITE_ORDER=\"BE\" -DLOADER_TOOL=\"lejosrun\"  -c javaexec.c
javaexec.c: In function ‘get_loader_classpath’:
javaexec.c:98:7: warning: implicit declaration of function ‘strcmp’ [-Wimplicit-function-declaration]
   if (strcmp (oldcpath, "") != 0)
       ^
gcc javaexec.o util.o -o ../bin/lejos
gcc -DWRITE_ORDER=\"LE\" -DLOADER_TOOL=\"emu-lejosrun\" -c javaexec.c
javaexec.c: In function ‘get_loader_classpath’:
javaexec.c:98:7: warning: implicit declaration of function ‘strcmp’ [-Wimplicit-function-declaration]
   if (strcmp (oldcpath, "") != 0)
       ^
gcc javaexec.o util.o -o ../bin/emu-lejos
make[1] : on quitte le répertoire « /opt/lejos_2_1_0/tools »
javac -target 1.1 -classpath classes `find classes -name '*.java'`
/bin/sh: 1: javac: not found
Makefile:122 : la recette pour la cible « core_classes » a échouée
make: *** [core_classes] Erreur 127

Merci d'avance

Hors ligne

#3 Le 16/05/2017, à 10:10

soshy

Re : Compilation de lejos 2.1.0 sous Ubuntu 10.04 32bit

salut,

A priori il faut installer le compilateur java (c'est ce que dit la ligne /bin/sh: 1: javac: not found). Il y a des chances que ceci te fasse avancer:

sudo apt install openjdk-8-jdk

Dernière modification par soshy (Le 16/05/2017, à 10:10)

Hors ligne

#5 Le 17/05/2017, à 09:31

LR

Re : Compilation de lejos 2.1.0 sous Ubuntu 10.04 32bit

soshy a écrit :

salut,

A priori il faut installer le compilateur java (c'est ce que dit la ligne /bin/sh: 1: javac: not found). Il y a des chances que ceci te fasse avancer:

sudo apt install openjdk-8-jdk

Merci, je n'ai pas vu cette ligne que pourtant j'aurais pu comprendre (contrairement aux autres)...

Du coup, après installation du compilateur java, voilà le résultat:

/opt/lejos_2_1_0 $ make
cd tools; make OSTYPE=linux
make[1] : on entre dans le répertoire « /opt/lejos_2_1_0/tools »
cd firmdl; make
make[2] : on entre dans le répertoire « /opt/lejos_2_1_0/tools/firmdl »
gcc -O2    -c -o mkimg.o mkimg.c
mkimg.c: In function ‘srec_load’:
mkimg.c:63:2: warning: implicit declaration of function ‘exit’ [-Wimplicit-function-declaration]
  exit(1);
  ^
mkimg.c:63:2: warning: incompatible implicit declaration of built-in function ‘exit’
mkimg.c:63:2: note: include ‘<stdlib.h>’ or provide a declaration of ‘exit’
mkimg.c:84:3: warning: incompatible implicit declaration of built-in function ‘exit’
   exit(1);
   ^
mkimg.c:84:3: note: include ‘<stdlib.h>’ or provide a declaration of ‘exit’
mkimg.c:99:3: warning: incompatible implicit declaration of built-in function ‘exit’
   exit(1);
   ^
mkimg.c:99:3: note: include ‘<stdlib.h>’ or provide a declaration of ‘exit’
mkimg.c:111:3: warning: incompatible implicit declaration of built-in function ‘exit’
   exit(1);
   ^
mkimg.c:111:3: note: include ‘<stdlib.h>’ or provide a declaration of ‘exit’
mkimg.c:131:2: warning: incompatible implicit declaration of built-in function ‘exit’
  exit(1);
  ^
mkimg.c:131:2: note: include ‘<stdlib.h>’ or provide a declaration of ‘exit’
mkimg.c: In function ‘main’:
mkimg.c:173:2: warning: incompatible implicit declaration of built-in function ‘exit’
  exit(1);
  ^
mkimg.c:173:2: note: include ‘<stdlib.h>’ or provide a declaration of ‘exit’
gcc -O2    -c -o srec.o srec.c
gcc mkimg.o srec.o -o mkimg -O2 
./mkimg fastdl.srec > fastdl.h
gcc -O2    -c -o firmdl.o firmdl.c
firmdl.c: In function ‘main’:
firmdl.c:631:2: warning: format not a string literal and no format arguments [-Wformat-security]
  fprintf(stderr, usage_string);
  ^
gcc -O2    -c -o rcx_comm.o rcx_comm.c
rcx_comm.c: In function ‘nbread’:
rcx_comm.c:165:31: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long int’ [-Wformat=]
      if (__comm_debug) printf("nbread: enter timeout %d, maxlen %d\n", timer, maxlen);
                               ^
rcx_comm.c:178:32: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘long int’ [-Wformat=]
                fprintf(stderr, "nbread: std exit, read %d\n", len); 
                                ^
rcx_comm.c:184:40: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long int’ [-Wformat=]
               if (__comm_debug) printf("nbread: sleeping %d\n", timer);
                                        ^
rcx_comm.c:195:29: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘long int’ [-Wformat=]
             fprintf(stderr, "nbread: XXL exit, read %d - thought %d\n", maxlen,len);
                             ^
rcx_comm.c: In function ‘mywrite’:
rcx_comm.c:265:31: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘size_t {aka long unsigned int}’ [-Wformat=]
      if (__comm_debug) printf("mywrite: enter len %d\n", len);
                               ^
rcx_comm.c:275:33: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long int’ [-Wformat=]
       if (__comm_debug)  printf("actual: %d  len: %d\n", actual, len);
                                 ^
rcx_comm.c:275:33: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘size_t {aka long unsigned int}’ [-Wformat=]
rcx_comm.c:279:35: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long int’ [-Wformat=]
          if (__comm_debug) printf("error from write: %d\n", rc);
                                   ^
rcx_comm.c:284:35: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long int’ [-Wformat=]
          if (__comm_debug) printf("unknown error from write: %d\n", rc);
                                   ^
rcx_comm.c:290:35: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long int’ [-Wformat=]
          if (__comm_debug) printf("returning actual: %d\n", actual);
                                   ^
rcx_comm.c: In function ‘rcx_wakeup_tower’:
rcx_comm.c:436:13: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long unsigned int’ [-Wformat=]
      printf("writelen = %d\n", sizeof(msg));
             ^
gcc -O2    -c -o util.o util.c
gcc firmdl.o srec.o rcx_comm.o util.o -o ../../bin/lejosfirmdl -O2  
make[2] : on quitte le répertoire « /opt/lejos_2_1_0/tools/firmdl »
gcc -I../vmsrc -Wall -Wno-unused -O2  -c lejosrun.c
lejosrun.c: In function ‘main’:
lejosrun.c:263:2: warning: format not a string literal and no format arguments [-Wformat-security]
  fprintf(stderr, usage_string);
  ^
gcc lejosrun.o firmdl/rcx_comm.o -o ../bin/lejosrun 
gcc -I../vmsrc -Wall -Wno-unused -O2  -c util.c
gcc -DTOOL_NAME=\"javac\" -DTOOL_ALT_VAR=\"JAVAC\" -DJAVA2 -c jtoolexec.c
gcc jtoolexec.o util.o -o ../bin/lejosc
gcc -DTOOL_NAME=\"javap\" -DTOOL_ALT_VAR=\"JAVAP\" -DJAVA2 -c jtoolexec.c
gcc jtoolexec.o util.o -o ../bin/lejosp
gcc -DTOOL_NAME=\"javac\" -DTOOL_ALT_VAR=\"JAVAC\" -c jtoolexec.c
gcc jtoolexec.o util.o -o ../bin/lejosc1
gcc -DTOOL_NAME=\"javap\" -DTOOL_ALT_VAR=\"JAVAP\" -c jtoolexec.c
gcc jtoolexec.o util.o -o ../bin/lejosp1
gcc -DWRITE_ORDER=\"BE\" -DLOADER_TOOL=\"lejosrun\"  -c javaexec.c
javaexec.c: In function ‘get_loader_classpath’:
javaexec.c:98:7: warning: implicit declaration of function ‘strcmp’ [-Wimplicit-function-declaration]
   if (strcmp (oldcpath, "") != 0)
       ^
gcc javaexec.o util.o -o ../bin/lejos
gcc -DWRITE_ORDER=\"LE\" -DLOADER_TOOL=\"emu-lejosrun\" -c javaexec.c
javaexec.c: In function ‘get_loader_classpath’:
javaexec.c:98:7: warning: implicit declaration of function ‘strcmp’ [-Wimplicit-function-declaration]
   if (strcmp (oldcpath, "") != 0)
       ^
gcc javaexec.o util.o -o ../bin/emu-lejos
make[1] : on quitte le répertoire « /opt/lejos_2_1_0/tools »
javac -target 1.1 -classpath classes `find classes -name '*.java'`
javac: target release 1.1 conflicts with default source release 1.8
Makefile:122 : la recette pour la cible « core_classes » a échouée
make: *** [core_classes] Erreur 2

Je suppose que c'est OK?

Maintenant j'essaie de définir la variable RCXTTY qui doit correspondre je pense au port USB sur lequel est branchée la tour qui permet de communiquer par infrarouge avec l'unité centrale Lego.

J'ai vu que certains utilise /dev/ttyS0 ou /dev/ttyUSB mais moi je n'ai rien de tel...

Hors ligne

#6 Le 17/05/2017, à 19:33

claudius01

Re : Compilation de lejos 2.1.0 sous Ubuntu 10.04 32bit

Bonsoir,

Avec

...
gcc javaexec.o util.o -o ../bin/emu-lejos
make[1] : on quitte le répertoire « /opt/lejos_2_1_0/tools »
javac -target 1.1 -classpath classes `find classes -name '*.java'`
javac: target release 1.1 conflicts with default source release 1.8
Makefile:122 : la recette pour la cible « core_classes » a échouée
make: *** [core_classes] Erreur 2

Je crains malheureusement que cela ne soit pas ... OK  ;-)

NB: C'est quoi ce projet avec tous ses warnings, et encore l'option -Wall n'est pas renseignée

A suivre...

Hors ligne

#7 Le 01/06/2017, à 00:15

draco31.fr

Re : Compilation de lejos 2.1.0 sous Ubuntu 10.04 32bit

Bonsoir,

A priori il y a conflit entre la version de java pour les sources (version du langage) et celle du compilateur. Il te faut préciser l'argument -source avec la version de langage.
La plus basse version du langage supportée par le compilateur de la JDK 1.8 est la version 1.3 (cf. https://docs.oracle.com/javase/8/docs/t … javac.html )

Donc un truc de ce genre pourrait marcher :

javac -target 1.1 -source 1.3 -classpath classes `find classes -name '*.java'`

sinon tenter avec tout en 1.1 :

javac -target 1.1 -source 1.1 -classpath classes `find classes -name '*.java'`

ou à l'inverse, augmenter la version de la VM (target) :

javac -target 1.4 -source 1.4 -classpath classes `find classes -name '*.java'`

Si seulement cette dernière commande fonctionne, il est possible que le code ne marche pas sur le MindStorm si celui-ci embarque une VM plus ancienne.

NB : Déterrer un topic non résolu depuis 7 ans, faut avoir le courage quand même smile

Dernière modification par draco31.fr (Le 01/06/2017, à 00:25)

Hors ligne

#8 Le 07/06/2017, à 12:06

LR

Re : Compilation de lejos 2.1.0 sous Ubuntu 10.04 32bit

Merci pour votre aide, ce n'est pas encore résolu mais je manque de temps en ce moment.
Je reviendrai ici dès que possible.

Hors ligne