Spell Check

chroot environment. Sounds like overkill, but then again “yak-shaving” is my middle name.

I’ve become a little bit fond of the false-positives in the spell checker. It seems to be falsely picking up -ly and -ing words, which, as you may know, are on the undesirable list for strong fiction prose. If only it was consistent in its false-positives. I don’t think it has picked up a noun falsely.

I find it the “underline a word as wrong and then suggest the exact same word when you right-click on it” scenario intensely frustrating.

hopefully this is high up on the defect list. I guess I’ll pull out the dictionary until the next patch is released.

I was keeping a list of the words that Scrivener’s spellcheck doesn’t pick up on. They’re all recognized as correctly spelled via aspell on the command line.

Is there a defect list for the Linux stuff? Honestly, the impression I got was all they were doing was recompiling the Windows version to Linux and they weren’t supporting it in any way beyond that at this point. Maybe at some point in the future, but I assumed there was no active development for Linux at all right now.

+1
I’ve sent a bug report in this forum but nobody answer. :cry:

This Scrivener on Linux forum is “user supported” at this time. That is made clear in the forum dialogue: “Meeting area for those running the unofficial Linux version of Scrivener (please note that there is no official Linux version as yet, so Linux versions are community-supported only).”

The developers have graciously made the Linux port of Scrivener freely available, on the terms that they cannot be expected to provide support at this time.

Hopefully some Linux guru might come along with an answer to the 32/64 bit spell check problems. Until then, perhaps “Artha” or another spell check/dictionary might provide an alternate solution?

Thanks guys. I installed libaspell-dev from the software center and now I have spelling check. Cool beans!

The libaspell-dev package just creates a symink from /usr/lib/libaspell.so to /usr/lib/libaspell.so.15.2.0 . I tried this and had no luck (64-bit Ubuntu 12.04 LTS).

I downloaded the 32-bit .deb file for libaspell15, extracted it, and copied contents of usr/lib in the package to /usr/lib/i386-linux-gnu . I then created a symlink from /usr/lib/i386-linux-gnu/libaspell.so to /usr/lib/i386-linux-gnu/libaspell.so.15.2.0 .

This got me a bit farther: the system dictionaries show up in Options->Correction, and I can change dictionaries, but Autocheck and Spelling (Ctrl+:) do not work. Using the command line LD_DEBUG=libs scrivener & confirms that the 32-bit library is being loaded instead of the 64-bit.

The files in /var/lib/aspell are supposed to be architecture-independent, so switching libraries should not be a problem. According to https://help.ubuntu.com/community/OperaBrowser , adding the 32-bit library (to /usr/lib32 for Opera; to /usr/lib/i386-linux-gnu for Scrivener) is all that is necessary.

Something is rotten in the state of aspell :wink:

UPDATE: I replaced the .so files and the executables (ispell and spell) in /usr/lib/aspell with the 32-bit versions, then re-installed the .deb for aspell-en (aspell-en_6.0-0-6ubuntu2_all.deb). The postinst script for the .deb file rebuilt the dictionaries, and spelling (including Autocorrect) became functional in Scrivener.

After replacing the aspell binaries in /usr/bin with 32-bit versions, spelling continues to work in other applications (which was rather unexpected). This seems to be due to the fact that the 64-bit libraries can read the 32-bit dictionary files, but not vice-versa (see http://aspell.net/0.61/man-html/Using-32_002dBit-Dictionaries-on-a-64_002dBit-System.html), although it doesn’t explain why the 32-bit .so files in /usr/lib/aspell fail to cause conflicts.

After getting the 32-bit code working at the expense of interfering with system files (see [url]https://forum.literatureandlatte.com/t/a-mostly-complete-guide-to-installing-scrivener-on-linux/19819/1]), I began to wonder why aspell doesn’t allow this sort of thing to be handled via an environment variable.

It turns out, however, that it does. The environment variable ASPELL_CONF can be used to supply config options at runtime, one of which is the prefix option. A quick test (by reverting /usr/lib/aspell to 64-bit, and moving the 32-bit version into /usr/local/lib) proved successful.

ASPELL_CONF='prefix /usr/local' LD_DEBUG=libs scrivener

This of course depends on 32-bit dictionaries, but it does mean that a 32-bit and a 64-bit aspell installation can live side by side.

I’ll have to spend some time thinking about (and writing shell commands) how to do this properly, but it looks like the basic procedure is more or less as follows:

  1. download and extract 32-bit aspell and libaspell
  2. copy the contents of usr/bin and /usr/lib from these packages into the Scrivener directory tree (under bin/ and lib/, or possible aspell/bin aspell/lib)
  3. symlink /usr/lib/i386-linux-gnu/libaspell.so to the .so in the scrivener directory tree
  4. generate 32-bit versions of the dictionaries under the Scrivener directory tree
  5. create a launcher (e.g. scrivener.64.sh) that invokes Scrivener with the ASPELL_CONF env variable set correctly

#4 is going to be the most tricky, but the postinst script for aspell-en.deb shows that it’s a simple command-line call … which can be done with the ASPELL_CONF variable.

Should be a good project for the train on Monday. UPDATE: It wasn’t so bad. Instructions have been added to the thread “A Mostly Complete Guide to Installing Scrivener on Linux”, linked to above.

Relevant sections of the aspell manual:
http://aspell.net/man-html/The-Options.html#The-Options
http://aspell.net/man-html/Specifying-Options.html#Specifying-Options
http://aspell.net/man-html/Notes-on-the-Prefix-Option.html#Notes-on-the-Prefix-Option

… you might be my hero.

Thank you so much for this! Took a couple of try’s (my mistake rebuilding the *.rws stuff), but it works!

Ubuntu 64bit

I went through the very detail procedure fromthe other thread (thanks), but I keep getting an error when trying to generate the 32bit dictionary files.

aspell: error while loading shared libraries: libaspell.so.15: wrong ELF class: ELFCLASS64

It seems the aspell bin, from the 32 bit debian package won’t run on my system (Ubuntu 12.10) even though i have the 32 bit library support installed (ia32-libs).

Anyone have any ideas? Or even had it running on 12.10?

Cheers.

This error indicates that you are running the 32-bit version of the aspell utility, but it is trying to load or link to the 64-bit libraries.

In order to run the 32-bit executables (to generate 32-bit dictionaries), you have to set the environment variables AC_CONF, LD_LIBRARY_PATH, and PATH.

Example:

export LD_LIBRARY_PATH="/usr/share/scrivener/lib" 
export PATH="/usr/share/scrivener/bin:$PATH" 
export AC_CONF="/usr/share/scrivener" 
sudo /usr/sbin/aspell-autobuildhash --dry-run  --force 2>&1 | grep zcat | sed -e 's/var\/lib/usr\/share\/scrivener\/lib/' -e 's/usr\/lib/usr\/share\/scrivener\/lib/' > /tmp/gen_32_aspell_dicts.sh
chmod +x /tmp/gen_32_aspell_dicts.sh
sudo /tmp/gen_32_aspell_dicts.sh

It sounds like either AC_CONF or LD_LIBRARY_PATH is not set correctly when you are generating the dictionaries – I’d mess around with those to try getting it to work. Also, use LD_DEBUG=libs in order to see where the libraries are being loaded from.

export LD_DEBUG="libs"

Thanks for the help. That allowed me to create the dictionary files. I can now see 3 English dictionary options in my spell-checking section, but its not doing any spell-checking…ho-hum.

But you are a scholar and a gentleman for providing the help you have :slight_smile:

Ever have been :wink:

Make sure, when you start scrivener, that it is using the 32-bit libraries and support files (especially the dictionaries).

This requires that the ASPELL_CONF environment variable be set to /usr/share/scrivener . I put the modifications to /usr/share/scrivener/bin/scrivener.sh in the other thread, but here they are again:

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+"$@"}   

Also, I added a symlink in /usr/lib/i386-linux-gnu to the 32-bit aspell library. This is the command:

sudo ln -s /usr/share/scrivener/lib/libpspell.so.15.2.0 /usr/lib/i386-linux-gnu/libpspell.so

…although the 32-bit library directory may be very different on your system. I only had to do this during testing though; the LD_LIBRARY_PATH setting in /usr/share/scrivener/bin/scrivener.sh should take care of this.

Yeah, i’ve done all that but still no joy.

Oh well, thanks for the help anyway. Much appreciated.

Hmm.

When I had the choice of dictionaries in scrivener, and there was no actual spell-checking, it was because the 64-bit dictionaries were being used (instead of the 32-bit ones).

Take a look at /usr/share/scrivener/lib/aspell, and make sure the .rws files are not symlinks to /var/lib/aspell. Ideally, there should be 64-bit dictionaries in /var/lib/aspell and 32-bit dictionaries in /usr/share/scrivener/lib/aspell.

Note that the 64-bit aspell can read 32-bit dictionaries (but not vice-versa), so it is possible to just generate 32-bit dictionaries in /var/lib/. These will get overwritten the next time the aspell dictionary packes are upgraded, though.

Hmm. Maybe I compiled the dictionaries as 64 bit. Would they have the same physiical size as the 32 bit ones? Because the ones i have in my scrivener aspell library are exactly the same size as those in /var/lib/aspell (they aren’t simlinks btw)

I’m probably doing something stupid. It is Friday after all.

Got it!!!

I think the shell script starts of with default environment variables, so the command line exports I made had no real effect and I was using the 64bit aspell to compile the libraries :slight_smile: So I added the LD_LIBRARY, PATH etc exports you mentioned into the script and I now have red squiggly lines :slight_smile:

Once again. Thanks for all your help. You are a gentleman, a scholar, and now a connoisseur of fine wines :smiley: