harvard-lts / fits

File Information Tool Set
http://fitstool.org
GNU Lesser General Public License v2.1
92 stars 46 forks source link

add install script for MediaInfo and remove from source #355

Closed pwinckles closed 1 year ago

pwinckles commented 2 years ago

Adds an install script to install MediaInfo and removes all of the MediaInfo files from the source tree.

If you test this on a Mac, after installing MediaInfo, would you be able to try deleting tools/mediainfo/mac/libmediainfo.0.dylib and see if the tool still works? I'd like to know if both of those dylib files are needed, they're identical.

awoods commented 1 year ago

After pulling down this PR, I build the image (just build-image) and attempt to run FITS on an mp4:

just run -i ~/Downloads/ci_sprint_demo.mp4

I get the following error:

2022-11-26 23:03:33 - ERROR - MediaInfo:95 - Error loading native library for this operating system for tool: MediaInfo. ostype=[Linux] -- jvmModel=[64] -- nativeLibPath=[/opt/fits/tools/mediainfo/linux] -- No native MediaInfo library for this OS
java.lang.UnsatisfiedLinkError: Unable to load library 'mediainfo':
libmediainfo.so: cannot open shared object file: No such file or directory
libmediainfo.so: cannot open shared object file: No such file or directory
libzen.so.0: cannot open shared object file: No such file or directory
Native library (linux-x86-64/libmediainfo.so) not found in resource path (:/opt/fits/lib/aes-31.4.0.jar:/opt/fits/lib/commons-cli-1.5.0.jar:/opt/fits/lib/commons-codec-1.14.jar:/opt/fits/lib/commons-collections-3.2.2.jar:/opt/fits/lib/commons-configuration-1.10.jar:/opt/fits/lib/commons-io-2.11.0.jar:/opt/fits/lib/commons-lang-2.6.jar:/opt/fits/lib/commons-logging-1.2.jar:/opt/fits/lib/fast-md5-2.7.1.jar:/opt/fits/lib/fits-1.6.0-SNAPSHOT.jar:/opt/fits/lib/gson-2.9.0.jar:/opt/fits/lib/httpclient-4.5.13.jar:/opt/fits/lib/jaxen-1.2.0.jar:/opt/fits/lib/jcl-over-slf4j-1.7.36.jar:/opt/fits/lib/jdom2-2.0.6.1.jar:/opt/fits/lib/jna-5.9.0.jar:/opt/fits/lib/log4j-api-2.17.2.jar:/opt/fits/lib/log4j-core-2.17.2.jar:/opt/fits/lib/log4j-slf4j-impl-2.17.2.jar:/opt/fits/lib/ots-1.0.58.jar:/opt/fits/lib/Saxon-HE-11.2.jar:/opt/fits/lib/slf4j-api-1.7.36.jar:/opt/fits/lib/stax2-api-3.1.4.jar:/opt/fits/lib/stax-api-1.0.1.jar:/opt/fits/lib/stax-api-1.0-2.jar:/opt/fits/lib/staxmate-2.0.1.jar:/opt/fits/lib/woodstox-core-lgpl-4.4.1.jar:/opt/fits/lib/xercesImpl-2.12.2.jar:/opt/fits/lib/xml-apis-1.4.01.jar:/opt/fits/lib/xmlresolver-4.2.0-data.jar:/opt/fits/lib/xmlresolver-4.2.0.jar)
    at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:301) ~[jna-5.9.0.jar:5.9.0 (b0)]
    at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:461) ~[jna-5.9.0.jar:5.9.0 (b0)]
    at com.sun.jna.Library$Handler.<init>(Library.java:192) ~[jna-5.9.0.jar:5.9.0 (b0)]
    at com.sun.jna.Native.load(Native.java:596) ~[jna-5.9.0.jar:5.9.0 (b0)]
    at edu.harvard.hul.ois.fits.tools.mediainfo.MediaInfoNativeWrapper$MediaInfoDLL_Internal.<clinit>(MediaInfoNativeWrapper.java:92) ~[fits-1.6.0-SNAPSHOT.jar:1.6.0-SNAPSHOT]
    at edu.harvard.hul.ois.fits.tools.mediainfo.MediaInfoNativeWrapper.Option_Static(MediaInfoNativeWrapper.java:430) ~[fits-1.6.0-SNAPSHOT.jar:1.6.0-SNAPSHOT]
    at edu.harvard.hul.ois.fits.tools.mediainfo.MediaInfo.<init>(MediaInfo.java:86) ~[fits-1.6.0-SNAPSHOT.jar:1.6.0-SNAPSHOT]
    at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:?]
    at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) ~[?:?]
    at jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) ~[?:?]
    at java.lang.reflect.Constructor.newInstanceWithCaller(Unknown Source) ~[?:?]
    at java.lang.reflect.Constructor.newInstance(Unknown Source) ~[?:?]
    at edu.harvard.hul.ois.fits.tools.ToolBelt.createToolClassInstance(ToolBelt.java:174) ~[fits-1.6.0-SNAPSHOT.jar:1.6.0-SNAPSHOT]
    at edu.harvard.hul.ois.fits.tools.ToolBelt.init(ToolBelt.java:127) ~[fits-1.6.0-SNAPSHOT.jar:1.6.0-SNAPSHOT]
    at edu.harvard.hul.ois.fits.tools.ToolBelt.<init>(ToolBelt.java:56) ~[fits-1.6.0-SNAPSHOT.jar:1.6.0-SNAPSHOT]
    at edu.harvard.hul.ois.fits.Fits.<init>(Fits.java:230) ~[fits-1.6.0-SNAPSHOT.jar:1.6.0-SNAPSHOT]
    at edu.harvard.hul.ois.fits.Fits.<init>(Fits.java:129) ~[fits-1.6.0-SNAPSHOT.jar:1.6.0-SNAPSHOT]
    at edu.harvard.hul.ois.fits.Fits.<init>(Fits.java:118) ~[fits-1.6.0-SNAPSHOT.jar:1.6.0-SNAPSHOT]
    at edu.harvard.hul.ois.fits.Fits.constructFits(Fits.java:340) ~[fits-1.6.0-SNAPSHOT.jar:1.6.0-SNAPSHOT]
    at edu.harvard.hul.ois.fits.Fits.main(Fits.java:314) ~[fits-1.6.0-SNAPSHOT.jar:1.6.0-SNAPSHOT]
pwinckles commented 1 year ago

@awoods Thanks for catching that! I could have sworn that I tried running the image, but it seems like I must not have after the tests passed. Unfortunately, the image that runs the tests uses a different base image from the image used to just run FITS. Upgrading to the current LTS version of ubuntu resolves the issue.

awoods commented 1 year ago

Something appears to be off. When running the tests after the following sequence of commands... I get lots of mediainfo errors:

$ just build
$ just build-test-image
$ just test

>> Tests run: 114, Failures: 65, Errors: 2, Skipped: 21
pwinckles commented 1 year ago

@awoods I can't reproduce the failures. It's curious because it works fine in the Github Actions, which is starting from a clean slate. What is your setup? What is the error you're seeing?

awoods commented 1 year ago

It appears that my tools/mediainfo/ content was incomplete... remedied by removing the tools/mediainfo and running just install-tools.

Tests work for me now. I will review the code in just a bit.