Posted by face on February 28, 2008
Update July 16th, 2008: Sphinx sphinx-0.9.8 has been released and this port has been updated.
Here is a OpenBSD port of Sphinx, Free open-source SQL full-text search engine. Sphinx is a wonderfully fast and memory efficient deep text search engine. I have found integrates nicely with Ruby and Ruby-On-Rails.
I hope at some point to get this port committed to the OpenBSD CVS repository. In the meantime this will be the ports home. Till it hits the OpenBSDs repository, it will live in my SVN repository here.
You can download a snapshot of the source code for the port here: sphinx.tgz. So far this port has been tested with MySQL and Postgresql on OpenBSD 4.2 and OpenBSD 4.3-betaOpenBSD-4.4-beta on the i386 platform with the Ultrasphinx Ruby-On-Rails plugin.
Instructions to build the port
If your ports tree is not already prepped, please begin by prepping your ports tree.
The port will build much faster if you install the prerequisites via binaries:
1
2
3
4
5
6
|
sudo su
export PKG_PATH="ftp://ftp2.usa.openbsd.org/pub/OpenBSD/4.3/packages/i386"
# or, setenv PKG_PATH "ftp://ftp2.usa.openbsd.org/pub/OpenBSD/4.3/packages/i386"
pkg_add libiconv mysql-server mysql-client
exit
|
Now we are ready to build the sphinx port:
1
2
3
4
5
6
|
cd /usr/ports/textproc
lynx --source "http://myutil.com/ports/4.4/sphinx.tgz" > sphinx.tgz
tar xvfz sphinx.tgz
cd sphinx
make install # or make package
|
There is also a Postgresql flavor. Follow the instructions above, installing Postgresql instead of MySQL and then instead of
make install
do:
1
2
|
env FLAVOR=pgsql make install
|
Thanks, and feedback is always welcome!
Posted by face on February 26, 2008
1
2
3
4
5
6
7
8
9
10
11
|
--- extconf.rb.orig Tue Feb 26 12:03:53 2008
+++ extconf.rb Tue Feb 26 11:52:16 2008
@@ -1,5 +1,7 @@
require "mkmf"
+$LIBS += " -lstdc++ -laspell"
+
have_header("ruby.h")
have_header("aspell.h")
have_library("aspell")
|
I recently installed the raspell gem on my development box as part of an evaluation of ultrasphinx.
Unfortunately, the native extension to raspell doesn’t link in the dynamic libraries it uses. A fix is provided below.
Note, using the raspell with ultrasphinx also caused a ruby core dump, this time in an assertion from the configuration for aspell. OpenBSD uses aspell-0.50.5 and after upgrading aspell to 0.60.5, raspell started working fine.
Here is the output from the dynamic library problem:
** Starting Rails with development environment...
ruby:/usr/local/lib/ruby/gems/1.8/gems/raspell-1.1/lib/raspell.so: undefined symbol 'new_aspell_config'
lazy binding failed!
/home/face/urevz/vendor/plugins/ultrasphinx/lib/ultrasphinx/spell.rb:33: [BUG] Segmentation fault
ruby 1.8.6 (2007-09-24) [i386-openbsd4.2]
A little poking around and I noticed the native library, raspell.so, doesn’t link in libaspell!
A quick fix is to add the libs to extconf.rb and rebuild the library:
- cd /usr/local/lib/ruby/gems/1.8/gems/raspell-1.1/ext
- edit extconf.rb and add the line $LIBS = ” -lstdc+ -laspell”
- sudo make clean
- sudo make
- sudo cp raspell.so ../lib/.
Posted by face on February 12, 2008
Here is how to install i386 binaries (please choose an OpenBSD mirror near you…and please buy a t-shirt):
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
sudo su
#for ksh/bash
export PKG_PATH="ftp://ftp3.usa.openbsd.org/pub/OpenBSD/4.2/packages/i386"
#or, for tcsh: setenv PKG_PATH=ftp://ftp3.usa.openbsd.org/pub/OpenBSD/4.2/packages/i386
# Now for Ruby
pkg_add "http://rubyforge.org/frs/download.php/32289/ruby-1.8.6.111.tgz"
# Optional, but Recommend for Rails
pkg_add "http://rubyforge.org/frs/download.php/32290/ruby-gems-1.0.1.tgz"
pkg_add "http://rubyforge.org/frs/download.php/32291/ruby-iconv-1.8.6.111.tgz"
# Now you could install rails if you wanted:
gem install rails
|
Rubyforge doesn’t allow you to have the same filename, even if it is in a different sub-package and release. Therefore, amd64 and sparc64 binaries are distributed directly from MyUtil.com.
For
AMD64 (which runs in
IA64 of course):
1
2
3
4
5
6
7
8
9
10
|
sudo su
export PKG_PATH="http://myutil.com/ports/4.2/amd64/:ftp://ftp3.usa.openbsd.org/pub/OpenBSD/4.2/packages/amd64/"
# or, setenv PKG_PATH "http://myutil.com/ports/4.2/amd64/:ftp://ftp3.usa.openbsd.org/pub/OpenBSD/4.2/packages/amd64/"
pkg_add ruby-1.8.6.111 ruby-iconv-1.8.6.111 ruby-gems-1.0.1
# Perhaps Ruby-On-Rails:
gem install rails
|
For sparc64:
1
2
3
4
5
6
7
8
9
10
|
sudo su
export PKG_PATH="http://myutil.com/ports/4.2/sparc64/:ftp://ftp3.usa.openbsd.org/pub/OpenBSD/4.2/packages/sparc64/"
# or, setenv PKG_PATH "http://myutil.com/ports/4.2/sparc64/:ftp://ftp3.usa.openbsd.org/pub/OpenBSD/4.2/packages/sparc64/"
pkg_add ruby-1.8.6.111 ruby-iconv-1.8.6.111 ruby-gems-1.0.1
# Maybe Rails?
gem install rails
|
Thanks, I find these useful and I hope you do too. I now do all my development from a OpenBSD (patched) Desktop and have made these binaries as secure as possible. All binaries are produced behind pf firewalls.
I have a old Mac Mini I can install macppc and produce binaries…if there is a demand.
Posted by face on February 03, 2008