EPICS Home

Experimental Physics and Industrial Control System


 
1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  <20142015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  <20142015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Is RULES_JAVA broken?
From: Nerses Gevorgyan <[email protected]>
To: [email protected]
Date: Tue, 16 Sep 2014 00:00:56 -0400 (EDT)
Hi,

I'm trying to build a simple java application consisting of one java file.
After getting into troubles, I've tried to debug and found some "problems" in the $EPICS_BASE/configure/RULES_JAVA
I found at least 2 places I need to make changes in the RULES_JAVA.
In short the question is: is RULES_JAVA is tested and I'm doing something wrong or the RULES_JAVA should be fixed?

Below, are more details about the problem.
The EPICS_BASE is R3.14.12.3

So, the structure of files and directories similar to the application created by makeBaseApp.pl
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
nerses@clonioc1 apps>find MakeLogEntryApp -ls
4088280    4 drwxrwxr-x   3 nerses   clas-4       4096 Sep 15 22:48 MakeLogEntryApp
4088281    4 -rw-rw-r--   1 nerses   clas-4        304 Sep 11 15:23 MakeLogEntryApp/Makefile
4088282    4 drwxrwxr-x   3 nerses   clas-4       4096 Sep 15 22:59 MakeLogEntryApp/src
4088289    4 -rw-rw-r--   1 nerses   clas-4       1898 Sep 15 18:13 MakeLogEntryApp/src/Makefile
4088296    4 drwxrwxr-x   3 nerses   clas-4       4096 Sep 15 22:48 MakeLogEntryApp/src/org
4088297    4 drwxrwxr-x   3 nerses   clas-4       4096 Sep 11 16:49 MakeLogEntryApp/src/org/jlab
4088298    4 drwxrwxr-x   2 nerses   clas-4       4096 Sep 15 22:54 MakeLogEntryApp/src/org/jlab/AutoLogEntry
4088299   12 -rw-rw-r--   1 nerses   clas-4       9964 Sep 11 16:49 MakeLogEntryApp/src/org/jlab/AutoLogEntry/MakeLogEntry.java
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The Makefile is quite simple.
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
TOP=../..

JAVA_DIR = ~rafopar/Apps/Java/jdk1.7.0_67

include $(TOP)/configure/CONFIG

JAVA	+= org/jlab/AutoLogEntry/MakeLogEntry.java

JAR	+= MakeLogEntry.jar
JAR_INPUT = $(INSTALL_CLASSES)
#JAR_INPUT = $(INSTALL_JAVA)/org/jlab/AutoLogEntry/MakeLogEntry.*

USR_JAVACFLAGS	+= -cp .:/u/site/ace/certified/apps/eloglib/java/jlog2.jar:/home/rafopar/JAR_Files/mysql-connector-java-5.1.32-bin.jar

include $(TOP)/configure/RULES
#----------------------------------------
#  ADD RULES AFTER THIS LINE

mytest:	
	@echo JAVA_INC = $(JAVA_INC)
	@echo JAVA_BIN = $(JAVA_BIN)
	@echo JAVA_INCLUDES = $(JAVA_INCLUDES)
	@echo JAVACCMD = $(JAVACCMD)
	@echo JAVAHCMD = $(JAVAHCMD)
	@echo JARCMD   = $(JARCMD)
#vpath %.java .. 
	@echo CLASSPATH = $(CLASSPATH)
# Java directory
	@echo JAVA =  $(JAVA)
	@echo JAVA_DIRECTORY_TARGETS =  $(JAVA_DIRECTORY_TARGETS)
# Java native method C header files
	@echo JAVAHFLAGS =  $(JAVAHFLAGS)
	@echo JAVAINC_CLASSFILES =  $(JAVAINC_CLASSFILES)
	@echo JAVAINC_CLASSNAMES =  $(JAVAINC_CLASSNAMES)
	@echo COMMON_JAVAINC =  $(COMMON_JAVAINC)
# Java class files
	@echo JAVACFLAGS =  $(JAVACFLAGS)
	@echo CLASSES =  $(CLASSES)
	@echo INSTALL_CLASSES =  $(INSTALL_CLASSES)
	@echo TESTCLASSES =  $(TESTCLASSES)
	@echo DEPTESTJAVA =  $(DEPTESTJAVA)
# Java jar file
	@echo INSTALL_JAR = $(INSTALL_JAR)
	@echo JARDEPFILES =  $(JARDEPFILES)
	@echo JARINPUT =  $(JARINPUT)
	@echo JARPACKAGES =  $(JARPACKAGES)
	@echo PACKAGEDIRS =  $(PACKAGEDIRS)
# Java doc  definitions
	@echo JAVADOC =  $(JAVADOC)
	@echo JAVADOCFLAGS =  $(JAVADOCFLAGS)
	@echo JAVADOCCMD =  $(JAVADOCCMD)
	@echo INSTALL_JAVADOC =  $(JAVADOCCMD)


^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The compilation of java file is running smoothly. 
The javalib directory is created in the TOP directory and results are placed there.

vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
nerses@clonioc1 apps>find javalib/ -ls
1207269    4 drwxrwxr-x   3 nerses   clas-4       4096 Sep 15 23:00 javalib/
1207270    4 drwxrwxr-x   3 nerses   clas-4       4096 Sep 15 23:00 javalib/org
1207271    4 drwxrwxr-x   3 nerses   clas-4       4096 Sep 15 23:00 javalib/org/jlab
1207272    4 drwxrwxr-x   2 nerses   clas-4       4096 Sep 15 23:00 javalib/org/jlab/AutoLogEntry
1207273    4 -rw-rw-r--   1 nerses   clas-4       1205 Sep 15 23:00 javalib/org/jlab/AutoLogEntry/MakeLogEntry$Action.class
1207274    4 -rw-rw-r--   1 nerses   clas-4        962 Sep 15 23:00 javalib/org/jlab/AutoLogEntry/MakeLogEntry$ScrollablePanel.class
1207275    4 -rw-rw-r--   1 nerses   clas-4        231 Sep 15 23:00 javalib/org/jlab/AutoLogEntry/MakeLogEntry$1.class
1207276    8 -rw-rw-r--   1 nerses   clas-4       8000 Sep 15 23:00 javalib/org/jlab/AutoLogEntry/MakeLogEntry.class
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The next step is creation of jar file which is failing.
Here is the output of make.

vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
nerses@clonioc1 src>make
perl /usr/local/clas12/release/0.1/R3.14.12.3/base/bin/linux-x86/makeMakefile.pl O.linux-x86 ../../..
perl /usr/local/clas12/release/0.1/R3.14.12.3/base/bin/linux-x86/makeMakefile.pl O.vxWorks-ppc604_long ../../..
mkdir O.Common
make -C O.linux-x86 -f ../Makefile TOP=../../.. T_A=linux-x86 install
make[1]: Entering directory `/misc/home/nerses/github_test/epics/apps/MakeLogEntryApp/src/O.linux-x86'
mkdir -p ../../../javalib
Creating java class files
~rafopar/Apps/Java/jdk1.7.0_67/bin/javac -classpath ../../../javalib -sourcepath .:..:../.. -cp .:/u/site/ace/certified/apps/eloglib/java/jlog2.jar:/misc/home/rafopar/JAR_Files/mysql-connector-java-5.1.32-bin.jar -d ../../../javalib ../org/jlab/AutoLogEntry/MakeLogEntry.java
make[1]: *** No rule to make target `../../../../javalib/org/jlab/AutoLogEntry/MakeLogEntry.class', needed by `../../../javalib/../../../javalib/org/jlab/AutoLogEntry/MakeLogEntry.class'.  Stop.
make[1]: Leaving directory `/misc/home/nerses/github_test/epics/apps/MakeLogEntryApp/src/O.linux-x86'
make: *** [install.linux-x86] Error 2
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

As You see it looks something in wrong non-existing directory 
(../../../../javalib/org/jlab/AutoLogEntry/MakeLogEntry.class)
instead of 
(../../../javalib/org/jlab/AutoLogEntry/MakeLogEntry.class)
By digging into $EPICS_BASE/configure/RULES_JAVA I found that probably the JAVADEPFILES variable is wrong as seen from mytest target.
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
nerses@clonioc1 src>make -C O.linux-x86 -f ../Makefile TOP=../../.. T_A=linux-x86 mytest
make: Entering directory `/misc/home/nerses/github_test/epics/apps/MakeLogEntryApp/src/O.linux-x86'
INSTALL_CLASSES = ../../../javalib/org/jlab/AutoLogEntry/MakeLogEntry.class
INSTALL_JAVA = ../../../javalib
JARINPUT = -C ../../../javalib ../../../javalib/org/jlab/AutoLogEntry/MakeLogEntry.class
JAR_INPUT = ../../../javalib/org/jlab/AutoLogEntry/MakeLogEntry.class
JARPACKAGES =
JARCMD = /home/rafopar/Apps/Java/jdk1.7.0_67/bin/jar cvf mytest -C ../../../javalib ../../../javalib/org/jlab/AutoLogEntry/MakeLogEntry.class
JARDEPFILES = ../../../javalib/org/jlab/AutoLogEntry/MakeLogEntry.class ../../../javalib/../../../javalib/org/jlab/AutoLogEntry/MakeLogEntry.class
JAVA_INC = /home/rafopar/Apps/Java/jdk1.7.0_67/include
JAVA_BIN = /home/rafopar/Apps/Java/jdk1.7.0_67/bin
JAVA_INCLUDES = -I~rafopar/Apps/Java/jdk1.7.0_67/include -I~rafopar/Apps/Java/jdk1.7.0_67/include/linux -I../O.Common
JAVACCMD = /home/rafopar/Apps/Java/jdk1.7.0_67/bin/javac -classpath ../../../javalib -sourcepath .:..:../.. -cp .:/u/site/ace/certified/apps/eloglib/java/jlog2.jar:/misc/home/rafopar/JAR_Files/mysql-connector-java-5.1.32-bin.jar
JAVAHCMD = /home/rafopar/Apps/Java/jdk1.7.0_67/bin/javah -d ../O.Common -force -classpath ../../../javalib
JARCMD = /home/rafopar/Apps/Java/jdk1.7.0_67/bin/jar cvf mytest -C ../../../javalib ../../../javalib/org/jlab/AutoLogEntry/MakeLogEntry.class
CLASSPATH = -classpath ../../../javalib
JAVA = org/jlab/AutoLogEntry/MakeLogEntry.java
JAVA_DIRECTORY_TARGETS = ../../../javalib
JAVAHFLAGS =
JAVAINC_CLASSFILES =
JAVAINC_CLASSNAMES =
COMMON_JAVAINC =
JAVACFLAGS = -cp .:/u/site/ace/certified/apps/eloglib/java/jlog2.jar:/misc/home/rafopar/JAR_Files/mysql-connector-java-5.1.32-bin.jar
CLASSES = org/jlab/AutoLogEntry/MakeLogEntry.class
INSTALL_CLASSES = ../../../javalib/org/jlab/AutoLogEntry/MakeLogEntry.class
TESTCLASSES =
DEPTESTJAVA =
INSTALL_JAR = ../../../javalib/MakeLogEntry.jar
JARDEPFILES = ../../../javalib/org/jlab/AutoLogEntry/MakeLogEntry.class ../../../javalib/../../../javalib/org/jlab/AutoLogEntry/MakeLogEntry.class
JARINPUT = -C ../../../javalib ../../../javalib/org/jlab/AutoLogEntry/MakeLogEntry.class
JARPACKAGES =
PACKAGEDIRS =
JAVADOC =
JAVADOCFLAGS =
JAVADOCCMD =
INSTALL_JAVADOC =
make: Leaving directory `/misc/home/nerses/github_test/epics/apps/MakeLogEntryApp/src/O.linux-x86'
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

By changing from
JARDEPFILES += $(addprefix $(INSTALL_JAVA)/,$(subst .java,.class,$(JAVA)) $(JAR_INPUT))
to
JARDEPFILES += $(addprefix $(INSTALL_JAVA)/,$(subst .java,.class,$(JAVA))) $(JAR_INPUT)

I got the following:
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
make -C O.linux-x86 -f ../Makefile TOP=../../.. T_A=linux-x86 install
make[1]: Entering directory `/misc/home/nerses/github_test/epics/apps/MakeLogEntryApp/src/O.linux-x86'
Creating java jar file ../O.Common/MakeLogEntry.jar
~rafopar/Apps/Java/jdk1.7.0_67/bin/jar cvf ../O.Common/MakeLogEntry.jar -C ../../../javalib ../../../javalib/org/jlab/AutoLogEntry/MakeLogEntry.class 
../../../javalib/../../../javalib/org/jlab/AutoLogEntry/MakeLogEntry.class : no such file or directory
added manifest
make[1]: *** [../O.Common/MakeLogEntry.jar] Error 1
rm ../O.Common/MakeLogEntry.jar
make[1]: Leaving directory `/misc/home/nerses/github_test/epics/apps/MakeLogEntryApp/src/O.linux-x86'
make: *** [install.linux-x86] Error 2
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Which means instead of command:
~rafopar/Apps/Java/jdk1.7.0_67/bin/jar cvf ../O.Common/MakeLogEntry.jar -C ../../../javalib ../../../javalib/org/jlab/AutoLogEntry/MakeLogEntry.class

should be change to produce one of the following:
~rafopar/Apps/Java/jdk1.7.0_67/bin/jar cvf ../O.Common/MakeLogEntry.jar -C ../../../javalib org/jlab/AutoLogEntry/MakeLogEntry.class
~rafopar/Apps/Java/jdk1.7.0_67/bin/jar cvf ../O.Common/MakeLogEntry.jar ../../../javalib/org/jlab/AutoLogEntry/MakeLogEntry.class

This means that JARINPUT is producing the problem:
JARINPUT = -C ../../../javalib ../../../javalib/org/jlab/AutoLogEntry/MakeLogEntry.class
So, the following line from RULES_JAVA
JARINPUT += $(foreach inp,$(JAR_INPUT),-C $(INSTALL_JAVA) $(subst .java,.class,$(inp)))
should become
JARINPUT += $(foreach inp,$(JAR_INPUT), $(subst .java,.class,$(inp)))
or
JARINPUT += $(foreach inp,$(JAR_INPUT),-C $(INSTALL_JAVA) $(subst $(INSTALL_JAVA),,$(subst .java,.class,$(inp))))


Thanks,
Nerses

Replies:
Re: Is RULES_JAVA broken? J. Lewis Muir

Navigate by Date:
Prev: Re: EPICS vs. Firewalls J. Lewis Muir
Next: Asyn model 3 driver for Galil products Mark Clift
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  <20142015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: EPICS vs. Firewalls Konrad, Martin
Next: Re: Is RULES_JAVA broken? J. Lewis Muir
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  <20142015  2016  2017  2018  2019  2020  2021  2022  2023  2024