Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Problema con java al compilar roms android (cerrado)
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Spanish
View previous topic :: View next topic  
Author Message
lineu94
n00b
n00b


Joined: 21 Oct 2018
Posts: 4

PostPosted: Sun Oct 21, 2018 8:37 am    Post subject: Problema con java al compilar roms android (cerrado) Reply with quote

Hola, es mi primer post en el foro, de antemano gracias por las imnumerables veces que me han ayudado.

Estoy intentando compilar una rom cocinada android en mi gentoo (realmente no quiero usar otra distro) pero al inicio del compilado recibo un error

Code:
/home/lamp216/Android/arrowos/out/soong/make_vars-arrow_chiron.mk:644: warning: JAVAC does not match between Make and Soong:
/home/lamp216/Android/arrowos/out/soong/make_vars-arrow_chiron.mk:644: warning: Make : /etc/java-config-2/current-system-vm/bin/javac
/home/lamp216/Android/arrowos/out/soong/make_vars-arrow_chiron.mk:644: warning: Soong: prebuilts/jdk/jdk9/linux-x86/bin/javac
/home/lamp216/Android/arrowos/out/soong/make_vars-arrow_chiron.mk:1041: error: Soong variable check failed.
10:29:29 ckati failed with: exit status 1


tengo correctamente instalado y configurado java 1.8 (requisito para la version pie de android)

Code:
java -version
openjdk version "1.8.0_181"
OpenJDK Runtime Environment (IcedTea 3.9.0) (Gentoo icedtea-3.9.0)
OpenJDK 64-Bit Server VM (build 25.181-b13, mixed mode)


tengo la VM de java seleccionada tanto en user como en system, pero igual no puedo empezar la compilación, si alguno pudiera ayudarme lo agradecería.

cabe señalar que el mismo codigo fuente de la rom, la version de java funciona correctamente en ubuntu


Last edited by lineu94 on Wed Dec 05, 2018 2:03 pm; edited 1 time in total
Back to top
View user's profile Send private message
Dwosky
Tux's lil' helper
Tux's lil' helper


Joined: 07 Nov 2018
Posts: 135

PostPosted: Thu Nov 15, 2018 9:15 am    Post subject: Reply with quote

Hola lineu94,

Yo también soy nuevo en el foro (que no en Gentoo), pero te doy igualmente la bienvenida a estos foros.

El error que pones es por un conflicto entre las versiones de Java que usa Make, que seguramente sea la que hay en el path y has comprobado y la que usa Soong, que tiene pinta de ser un JDK9 (está en el path prebuilts/jdk/jdk9/linux-x86/bin/javac). Como JDK8 no es igual a JDK9, pues falla.

Estoy revisando las fuentes de Soong y tiene pinta de que usa su propia JDK:
Code:
   // Configure Java-related variables, including adding it to $PATH
   java8Home := filepath.Join("prebuilts/jdk/jdk8", ret.HostPrebuiltTag())
   java9Home := filepath.Join("prebuilts/jdk/jdk9", ret.HostPrebuiltTag())
   javaHome := func() string {
      if override, ok := ret.environ.Get("OVERRIDE_ANDROID_JAVA_HOME"); ok {
         return override
      }
      v, ok := ret.environ.Get("EXPERIMENTAL_USE_OPENJDK9")
      if !ok {
         v2, ok2 := ret.environ.Get("RUN_ERROR_PRONE")
         if ok2 && (v2 == "true") {
            v = "false"
         } else {
            v = "1.8"
         }
      }
      if v != "false" {
         return java9Home
      }
      return java8Home
}()


No estoy familiarizado con el lenguaje Go, pero igual si estableces la variable OVERRIDE_ANDROID_JAVA_HOME o quitas la de EXPERIMENTAL_USE_OPENJDK9 usa el JDK1.8, que aunque sea el suyo propio, debería ser parecido al que tienes instalado.

Mira, revisando el código he visto esto:
Code:
   return fmt.Errorf(`Invalid value for EXPERIMENTAL_USE_OPENJDK9, should be "", "false", "1.8", or "true"`)

Igual con lo siguiente consigues que funcione en 1.8:
Code:
export EXPERIMENTAL_USE_OPENJDK9="false"
Back to top
View user's profile Send private message
lineu94
n00b
n00b


Joined: 21 Oct 2018
Posts: 4

PostPosted: Tue Dec 04, 2018 6:23 pm    Post subject: Reply with quote

Dwosky wrote:
Hola lineu94,

Yo también soy nuevo en el foro (que no en Gentoo), pero te doy igualmente la bienvenida a estos foros.

El error que pones es por un conflicto entre las versiones de Java que usa Make, que seguramente sea la que hay en el path y has comprobado y la que usa Soong, que tiene pinta de ser un JDK9 (está en el path prebuilts/jdk/jdk9/linux-x86/bin/javac). Como JDK8 no es igual a JDK9, pues falla.

Estoy revisando las fuentes de Soong y tiene pinta de que usa su propia JDK:
Code:
   // Configure Java-related variables, including adding it to $PATH
   java8Home := filepath.Join("prebuilts/jdk/jdk8", ret.HostPrebuiltTag())
   java9Home := filepath.Join("prebuilts/jdk/jdk9", ret.HostPrebuiltTag())
   javaHome := func() string {
      if override, ok := ret.environ.Get("OVERRIDE_ANDROID_JAVA_HOME"); ok {
         return override
      }
      v, ok := ret.environ.Get("EXPERIMENTAL_USE_OPENJDK9")
      if !ok {
         v2, ok2 := ret.environ.Get("RUN_ERROR_PRONE")
         if ok2 && (v2 == "true") {
            v = "false"
         } else {
            v = "1.8"
         }
      }
      if v != "false" {
         return java9Home
      }
      return java8Home
}()


No estoy familiarizado con el lenguaje Go, pero igual si estableces la variable OVERRIDE_ANDROID_JAVA_HOME o quitas la de EXPERIMENTAL_USE_OPENJDK9 usa el JDK1.8, que aunque sea el suyo propio, debería ser parecido al que tienes instalado.

Mira, revisando el código he visto esto:
Code:
   return fmt.Errorf(`Invalid value for EXPERIMENTAL_USE_OPENJDK9, should be "", "false", "1.8", or "true"`)

Igual con lo siguiente consigues que funcione en 1.8:
Code:
export EXPERIMENTAL_USE_OPENJDK9="false"


Primero que todo muchas gracias por tu respuesta, tenia tiempo sin loguearme en el foro.

He probado lo que me comentas, use export EXPERIMENTAL_USE_OPENJDK9="false" en mi script para hacer el build, pero el error sigue.

Seguiré investigando sobre el error ya que no quiero seguir usando ubuntu para esto.


EDIT:

Intente forzar a usar siempre el path de Java 8 haciendo el siguiente cambio:

Code:
   // Configure Java-related variables, including adding it to $PATH
   java8Home := filepath.Join("prebuilts/jdk/jdk8", ret.HostPrebuiltTag())
   java9Home := filepath.Join("prebuilts/jdk/jdk9", ret.HostPrebuiltTag())
   javaHome := func() string {
      if override, ok := ret.environ.Get("OVERRIDE_ANDROID_JAVA_HOME"); ok {
         return override
      }
      v, ok := ret.environ.Get("EXPERIMENTAL_USE_OPENJDK9")
      if !ok {
         v2, ok2 := ret.environ.Get("RUN_ERROR_PRONE")
         if ok2 && (v2 == "true") {
            v = "false"
         } else {
            v = "1.8"
         }
      }
      if v != "false" {
         return java8Home  //antes java9Home
      }
      return java8Home
}()


Pero el error persiste
Back to top
View user's profile Send private message
Dwosky
Tux's lil' helper
Tux's lil' helper


Joined: 07 Nov 2018
Posts: 135

PostPosted: Tue Dec 04, 2018 7:20 pm    Post subject: Reply with quote

Pues casi te diría de comentarlo al grupo que lleve la ROM que intentas compilar, que la configuración que lanza es la que intenta forzar la JDK9 aunque tú tengas la JDK8.
Back to top
View user's profile Send private message
lineu94
n00b
n00b


Joined: 21 Oct 2018
Posts: 4

PostPosted: Wed Dec 05, 2018 2:02 pm    Post subject: Reply with quote

He encontrado la solución,

Resulta que al instalar java en gentoo, se define la variable de JAVAC

al ejecutar
Code:
env | grep JAVA
despues de ejecutar
Code:
. build/envsetup
y
Code:
breakfast $device

de acuerdo al proceso normal de compilado, obtengo:

Code:
lamp216@anarchy ~/android/arrow $ env | grep JAVA
JAVA_HOME=/home/lamp216/android/arrow/prebuilts/jdk/jdk9/linux-x86
ANDROID_JAVA_TOOLCHAIN=/home/lamp216/android/arrow/prebuilts/jdk/jdk9/linux-x86/bin
JAVAC=/etc/java-config-2/current-system-vm/bin/javac
ANDROID_JAVA_HOME=/home/lamp216/android/arrow/prebuilts/jdk/jdk9/linux-x86


Lo cual fuerza a make a utilizar el javac presente en gentoo y a soong el que esta presente en el source de aosp

por lo que antes de iniciar el compilado debí quitar esta variable preestablecida ejecutando

Code:
unset JAVAC


e iniciar el compilado desde el
Code:
. build/envsetup


obteniendo como variables de entorno en este caso

Code:
JAVA_HOME=/home/lamp216/android/arrow/prebuilts/jdk/jdk9/linux-x86
ANDROID_JAVA_TOOLCHAIN=/home/lamp216/android/arrow/prebuilts/jdk/jdk9/linux-x86/bin
ANDROID_JAVA_HOME=/home/lamp216/android/arrow/prebuilts/jdk/jdk9/linux-x86
Back to top
View user's profile Send private message
gringo
Advocate
Advocate


Joined: 27 Apr 2003
Posts: 3793

PostPosted: Thu Dec 13, 2018 4:02 pm    Post subject: Reply with quote

lineu94 wrote:

Code:
unset JAVAC



gracias por la información :-)
si no es mucho preguntar, que te devuelve la variable JAVAC una vez que la compilación está en progreso?

saluetes
Back to top
View user's profile Send private message
lineu94
n00b
n00b


Joined: 21 Oct 2018
Posts: 4

PostPosted: Wed Dec 26, 2018 12:08 pm    Post subject: Reply with quote

gringo wrote:
lineu94 wrote:

Code:
unset JAVAC



gracias por la información :-)
si no es mucho preguntar, que te devuelve la variable JAVAC una vez que la compilación está en progreso?

saluetes


Estaba de vacaciones por ello no había respondido antes.

No estoy actualmente en el ordenador pero cuando comienza la compilación la variable JAVAC apunta al javac del source de la rom, en vez de al del sistema (debido a que apuntaba al del sistema se producía el error).
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Spanish All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum