OpenSourcePhysics / tracker

Video analysis and modeling tool built on the Open Source Physics framework
GNU General Public License v3.0
206 stars 52 forks source link

[request] Guidelines for building Tracker from source #20

Open nickkolok opened 5 years ago

nickkolok commented 5 years ago

How to build Tracker from source? I want to patch some methods in osp-core (e.g. Ibelieve that https://github.com/OpenSourcePhysics/osp/blob/6f6b6f6b1c17ffe2c3bad68df1b6f46c1fe2885b/src/org/opensourcephysics/media/core/TemplateMatcher.java#L905 could be fastenated... But I have to check). How should I combine the repositories in a directory? Can I compile from a command line or should I use a specified IDE ? (I know only one thing about your IDE: tab is two spaces) What JDK version is appropriate? How to build a distributive version (installer) ? Can I build a windows installer if I run Ubuntu ?

dobrown commented 5 years ago

Take a look at these instructions for setting up an Eclipse project: http://physlets.org/tracker/tracker-eclipse.html. This will enable you to build the tracker.jar file. No need to build an installer--instead, use the latest installer from the Tracker website, then copy your tracker.jar into the Tracker home directory.

nickkolok commented 5 years ago

Thanks! I'm trying to build, but http://xuggle.googlecode.com/svn/trunk/repo/share/java/xuggle/xuggle-xuggler/5.4/ gives 404 Using xuggle-xuggler.jar from video_engine repository resuls in error

Description Resource    Path    Location    Type
The declared package "org.opensourcephysics.media.xuggle" does not match the expected package "src.org.opensourcephysics.media.xuggle"  XuggleVideoType.java    /tracker/src_video/src/org/opensourcephysics/media/xuggle   line 25 Java Problem
nickkolok commented 5 years ago

Oh, sorry, it probably was my fault. One small mistake in GUI =/

nickkolok commented 5 years ago

Only 13 errors remain:

Description Resource    Path    Location    Type
com.apple.eawt cannot be resolved to a type OSXServices.java    /tracker/src_tracker/org/opensourcephysics/cabrillo/tracker/deploy  line 15 Java Problem

Possibly because I'm not using Mac :)

nickkolok commented 5 years ago

And a video still fails to open: image

nickkolok commented 5 years ago

image Got Xuggle from Maven: https://www.dcm4che.org/maven2/xuggle/xuggle-xuggler/5.4/xuggle-xuggler-5.4.jar

I've got completely stuck, could you please help me?

dobrown commented 5 years ago

The classes that handle apple events require the Apple Java Extensions library (AppleJavaExtensions.jar) to compile on non-OSX platforms. You can download it here: http://physlets.org/tracker/code_libraries/AppleJavaExtensions.jar

dobrown commented 5 years ago

Linux requires you to define the environment variable LD_LIBRARY_PATH to point to the Xuggle libraries. By default when using the Tracker installer its value is "/opt/tracker/Xuggle/lib"

dobrown commented 5 years ago

I think your Xuggle from Maven is OK but you can also download from here: http://physlets.org/tracker/code_libraries/xuggle_jars.zip

nickkolok commented 5 years ago

Thanks a lot!

I've managed to build tracker.jar using build instructions of the fork: https://github.com/fschuett/osptracker-build

I've forked that repo and now I have a build environment which allows to build both original (xuggle) and fork (bare ffmpeg) versions and I proudly share it with you: https://github.com/nickkolok/osptracker-build/tree/bundle-jar-xuggle

nickkolok commented 5 years ago

However, another questions arise:

  1. Can all the libraries (including apple one) be distributed together? Is it legal?

  2. How do I make the build environment eclipse-friendly? How do I open it with eclipse?

  3. How do I build an installer (for xuggle version) ?

  4. Should we add xuggle installer from https://www.compadre.org/osp/items/detail.cfm?ID=11606 to the repo - as a copy for the case if compadre.org is unavailable?

dobrown commented 5 years ago

Excellent! I'll check out your build environment ASAP.

Do you also have access to Windows and OSX machines? We need to get the ffmpeg version working on both those platforms in 64-bit VMs. That would be huge!

Re your questions:

  1. The AppleJavaExtensions.jar isn't normally distributed with Tracker--it is only needed to compile, and the code is used only on OSX. Xuggle pre-compiled jar files are distributed under the GPL Version 3 license, as is Tracker/OSP so I think that's OK.

  2. I'm not sure yet but will try to open your environment in Eclipse.

  3. I build installers with InstallBuilder by BitRock (free lic for open source projects). But we need to go further with getting ffmpeg working on all platforms before building installers...

  4. It would be better to add the Xuggle library, not the installer, to the repo.

Nice work, this is great :-) Do I call you Nick? Doug

dobrown commented 5 years ago

Did you confirm that you could open and play videos with the ffmpeg engine? What does Help|About FFMPEG tell you?

nickkolok commented 5 years ago

1: I've found the license of AppleJavaExtensions.jar. It seems that we're given the four freedoms and the license is BSD-like. Xuggle is GPLv3 so they should be compatible, bt I'm not sure... In any case, AJE is distributed together with Xuggle, but is not linked with it; on the other side, it is linked with Tracker itself but Tracker is not distributed with the build environment. However, I think that rewriting Tracker to avoid AJE dependency on non-OSX platforms. I've seen such a mechanism in a code which plugges ffmpeg. Something with try-catch.

5: Yes, Nick is OK :)

nickkolok commented 5 years ago

2: I've tried to import the project into a newly-created Eclipse workspace (Eclipse 2018-09). However, it didn't recognize the libraries properly... I'll try to get it working.

3: Let me disagree. Migrating to ffmpeg is a tool, not the aim. Building installer is the aim. So, I think that we should have well-documented and (preferably) automated process of building the installer. And I'm afraid that non-OpenSource installer builder is not OK :( However, I believe that we should start with documentation. What is the difference between tracker.jar and tracker-starter.jar? How should they be built? Maybe I'll be able to build Debian packages for Tracker.

nickkolok commented 5 years ago

Did you confirm that you could open and play videos with the ffmpeg engine? What does Help|About FFMPEG tell you?

image

Yes, I can open and play videos with ffmpeg. But I'm not sure how fast and stable is it.

However, the text of the diagnostics and error messages should be copiable =/

dobrown commented 5 years ago
  1. AJE is not associated with Xuggle at all. And the Tracker class (deploy.OSXServices) that requires AJE to compile is instantiated at runtime using reflection in a try/catch block (fails gracefully on Linux and Windows which don't need OSXServices). To compile Tracker without AJE just delete the OSXServices class. The resulting jar will work on OSX but it will not communicate with the OS so some behavior expected by OSX users is missing. Bottom line--if you're distributing to Linux you don't need AJE.
nickkolok commented 5 years ago

Do you also have access to Windows and OSX machines? We need to get the ffmpeg version working on both those platforms in 64-bit VMs. That would be huge!

I have no direct access to 64-bit OSXor windows, but I can try to ask my friends to test Tracker installer... if we make one :)

So, I should split the issue into separate ones, shouldn't I ?

dobrown commented 5 years ago

I like the idea of starting with a Debian package. You should be able to do that without InstallBuilder if we know the target directories for everything, right?

The class deploy.TrackerStarter reads the user preferences file and launches Tracker. User preferences are stored in the file "tracker.prefs" (or sometimes ".tracker.prefs"). After launching Tracker, TrackerStarter writes a "tracker_start.log". You can read both using Help|Diagnostics|Start Log/Preferences File.

Even when you launch Tracker by double-clicking the tracker.jar file, TrackerStarter is called by Tracker to read the prefs and relaunch (the tracker.jar includes TrackerStarter).

tracker.jar and tracker_starter.jar are compiled and jared separately. On Windows, tracker_starter.jar is wrapped in a Tracker.exe file that Windows can execute.

dobrown commented 5 years ago

TrackerStarter also sets up the environment of the VM for Tracker.

dobrown commented 5 years ago

I'm able to build Frank's latest ffmpeg code on Windows but when I run the resulting tracker.jar ffmpeg doesn't work. I'm going to try to build and run it on Linux in VirtualBox.

nickkolok commented 5 years ago

I'm able to build Frank's latest ffmpeg code on Windows but when I run the resulting tracker.jar ffmpeg doesn't work. I'm going to try to build and run it on Linux in VirtualBox.

What build environment did you use? Have you tried this one: https://github.com/fschuett/osptracker-build ?