In the case where you do not want to or cannot download the pre-made SpiderMonkey libraries, there is always the option of compiling SpiderMonkey yourself. Avidemux only needs a Mozilla JavaScript library and the jsapi.h associated source files.
You will need to download the JavaScript SpiderMonkey engine. This is usually called simple 'js' for Javascript. This can be done by searching for the SpiderMonkey development package in your package manager. Depending on the your distribution of Linux, it can be called libsmjs, libmozjs, or libjs or something like that. We suggest you search for these names or something with “spidermonkey” and “dev”.
It usually has the name by using the 'apt-get install' or 'apt-rpm install' or 'emerge' systems on your various Linux distributions.
If you cannot use your distributions package or install system to automatically download a copy of the SpiderMonkey package, here is an link to a currently working version: ftp://ftp.mozilla.org/pub/mozilla.org/js/js-1.5.tar.gz
Extract the downloaded source files it into a directory. For example, let's call the directory: /home/user/JavaScript_src/
Run these commands from a console:
cd /home/user/JavaScript_src/js/src make -f Makefile.ref # (or gmake in the case of some distributions)
The next step depends a lot on your distribution of Linux. Choose one that applies to you.
These are the normal commands for compiling SpiderMonkey. They may vary depending on your Linux distribution. Please look at the other sections on this page for specific settings for different Linux distributions.
./configure (with your extra arguments if necessary) make make install
This process will not work for most Ubuntu systems version 6.10. We suggest you try Method B.
We are not certain if this process works for Gentoo, but it might. Feel free to correct the instructions if they are wrong for Gentoo.
mkdir /usr/include/smjs cp /home/user/JavaScript_src/js/src/Linux_All_DBG.OBJ/jsautocfg.h /usr/include/smjs/jsautocfg.h cp /home/user/JavaScript_src/js/src/Linux_All_DBG.OBJ/libsmjs.so /usr/lib/libsmjs.so cp /home/user/JavaScript_src/js/src/Linux_All_DBG.OBJ/*.h /usr/include/smjs/
Lastly edit /etc/ld.so.conf and add the line /usr/lib. Now you may proceed with compilation of Avidemux.
Building a thread safe version of SpiderMonkey requires the “Netscape Portable Runtime” (NSPR) library.
To setup the proper compile environment, run these commands from a console:
JS_THREADSAFE=1 export JS_THREADSAFE
As root run from console:
emerge nspr
You can use the “js-1.5.tar.gz” archive from the Mozilla website at http://ftp.mozilla.org/pub/mozilla.org/js/. After you download it, unpack the archive and go to the ./js/src/ directory.
Edit the Makefile.ref to reflect the “NSPR” install. Lines after the comments (starting with #) are the edited version of the original line:
ifdef JS_THREADSAFE DEFINES += -DJS_THREADSAFE # INCLUDES += -I../../dist/$(OBJDIR)/include INCLUDES += -I/usr/include/nspr ifdef USE_MSVC OTHER_LIBS += ../../dist/$(OBJDIR)/lib/libnspr${NSPR_LIBSUFFIX}.lib else # OTHER_LIBS += -L../../dist/$(OBJDIR)/lib -lnspr${NSPR_LIBSUFFIX} OTHER_LIBS += -L/usr/lib/nspr -lnspr4 endif endif
Next we need to build SpiderMonkey. For “debug” version (default), run this command from a console:
make -f Makefile.ref
For “release” version, run this command from a console:
make -f Makefile.ref BUILD_OPT=1
If you have a previous version of SpiderMonkey emerged, then just overwrite it with. Run these commands from a root console:
cp *.h /usr/include/js # For default debug version: cp Linux_All_DBG.OBJ/libjs.so /usr/lib # For release version: cp Linux_All_OPT.OPJ/libjs.so /usr/lib exit
If you don't have a previous version of SpiderMonkey, then just create the “/usr/include/js” directory.
This is valid for Red Hat, but some people do not like this solution for Slackware. See the Slackware section for other options.
mkdir /usr/local/include/js cp /home/user/JavaScript_src/js-1.5.tar.gz_FILES/js/src/Linux_All_OPT.OBJ/jsautocfg.h /usr/local/include/js/jsautocfg.h cp /home/user/JavaScript_src/js-1.5.tar.gz_FILES/js/src/Linux_All_OPT.OBJ/libjs.so /usr/local/lib/libjs.so cp /home/user/JavaScript_src/js-1.5.tar.gz_FILES/js/src/*.h /usr/local/include/js/
Lastly edit /etc/ld.so.conf and add the line /usr/local/lib. Now you may proceed with compilation of Avidemux.
install nspr-devel yum install nspr-devel
This will create the directory /usr/include/nspr4/.
cd js/src
cp Makefile.ref Makefile
FROM : INCLUDES += -I../../dist/$(OBJDIR)/include TO: INCLUDES += -I/usr/include/nspr4
export JS_THREADSAFE=1 make
cp Linux_All_DBG.OBJ/libjs.so /usr/lib
On Slackware there are no precompiled packages for libjs, so you can either try to do something with the source files. There is the Library Error/Failure section if you want to try a trick with symlinks. Another option is that you can avoid installing the libraries altogether and compile Avidemux against the Mozilla webbrowser. If you have the Mozilla installed, you can try this trick instead of symlinks.
You will need to find the location of your copy of Mozilla.
--with-jsapi-include=/path/to/mozilla-version/ LDFLAGS="-L/path/to/mozilla-version/"
Example:
--with-jsapi-include=/usr/include/mozilla-1.7.11/js/ \ LDFLAGS="-L/usr/lib/mozilla-1.7.11/"
This is the extra arguments you would use in the ./configure step during the Avidemux compiling, not the SpiderMonkey library compiling.
Here is how to compile the libmozjs.so library yourself another way. These instructions are currently only tested on Ubuntu, but they should work for most distributions of Linux.
You need to download the source files. When you run this run this command, it will download the source files to your current console location. If you run the command as root, it will set the owner of the files as root, so beware you may need to change the ownership.
From a root console or via sudo run this command:
sudo apt-get source libmozjs-dev libidl-dev
This will grab the source code packages for the SpiderMonkey development library. The download will be very large, and will include a lot of files besides the ones you are interested in. Do not worry, this is normal. The IDL library is a dependency for compiling. Once the file download is complete, it should automatically be extracted. The directory will probably have a name like xulrunner-1.x.x.x with the 'x' representing version numbers.
From a console run these commands:
cd xulrunner-1.x.x.x # Where the xxxx are the version numbers ./configure \ --enable-application=standalone \ --disable-mailnews \ --disable-ldap \ --disable-gnomevfs \ --disable-gnomeui \ --disable-jsd \ --disable-plugins \ --disable-oji \ --disable-view-source \ --disable-accessibility \ --disable-jsloader \ --disable-composer \ --disable-postscript \ --disable-xtf \ --disable-xpfe-components \ --disable-xpinstall \ --disable-xprint \ --disable-xpcom-obsolete \ --disable-mathml \ --disable-installer \ --disable-updater \ --disable-activex \ --disable-activex-scripting \ --disable-xul \ --disable-profilesharing \ --disable-profilelocking \ --disable-necko-disk-cache \ --disable-cookies \ --disable-v1-string-abi \ make
The 'make' command will take a very long time to finish. When it is done, from a console run these commands:
cd xulrunner-1.x.x.x # Where the xxxx are the version numbers sudo cp js/src/libmozjs.so /usr/lib/
Now you have successfully compiled the libmozjs.so library and you can delete the xulrunner files.
When doing the configure, if you used the --prefix for jsapi.h, but there is an error at the library stage, locate libsmjs.so or libjs.so or libmozjs.so on your system. Then symbolically link it to /usr/local/lib or /usr/lib