I’d like to add my notes for getting a complete (for my purposes) install of Scrivener on 64-bit Linux.
bash$ lsb_release -d
Description: Ubuntu 12.04.2 LTS
bash$ uname -r -m
3.5.0-18-generic x86_64
A. Kindlegen
Download the utility from http://www.amazon.com/gp/feature.html?docId=1000765211 (the 32-bit version for 2.x kernels is fine).
Unpack the tarball and copy the utility wherever you like, but make sure it is named kindlegen.bin instead of kindlegen (the Scrivener File-Select dialog box has a mask that requires a file extension). It is convenient to make a symlink named ‘kindlegen’ for Linux-specific applications that might use this.
cd /tmp
tar -zxf ~/downloads/kindlegen_linux_2.6_i386_v2_9.tar.gz
sudo cp kindlegen/kindlegen /usr/local/bin/kindlegen.bin
sudo ln -s /usr/local/bin/kindlegen.bin /usr/local/bin/kindlegen
B. Multimarkdown
Attempting to compile a Multimarkdown document results in an error message stating that the multimarkdown utility is not installed, and that you should run
sudo apt-get install libtext-multimarkdown-perl
in order to install it.
This multimarkdown utility, however, is incompatible with the command-line invocation performed by Scrivener. You will get an error dialog saying “Unknown error”, and the following message on the command line (you did run Scrivener from the command line for debugging purposes, didn’t you?) :
The fix? Uninstall the libtext-multimarkdown-perl package (if you indeed installed it), and instead install the multimarkdown utility from https://github.com/fletcher/peg-multimarkdown . This utility supports the options that Scrivener expects.
The commands (run in your home directory):
git clone git://github.com/fletcher/peg-multimarkdown.git
cd peg-multimarkdown
./update_submodules.sh
git submodule update
make
sudo cp multimarkdown /usr/local/bin
cd ..
rm -r peg-multimarkdown
Assuming you have git installed, this should “just work”: Latex files can now be generated.
C. GNOME-Keyring
On LTS systems (such as mine), the following error message may appear on the console when Scrivener starts up:
This is a fairly harmless message, and most users can ignore it. To get rid of the message, download the 32-bit package for gnome-keyring, unpack it, and copy the missing library to the expected location.
The 32-bit .deb package for gnome-keyring can be downloaded from the Ubuntu repositories at https://launchpad.net/ubuntu/precise/i386/gnome-keyring/3.2.2-2ubuntu4.1 .
cd /tmp
mkdir gnome-keyring
cd gnome-keyring
dpkg -x ~/downloads/gnome-keyring_3.2.2-2ubuntu4.1_i386.deb .
sudo cp -r usr/lib/i386-linux-gnu/pkcs11/ /usr/lib/i386-linux-gnu/
cd ..
rm -r gnome-keyring
Note that this is a brute-force installation of the library, and does not perform any of the apt or dpkg dependency checks (which fail due to an “uninstallable” libgcr-3-common:i386 package). It seems to work fine at runtime.
D. Spelling
A local copy of a 32-bit aspell can be installed in the LiteratureAndLatte directory tree, and configured to run locally.
Download the .deb files for the following packages:
aspell:i386 http://packages.ubuntu.com/precise/i386/aspell/download
libaspell15:i386 http://packages.ubuntu.com/precise/i386/libaspell15/download
- Unpack aspell and libaspell15.
cd /tmp
mkdir aspell libaspell
dpkg -x ~downloads/aspell*_i386.deb aspell
dpkg -x ~downloads/libaspell15*_i386.deb libaspell
- Seed the lib/aspell directory with a copy of the one in /usr/lib/aspell
sudo cp -r /usr/lib/aspell /usr/local/LiteratureAndLatte/lib
- Copy aspell and libaspell into the LiteratureAndLatte directory tree.
sudo cp -i aspell/usr/bin/* /usr/local/LiteratureAndLatte/bin/
sudo cp -r libaspell/usr/lib/aspell/* /usr/local/LiteratureAndLatte/lib/aspell/
sudo cp libaspell/usr/lib/libaspell.so.15.2.0 libaspell/usr/lib/libpspell.so.15.2.0 /usr/local/LiteratureAndLatte/lib
- Create symlinks so all the tools work properly
sudo ln -s /usr/local/LiteratureAndLatte/lib/libaspell.so.15.2.0 /usr/local/LiteratureAndLatte/lib/libaspell.so
sudo ln -s /usr/local/LiteratureAndLatte/lib/libaspell.so.15.2.0 /usr/local/LiteratureAndLatte/lib/libaspell.so.15
sudo ln -s /usr/local/LiteratureAndLatte/lib/libaspell.so.15.2.0 /usr/lib/i386-linux-gnu/libaspell.so
sudo ln -s /usr/local/LiteratureAndLatte/lib/libpspell.so.15.2.0 /usr/local/LiteratureAndLatte/lib/libpspell.so
sudo ln -s /usr/local/LiteratureAndLatte/lib/libpspell.so.15.2.0 /usr/local/LiteratureAndLatte/lib/libpspell.so.15
sudo ln -s /usr/local/LiteratureAndLatte/lib/libpspell.so.15.2.0 /usr/lib/i386-linux-gnu/libpspell.so
- Build 32-bit versions of the dictionaries in the LiteratureAndLatte directory tree.
a) replace symlinks with actual dictionary files
sudo rm /usr/local/LiteratureAndLatte/lib/aspell/*.rws
sudo cp /var/lib/aspell/*.rws /usr/local/LiteratureAndLatte/lib/aspell/
b) Create a shell script to rebuild the dictionaries using the 32-bit aspell install
echo '#!/bin/sh' > /tmp/gen_32_aspell_dicts.sh
echo "ASPELL_CONF='prefix /usr/local/LiteratureAndLatte'" >> /tmp/gen_32_aspell_dicts.sh
echo 'PATH="/usr/local/LiteratureAndLatte/bin:$PATH"' >> /tmp/gen_32_aspell_dicts.sh
echo export PATH ASPELL_CONF >> /tmp/gen_32_aspell_dicts.sh
chmod +x /tmp/gen_32_aspell_dicts.sh
sudo /usr/sbin/aspell-autobuildhash --dry-run --force 2>&1 | grep zcat | sed -e 's/var\/lib/usr\/local\/LiteratureAndLatte\/lib/' -e 's/usr\/lib/usr\/local\/LiteratureAndLatte\/lib/' >> /tmp/gen_32_aspell_dicts.sh
NOTE: This last command is very important to get right. I have created a pastebin for the command so that you can be sure to copy and paste it correctly: http://pastebin.com/JFGjnsjT.
An example shell script, for non-Ubuntu users, is available here: http://pastebin.com/sXbTTwAq . Be sure to modify it to suit your local system.
c) Execute the shell script as root
sudo bash /tmp/gen_32_aspell_dicts.sh
- Remove the downloaded files.
cd /tmp
rm -r aspell ispell
rm ~/downloads/libaspell*_i386.deb ~/downloads/aspell*_i386.deb
- Create a shell script for launching Scrivener with the aspell options set correctly.
echo '#!/bin/sh' > /tmp/scrivener.64
echo "ASPELL_CONF='prefix /usr/local/LiteratureAndLatte'" 'PATH="/usr/local/LiteratureAndLatte/bin:$PATH"' 'scrivener &' >> /tmp/scrivener.64
chmod +x /tmp/scrivener.64
sudo cp /tmp/scrivener.64 /usr/local/LiteratureAndLatte/bin/
- Enjoy!
/usr/local/LiteratureAndLatte/bin/scrivener.64
The commandline-averse among you may want to create a .desktop file for this.
UPDATE: I realized I was working off a tarball of Scrivener, and installed the .deb package. This includes the file /usr/share/scrivener/bin/scrivener.sh , which is a much better startup script than I provided in step 7. The above steps can be applied to /usr/share/scrivener instead of /usr/local/LiteratureAndLatte , and the scrivener.sh script modified as follows:
bindir=`dirname "$me"`
libdir=`cd "$bindir/../lib" ; pwd`
LD_LIBRARY_PATH=$libdir
export LD_LIBRARY_PATH
# ======================================
# Add these three lines here:
basedir=`cd "$bindir/.." ; pwd`
ASPELL_CONF="prefix $basedir"
export ASPELL_CONF
# ======================================
unset QT_PLUGIN_PATH
exec "$bindir/Scrivener" ${1+"$@"}
OLD, DANGEROUS, BRUTE-FORCE METHOD (retained for posterity)
[i]
The following code will replace the 64-bit aspell .so files and binaries with 32-bit ones, and rebuild the system dictionaries to be 64-bit – without removing the 64-bit aspell dependency from the package manager.
After making these changes, a 32-bit installation of Scrivener will have a working aspell-based spellchecker on a 64-bit system. A handful of 64-bit applications (Firefox, Thunderbird, Open Office, Opera) have been tested, and (unexpectedly) continue to work fine after these changes.
WARNING These changes will make your system non-standard, may break spell-checking in some 64-bit applications, and may be overwritten during a system upgrade. USE AT YOUR OWN RISK.
Download the .deb files for the following packages:
aspell:i386 http://packages.ubuntu.com/precise/i386/aspell/download
aspell-en:all http://packages.ubuntu.com/precise/aspell-en
libaspell15:i386 http://packages.ubuntu.com/precise/i386/libaspell15/download
- Unpack aspell and libaspell15.
cd /tmp
mkdir aspell libaspell
dpkg -x ~downloads/aspell*_i386.deb aspell
dpkg -x ~downloads/libaspell15*_i386.deb libaspell
- Copy libaspell into the system 32-bit library location.
sudo cp usr/lib/libaspell.so.15.2.0 /usr/lib/i386-linux-gnu/
sudo ln -s /usr/lib/i386-linux-gnu/libaspell.so.15.2.0 /usr/lib/i386-linux-gnu/libaspell.so.15
sudo ln -s /usr/lib/i386-linux-gnu/libaspell.so.15.2.0 /usr/lib/i386-linux-gnu/libaspell.so
sudo cp usr/lib/libpspell.so.15.2.0 /usr/lib/i386-linux-gnu/
sudo ln -s /usr/lib/i386-linux-gnu/libpspell.so.15.2.0 /usr/lib/i386-linux-gnu/libpspell.so.15
sudo ln -s /usr/lib/i386-linux-gnu/libpspell.so.15.2.0 /usr/lib/i386-linux-gnu/libpspell.so
- Replace the support binaries in /usr/lib/aspell with 32-bit versions
sudo cp -r libaspell/usr/lib/aspell /usr/lib/aspell.orig
sudo cp -r libaspell/usr/lib/aspell/*.so /usr/lib/aspell/
sudo cp -r libaspell/usr/lib/aspell/*spell /usr/lib/aspell/
- Replace the executables in /usr/bin with 32-bit versions (optional).
sudo mv /usr/bin/aspell /usr/bin/aspell.orig
sudo mv /usr/bin/aspell-import /usr/bin/aspell-import.orig
sudo mv /usr/bin/precat /usr/bin/precat.orig
sudo mv /usr/bin/prezip /usr/bin/prezip.orig
sudo mv /usr/bin/preunzip /usr/bin/preunzip.orig
sudo mv /usr/bin/prezip-bin /usr/bin/prezip-bin.orig
sudo mv /usr/bin/run-with-aspell /usr/bin/run-with-aspell.orig
sudo mv /usr/bin/word-list-compress /usr/bin/word-list-compress.orig
sudo cp aspell/usr/bin/* /usr/bin/
- Reinstall the dictionaries. This will build 32-bit dictionaries (readable by 64-bit aspell libraries as well, as per http://aspell.net/0.61/man-html/Using-32_002dBit-Dictionaries-on-a-64_002dBit-System.html).
sudo dpkg -i ~/downloads/aspell-en*.deb
- Remove the downloaded files.
cd /tmp
rm -r aspell ispell
rm ~/downloads/libaspell*_i386.deb ~/downloads/aspell*_i386.deb
Note that these steps are non-destructive: you can always roll back the changes by restoring the files named .orig.[/i]