You are not logged in.

#1 2010-10-26 18:32:12

LeafStorm
Member
From: North Carolina
Registered: 2009-05-20
Posts: 51
Website

Linking problems compiling Lua shared library (nixio)

I am trying to create a PKGBUILD for nixio (see http://dev.luci.freifunk-halle.net/nixio/doc/). I am using this PKGBUILD:

pkgname=nixio
pkgver=0.3
pkgrel=1
pkgdesc="System, networking and I/O library for Lua"
arch=('i686' 'x86_64')
url="http://luci.subsignal.org/"
license=('APACHE')
depends=('lua>=5.1' 'openssl')
makedepends=()
optdepends=()
provides=()
options=('docs')
source=(http://dev.luci.freifunk-halle.net/nixio/nixio-0.3.tar.bz2)
md5sums=('7fa6a989cd2644347d969cb6e3a5c186')

build() {
  cd "$srcdir/$pkgname-$pkgver"
  make LUA_MODULEDIR=/usr/share/lua/5.1 LUA_LIBRARYDIR=/usr/lib/lua/5.1
}

package() {
  cd "$srcdir/$pkgname-$pkgver"
  cp -R dist/* $pkgdir
}

(The package contents are rather irregular.) When building, it produces this output:

==> Starting build()...
mkdir -p dist/usr/share/lua/5.1
cp -pR lua/* dist/usr/share/lua/5.1 2>/dev/null || true
for i in $(find dist -name .svn); do rm -rf $i || true; done
gcc  -O2 --std=gnu99 -Wall -Werror -pedantic    -fPIC -c -o src/nixio.o src/nixio.c 
gcc  -O2 --std=gnu99 -Wall -Werror -pedantic    -fPIC -c -o src/socket.o src/socket.c 
gcc  -O2 --std=gnu99 -Wall -Werror -pedantic    -fPIC -c -o src/sockopt.o src/sockopt.c 
# 15 more pretty much identical object code files...
gcc -Wl,--hash-style=gnu -Wl,--as-needed -shared -lcrypt -lssl -o src/nixio.so src/nixio.o src/socket.o src/sockopt.o src/bind.o src/address.o src/poll.o src/io.o src/file.o src/splice.o src/process.o src/syslog.o src/bit.o src/binary.o src/fs.o src/user.o src/tls-crypto.o src/tls-context.o src/tls-socket.o 
mkdir -p dist/usr/lib/lua/5.1
cp src/nixio.so dist/usr/lib/lua/5.1/nixio.so

The package seems to build fine, although namcap produces these warnings:

nixio W: Dependency included and not needed ('lua')
nixio W: Dependency included and not needed ('openssl')

But when I install it and launch Lua:

Lua 5.1.4  Copyright (C) 1994-2008 Lua.org, PUC-Rio
> require 'nixio'
error loading module 'nixio' from file '/usr/lib/lua/5.1/nixio.so':
    /usr/lib/lua/5.1/nixio.so: undefined symbol: MD5_Init
stack traceback:
    [C]: ?
    [C]: in function 'require'
    stdin:1: in main chunk
    [C]: ?

Doing some research, I found that MD5_Init is part of the OpenSSL library (which nixio uses for its cryptographic functions), and that "undefined symbol" errors are indicative of a program compiling and linking properly, but not being able to load a shared library at runtime. However, OpenSSL is installed properly and libssl.so is in my /usr/lib.

What should I do to fix this error? It builds properly when installed using LuaRocks. I tried adding various flags from the rockspec (run "luarocks download nixio" and "luarocks unpack nixio-0.3-1.src.rock" to look at it) but still can't get it to work.


Thanks,
Matthew Frazier

Offline

Board footer

Powered by FluxBB