nasa / GMSEC_API

15 stars 3 forks source link

Problems Building from Source #39

Open stephen-ritter opened 4 weeks ago

stephen-ritter commented 4 weeks ago
  1. I built GMSEC_API 5.2 from source code on a UBI8 minimal image, and there appears to be issues and assumptions made in the build environment that are not documented or are unclear. For example I didn't realize that SWIG_HOME was supposed to point at the path to the swig binary until I read how it was being used in the associated Makefile.

  2. There appears to be some flakiness around building the project. I ended up directly calling make <make job> and specifying what exactly I wanted to build due to issues I had will calling make against the highest level Makefile. Even when doing this though, some of the make jobs would fail but calling it again would generate the binary I needed. For example this is what I have in my Dockerfile:

    WORKDIR /tmp/GMSEC_API
    RUN make check_support -j8
    RUN make build -j8
    RUN make library -j8
    RUN make mw_wrappers -j8; exit 0
    RUN make tools -j8
    RUN make env_val -j8
    RUN make java_api -j8; make java_api -j8; exit 0
    RUN make perl_api -j8; make perl_api -j8; exit 0
    RUN make python3_api -j8; make python3_api -j8; exit 0
    RUN cd wrapper/artemis && make -j8
    RUN make install

    As you can see I have some where I call the make job twice in a row because the first time would fail, the second time would generate the binaries, but I added exit 0 at the end because they would still error out in some cases. Also I had to go into wrapper/artemis directory and build it directly as it was looking for artifacts that I think got deleted in another make job.

dmwhitne-583 commented 3 weeks ago

SWIG_HOME is the base directory where you have SWIG installed.

If you install SWIG into your Docker session, it should reside in /usr, and thus this directory should be your SWIG_HOME.

If you elect to install SWIG in a non-standard location, then that folder will be your SWIG_HOME; for example, /home/me/tools/SWIG-4.1.0.

The GMSEC API Makefiles for the various language bindings that are dependent on SWIG will reference $SWIG_HOME/bin/swig, along with SWIG-related files for the respective language binding in $SWIG_HOME/share/swig/.

For more information, refer to the GMSEC_API/INSTALL.txt file.

As for your 'make' woes, drop the -j8 option so that the GMSEC API builds in the sequence dictated in the top-level Makefile. For example, this should suffice:

WORKDIR /tmp/GMSEC_API
RUN make clean && make && make install
stephen-ritter commented 3 weeks ago

Thanks! That worked. I should have just followed the instructions to the letter. I will add that I am getting an error when using RUN make clean && make && make install. I did track it down to the java_api make job:

14.00 g++ -shared src/gmsecJNI_Cache.o src/gmsecJNI_Jenv.o src/gmsecJNI_BinaryField.o src/gmsecJNI_BooleanField.o src/gmsecJNI_Callback.o src/gmsecJNI_CharField.o src/gmsecJNI_Config.o src/gmsecJNI_ConfigFile.o src/gmsecJNI_ConfigFileIterator.o src/gmsecJNI_Connection.o src/gmsecJNI_EventCallback.o src/gmsecJNI_F32Field.o src/gmsecJNI_F64Field.o src/gmsecJNI_Field.o src/gmsecJNI_I16Field.o src/gmsecJNI_I32Field.o src/gmsecJNI_I64Field.o src/gmsecJNI_I8Field.o src/gmsecJNI_HeartbeatGenerator.o src/gmsecJNI_Init.o src/gmsecJNI_Log.o src/gmsecJNI_LogHandler.o src/gmsecJNI_Message.o src/gmsecJNI_MessageFactory.o src/gmsecJNI_MessageFieldIterator.o src/gmsecJNI_MessageValidator.o src/gmsecJNI_ResourceGenerator.o src/gmsecJNI_Status.o src/gmsecJNI_StringField.o src/gmsecJNI_U16Field.o src/gmsecJNI_U32Field.o src/gmsecJNI_U64Field.o src/gmsecJNI_U8Field.o src/gmsecJNI_ReplyCallback.o src/gmsecJNI_SchemaIDIterator.o src/gmsecJNI_Specification.o src/gmsecJNI_TimeSpec.o src/gmsecJNI_TimeUtil.o  -L../bin -lgmsec_api -ldl -lpthread -Wl,-rpath,'$ORIGIN' -Wl,-z,origin  -L/usr/lib/jvm/java-17-openjdk-17.0.12.0.7-2.el8.x86_64/lib/server -ljvm  -o ../bin/libgmsec_jni.so
14.10 /usr/lib/jvm/java-17-openjdk-17.0.12.0.7-2.el8.x86_64/bin/javadoc -public -quiet -d docs -sourcepath . gov.nasa.gsfc.gmsec.api5 gov.nasa.gsfc.gmsec.api5.field gov.nasa.gsfc.gmsec.api5.util
14.89 ./gov/nasa/gsfc/gmsec/api5/MessageFieldIterator.java:24: error: unknown tag: note
14.89  * @note MessageFieldIterator is not thread safe.
14.89    ^
15.65 1 error
15.67 make[1]: *** [Makefile:157: gen-doc] Error 1
15.67 make[1]: Leaving directory '/tmp/GMSEC_API/java'
15.67 make: *** [Makefile:60: java_api] Error 2
------
Dockerfile:69
--------------------
  67 |     RUN make tools
  68 |     RUN make env_val
  69 | >>> RUN make java_api
  70 |     RUN make perl_api
  71 |     RUN make python3_api

It does generate the binary (gmsec_api.jar) but it looks like it is failing to build the documentation (gmsecapi-javadoc.jar). I wonder if this relates in part to https://github.com/nasa/GMSEC_API/issues/37, or maybe I am missing some more dependencies. I can get around this by using RUN make java_api; exit 0 as I don't necessarily need the documentation.

dmwhitne-583 commented 2 weeks ago

The @note is not a Javadoc directive. It seems it was inserted into the module by error. To mitigate the issue, move the statement into the following paragraph section (and the @ can be removed).