Running and compiling GuideMe under Linux (and MacOSX) + syntax checker

Webteases are great, but what if you're in the mood for a slightly more immersive experience? Chat about Tease AI and other offline tease software.

Moderator: 1885

Post Reply
mantrid
Explorer At Heart
Explorer At Heart
Posts: 154
Joined: Sun Dec 30, 2018 6:40 pm
Gender: Male
Sexual Orientation: Straight
I am a: Switch

Running and compiling GuideMe under Linux (and MacOSX) + syntax checker

Post by mantrid »

GuideMe is written in Java and therefore also runs on Linux and Mac OSX. (I only tested Linux, but MacOSX should work in the same way). Only requirements are a recent Oracle Java installation.

Running
  1. Download the latest windows binary package which can be found in the signature of philo (currently 3.8) create a new directory and unpack it there.
  2. Remove the `Java` directory, change to `GuideMe_lib` and remove `*swt*.jar` and `*.dll`
  3. Install the SWT libs: Go to https://download.eclipse.org/eclipse/downloads/ click on the latest release -> scroll down to the SWT binaries section -> download the archive for your platform (Linux, MacOSX and Windows are supported) -> unpack it and copy the .jar file (`swt.jar` in my case) to directory `GuideMe_lib`
  4. Copy this script the the main directory and start it.
    Spoiler: show

    Code: Select all

    #!/bin/bash
    jars=`ls GuideMe_lib/*.jar *.jar | while read a; do echo -n ":$a"; done`
    java -cp .$jars org.guideme.guideme.App $@
Compiling
  1. Go to https://github.com/guide-me/GuideMe and download the repository (I tested the `philo` branch which seems to be the newest one), create a new directory and unpack it there.
  2. Link or copy the directory `GuideMe_lib` from the binary directory (see above) to the source directory
  3. Copy this Makefile to the main directory and run 'make'.
    Spoiler: show

    Code: Select all

    #########################
    # configuration section #
    #########################
    
    .PHONY: all clean distclean
    
    # directories
    BUILDDIR=target
    LIBDIR=GuideMe_lib
    SRCDIR=src/main/java
    PKGDIR=org/guideme/guideme
    PKGDIR2=org/mozilla/javascript
    CLASSPATH=src/main/java$(shell ls $(LIBDIR)/*.jar | while read a; do echo -n ":$$a"; done)
    
    # build targets
    JARTARGET=GuideMe.jar
    CLASSTARGET=$(BUILDDIR)/org/guideme/guideme/App.class
    JARENTRYPARAMS=cemf $(basename $(JARTARGET)).$(basename $(JARTARGET))
    #JAVAFILES:=$(wildcard usc/*.java)
    
    # binaries
    JAVAC=$(JAVAC_PATH)javac -Xlint:deprecation -Xlint:unchecked
    INSTALL=install
    JAR=jar
    
    all : $(JARTARGET)
    
    $(CLASSTARGET): $(SRCDIR)/$(PKGDIR)
    	install -d $(BUILDDIR)
    	$(JAVAC) -cp "$(CLASSPATH)" -d $(BUILDDIR)  $(SRCDIR)/$(PKGDIR)/*.java $(SRCDIR)/$(PKGDIR2)/jdk*/*.java
    
    
    $(JARTARGET) : $(CLASSTARGET)
    #	$(shell (echo "Main-Class: org.guideme.guideme.App"; echo -n "Class-Path:"; ls $(LIBDIR)/*.jar | while read a; do echo " $$a"; done ) > Manifest-tmp.txt )
    	$(JAR) cf $(JARTARGET) -C $(BUILDDIR) .
    #	rm -f Manifest-tmp.txt
    
    clean:
    	rm -fr $(BUILDDIR)
    
    distclean: clean
    	rm -f $(JARTARGET)
    
    Warnings can be ignored and `GuideMe.jar` should be build. Copy this file to the binary directory (see above) or find out which files are needed and copy them to the source directory.
Broken link checker
Here is a little utility which checks the .xml files for broken links. It's a bash script, i.e. it requires a Unix environment:
Spoiler: show

Code: Select all

#!/bin/bash

TARGETS=targets.txt
FILES=files.txt

# rm -fr new

#1: xml file
#2: old string
#3: new string
fix () {
    install -d new
    inf=$1
    outf=new/$1
    if [ -f $outf ]; then
	inf=$outf.orig
	mv $outf $inf
    fi
    a=$(echo $2 | sed "s/\//\\\\\//")
    b=$(echo $3 | sed "s/\//\\\\\//")
    sed "s/$a/$b/" $inf > $outf
}


# generate list of targets
for f in *.xml; do
    grep -i "<Page.*id=\"" $f | sed "s/.*id=\"//;s/\".*//"
done | sort -n > $TARGETS

# generate list of files
find -type f | sed "s/.\///" > $FILES

# check for non-existing files
for f in *.xml; do
    ( 
	(
	    grep -ni "<Image.*id=" $f 
	    grep -ni "<audio.*id=" $f 
	) |  sed "s/:.*id=\"/ /;s/\".*//"
        grep -n "setAudio(\"" $f | sed "s/:.*setAudio(\"/ /;s/\".*//" 
    ) | while read a b; do
	    if ! grep -q "$b" $FILES; then
		r=`grep -i -m 1 "$b" $FILES`
		if [ "$r" = "" ]; then
		    echo "$f($a): File not found '$b'" 
		else
		    echo "$f($a): Replacing '$b' by '$r" 
		    fix $f $b $r
		fi
	    fi
	done
done

# check broken targets
for f in *.xml; do
    grep -ni "target=\"" $f | sed "s/:.*target=\"/ /;s/\".*//" | \
	while read a b; do
	    if [ ${b:0:1} = "(" ]; then
		b=${b:1:-1}
		bz=${b#*..}
		ba=${b%..*}
		b=$ba
		# only check whether there is at least one valid target in range
		while [ $b != - ] && [ $b -le $bz ]; do
		    if grep -q "$b" $TARGETS; then
			b=-
		    else 
			let "b++" 
		    fi
		done
		[ $b != - ] && echo "$f($a): No existing target within range '$ba..$bz'"
	    else
		grep -q "$b" $TARGETS || echo "$f($a): Target '$b' does not exist"
	    fi
	done
done 
Usage: Copy this script and the main .xml file into the data directory of the tease and run the script. Case errors are are fixed automatically (file names under Unixes are case sensitive). The corrected files are written to the directory 'new'. The script also generates a sorted list of all targets ('targets.txt') which may be helpful.

Updates
  • 2019-02-21: Broken link checker added
  • 2019-02-22: Broken link checker updated: First version did not recognized all errors
Last edited by mantrid on Fri Feb 22, 2019 3:23 pm, edited 1 time in total.
GAsm -- A guide assembler with EStim support to generate interactive teases that run in a browser.
mantrid
Explorer At Heart
Explorer At Heart
Posts: 154
Joined: Sun Dec 30, 2018 6:40 pm
Gender: Male
Sexual Orientation: Straight
I am a: Switch

Re: Running and compiling GuideMe under Linux (and MacOSX) + syntax checker

Post by mantrid »

I wrote a small script which checks for broken links and fixes case errors (filenames under Unixes are case sensitive). Because I do not want of create another thread that no one reads I appended it to this topic (see the initial).
GAsm -- A guide assembler with EStim support to generate interactive teases that run in a browser.
sbdx
Explorer
Explorer
Posts: 12
Joined: Thu Sep 20, 2018 8:38 pm

Re: Running and compiling GuideMe under Linux (and MacOSX) + syntax checker

Post by sbdx »

Thank you for taking the time to post these excellent instructions!

Using Linux Mint, I also had to:
apt install libjson-simple-java
cp /usr/share/java/json-simple.jar GuideMe_lib

This allowed it to compile with warnings, but no errors.

When I run the startup script you included in your post, it pauses for 2-3 seconds, then drops back to the prompt. No errors or other messages, but no GuideMe either.

What Linux distro are you using?
mantrid
Explorer At Heart
Explorer At Heart
Posts: 154
Joined: Sun Dec 30, 2018 6:40 pm
Gender: Male
Sexual Orientation: Straight
I am a: Switch

Re: Running and compiling GuideMe under Linux (and MacOSX) + syntax checker

Post by mantrid »

sbdx wrote: Mon Aug 12, 2019 12:19 am Thank you for taking the time to post these excellent instructions!

Using Linux Mint, I also had to:
apt install libjson-simple-java
cp /usr/share/java/json-simple.jar GuideMe_lib
You are compiling version 0.4.0 which has that additional dependency.

This version uses a new state file format, i.e. delete all .state files in the data directory.

There are a few dependencies which are not required at compiling time. But usually they cause error messages. If deleting state files does not work, first make sure that the binaries run:
  1. Download and install Windows package for version 0.3.8 and convert it to Linux as mentioned in the initial post, test it
  2. Upgrade it to 0.4.0 as described in this post and make sure that it work (delete .state files)
What Linux distro are you using?
Debian.
GAsm -- A guide assembler with EStim support to generate interactive teases that run in a browser.
sbdx
Explorer
Explorer
Posts: 12
Joined: Thu Sep 20, 2018 8:38 pm

Re: Running and compiling GuideMe under Linux (and MacOSX) + syntax checker

Post by sbdx »

mantrid wrote: Mon Aug 12, 2019 7:35 am delete all .state files in the data directory.
Bingo. I missed that in the other post. Removing the .state files was all it took, and it now works.

I thank you for the help!
sbdx
Explorer
Explorer
Posts: 12
Joined: Thu Sep 20, 2018 8:38 pm

Re: Running and compiling GuideMe under Linux (and MacOSX) + syntax checker

Post by sbdx »

FWIW I also got this to work on a Raspberry Pi 3B+ running the latest Raspbian "Buster" using the "Raspbian Buster with desktop and recommended software" image.

The RPI still uses a 32 bit OS, so the SWT download won't work here. Fortunately a version is available through the distro installer.

sudo apt install openjdk-11-jre libswt-webkit-gtk-3-jni libswt-webkit-gtk-4-jni libswt-gtk-4-jni libswt-gtk-4-java libswt-gtk-3-jni libswt-gtk-3-java libswt-glx-gtk-4-jni libswt-glx-gtk-3-jni libswt-cairo-gtk-4-jni libswt-cairo-gtk-3-jni firefox-esr libjson-simple-java

cp /usr/share/java/swt.jar GuideMe_lib

Then follow the directions in the first post.

It is quite slow to load, but runs okay after it does.
User avatar
computergeek
Explorer At Heart
Explorer At Heart
Posts: 133
Joined: Sat Jul 14, 2012 11:59 am
Gender: Male
Sexual Orientation: Straight
I am a: Master
Contact:

Re: Running and compiling GuideMe under Linux - Help Please?

Post by computergeek »

I got a dependency error I can not seem to get past. Lonf time Linux user, but not well versed in Java. Running Kubuntu 18 Bionic and getting no swt-win32-4626 in java.library.path error. From what I can tell of the /usr/share/java selection, I am missing some module or another to make this compatible. Running default Ubuntu Java:

openjdk version "11.0.6" 2020-01-14
OpenJDK Runtime Environment (build 11.0.6+10-post-Ubuntu-1ubuntu118.04.1)
OpenJDK 64-Bit Server VM (build 11.0.6+10-post-Ubuntu-1ubuntu118.04.1, mixed mode, sharing)

So far I have tried installing:

ibswt-gtk-3-java
libswt-webkit-gtk-3-jni
libswt-gtk-3-jni
libswt-glx-gtk-3-jni
libswt-cairo-gtk-3-jni
libjson-simple-java

What am I missing?
mantrid
Explorer At Heart
Explorer At Heart
Posts: 154
Joined: Sun Dec 30, 2018 6:40 pm
Gender: Male
Sexual Orientation: Straight
I am a: Switch

Re: Running and compiling GuideMe under Linux - Help Please?

Post by mantrid »

computergeek wrote: Sat Feb 01, 2020 5:12 pm Running Kubuntu 18 Bionic and getting no swt-win32-4626 in java.library.path error.
See the initial post:
Install the SWT libs: Go to https://download.eclipse.org/eclipse/downloads/ click on the latest release -> scroll down to the SWT binaries section -> download the archive for your platform (Linux, MacOSX and Windows are supported) -> unpack it and copy the .jar file (`swt.jar` in my case) to directory `GuideMe_lib`
If that does not work, switch to Oracle Java before you try OpenJDK because their API's are not fully compatible.
GAsm -- A guide assembler with EStim support to generate interactive teases that run in a browser.
PsuedoxXx
Curious Newbie
Curious Newbie
Posts: 2
Joined: Fri Dec 19, 2014 3:06 am

Re: Running and compiling GuideMe under Linux (and MacOSX) + syntax checker

Post by PsuedoxXx »

Link or copy the directory `GuideMe_lib` from the binary directory (see above) to the source directory
Is there no way to build GuideMe_lib from scratch? This seems sketchy, I don't want to use precompiled libs without knowing what's in them.
mantrid
Explorer At Heart
Explorer At Heart
Posts: 154
Joined: Sun Dec 30, 2018 6:40 pm
Gender: Male
Sexual Orientation: Straight
I am a: Switch

Re: Running and compiling GuideMe under Linux (and MacOSX) + syntax checker

Post by mantrid »

PsuedoxXx wrote: Fri Feb 07, 2020 1:59 pm Is there no way to build GuideMe_lib from scratch?
Probably not. GuideMe has a lot of strange dependencies and some of them may not be open source. (IMHO that could be avoided if GuideMe would produce HTML output which can be viewed in a browser)
PsuedoxXx wrote: Fri Feb 07, 2020 1:59 pm This seems sketchy, I don't want to use precompiled libs without knowing what's in them.
Correct, never allow programs that haven't compiled by yourself or a trustworthy and indepenent 3rd party unrestricted access to local resources. That's why GuideMe runs in a firejail sandbox on my computers. Alternatives are apparmor or a virtual machine.
GAsm -- A guide assembler with EStim support to generate interactive teases that run in a browser.
philo
Explorer At Heart
Explorer At Heart
Posts: 831
Joined: Sun Jan 08, 2012 3:10 pm
Gender: Male
Sexual Orientation: Straight
Location: UK

Re: Running and compiling GuideMe under Linux (and MacOSX) + syntax checker

Post by philo »

The source code is all here, you should be able to compile it up using eclipse.
It uses maven for the third party dependencies, which are all in the pom file.
https://github.com/guide-me/GuideMe/tree/Philo

I wrote GuideMe partly to learn Java (the project was started in 2013), but work in c# now.
If I wrote it now I would probably write it in dotnet core and have the UI browser based
Jassinov
Explorer
Explorer
Posts: 35
Joined: Sat Jul 27, 2019 11:09 pm
Sexual Orientation: Bisexual/Bi-Curious
I am a: Switch

Re: Running and compiling GuideMe under Linux - Help Please?

Post by Jassinov »

computergeek wrote: Sat Feb 01, 2020 5:12 pm I got a dependency error I can not seem to get past. Lonf time Linux user, but not well versed in Java. Running Kubuntu 18 Bionic and getting no swt-win32-4626 in java.library.path error. From what I can tell of the /usr/share/java selection, I am missing some module or another to make this compatible. Running default Ubuntu Java:

openjdk version "11.0.6" 2020-01-14
OpenJDK Runtime Environment (build 11.0.6+10-post-Ubuntu-1ubuntu118.04.1)
OpenJDK 64-Bit Server VM (build 11.0.6+10-post-Ubuntu-1ubuntu118.04.1, mixed mode, sharing)

So far I have tried installing:

ibswt-gtk-3-java
libswt-webkit-gtk-3-jni
libswt-gtk-3-jni
libswt-glx-gtk-3-jni
libswt-cairo-gtk-3-jni
libjson-simple-java

What am I missing?
I have the same problem... Were you able to fix your issues after switching to Oracle? For me it does not change anything and I don't really know how to compile a Java Project from Eclipse.
Does anyone know how to deal with this?
In my case, I'm running on Lubuntu 18.04
Post Reply

Who is online

Users browsing this forum: binkybet and 28 guests