From owner-freebsd-hackers@FreeBSD.ORG Fri Nov 30 18:03:43 2007 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6233116A420; Fri, 30 Nov 2007 18:03:43 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from relay02.kiev.sovam.com (relay02.kiev.sovam.com [62.64.120.197]) by mx1.freebsd.org (Postfix) with ESMTP id 134F513C46E; Fri, 30 Nov 2007 18:03:43 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from [212.82.216.226] (helo=deviant.kiev.zoral.com.ua) by relay02.kiev.sovam.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.67) (envelope-from ) id 1Iy9Fa-000Kg1-SV; Fri, 30 Nov 2007 19:02:05 +0200 Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.1/8.14.1) with ESMTP id lAUH22Jc009304; Fri, 30 Nov 2007 19:02:02 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.2/8.14.2/Submit) id lAUH22YO009303; Fri, 30 Nov 2007 19:02:02 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 30 Nov 2007 19:02:01 +0200 From: Kostik Belousov To: Alejandro Pulver Message-ID: <20071130170201.GK83121@deviant.kiev.zoral.com.ua> References: <20071130132858.1e4290a0@deimos.mars.bsd> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="lRF4gxo9Z9M++D0O" Content-Disposition: inline In-Reply-To: <20071130132858.1e4290a0@deimos.mars.bsd> User-Agent: Mutt/1.4.2.3i X-Scanner-Signature: 3b10ce253585130f5293a5b36593fd37 X-DrWeb-checked: yes X-SpamTest-Envelope-From: kostikbel@gmail.com X-SpamTest-Group-ID: 00000000 X-SpamTest-Info: Profiles 1836 [Nov 30 2007] X-SpamTest-Info: helo_type=3 X-SpamTest-Info: {TO: local part of email appears in body} X-SpamTest-Info: {received from trusted relay: not dialup} X-SpamTest-Method: none X-SpamTest-Method: Local Lists X-SpamTest-Rate: 9 X-SpamTest-Status: Not detected X-SpamTest-Status-Extended: not_detected X-SpamTest-Version: SMTP-Filter Version 3.0.0 [0255], KAS30/Release Cc: freebsd-hackers@freebsd.org Subject: Re: dlopen: resolving external library symbols to calling program X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Nov 2007 18:03:43 -0000 --lRF4gxo9Z9M++D0O Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Nov 30, 2007 at 01:28:58PM -0300, Alejandro Pulver wrote: > Hello. >=20 > When I was updating the games/deng port, I found it failed at runtime > with the following error: >=20 > % doomsday > While opening dynamic library > /usr/local/lib/libdropengl.so: > /usr/local/lib/libdropengl.so: Undefined symbol "ArgExists" > DD_InitDGL: Loading of libdropengl.so failed. > (null). >=20 > The function is defined in m_args.c which is included in both > "doomsday" and "libdropengl.so". But nm(1) reports it as undefined for > "libdropengl.so". Also, it is loaded with RTLD_NOW. >=20 > % nm `which doomsday` | grep ArgExists > 080d9ef0 T ArgExists You are looking at the wrong symbol table. ELF objects have the dynamic symbol table that is used during run-time linking, and symbol table used by the static linker ld. The former table is shown by nm -D. I suspect that you need to link the doomsday binary with the --export-dynamic flag. See the info ld for details. >=20 > % nm /usr/local/lib/libdropengl.so | grep ArgExists > U ArgExists >=20 > The files are linked with the "-flat namespace" and "-undefined > suppress" flags in Mac OS X (don't know if it's relevant here). >=20 > I think the simplest solution (if possible, of course) would be to make > dlopen() resolve these symbols to the main executable. I tried to do > this with RTLD_GLOBAL without success. >=20 > The port is available here (note that the application uses cmake to > build): > ftp://ftp.alepulver.com.ar/deng.tar.bz2 >=20 > If you need any other information just ask me. I will appreciate any > help. >=20 > Thanks and Best Regards, > Ale --lRF4gxo9Z9M++D0O Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (FreeBSD) iD8DBQFHUEIJC3+MBN1Mb4gRAuj7AJ4wvGFK6cliYiVXlq6aeVyZ2Bbl6wCfTB4C 4wXfAwP6uTV3+CIL8DxxnUQ= =aXCW -----END PGP SIGNATURE----- --lRF4gxo9Z9M++D0O--