From owner-freebsd-questions@FreeBSD.ORG Sat Jun 24 16:21:25 2006 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id CDBF816A49E for ; Sat, 24 Jun 2006 16:21:25 +0000 (UTC) (envelope-from dan@dan.emsphone.com) Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1888B43D49 for ; Sat, 24 Jun 2006 16:21:25 +0000 (GMT) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.13.1/8.13.4) id k5OGLOUg044692; Sat, 24 Jun 2006 11:21:24 -0500 (CDT) (envelope-from dan) Date: Sat, 24 Jun 2006 11:21:24 -0500 From: Dan Nelson To: Simeon Nifos Message-ID: <20060624162124.GB83209@dan.emsphone.com> References: <20060624151124.23405.qmail@web55210.mail.re4.yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20060624151124.23405.qmail@web55210.mail.re4.yahoo.com> X-OS: FreeBSD 5.5-PRERELEASE X-message-flag: Outlook Error User-Agent: Mutt/1.5.11 Cc: freebsd-questions@freebsd.org Subject: Re: howto convert Linux shared libraries foo.so to FreeBSD shared libraries X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Jun 2006 16:21:25 -0000 In the last episode (Jun 24), Simeon Nifos said: > Does anybody know how to convert a shared object compiled in Linux > foo-linux.so to a shared object compiled for FreeBSD freebsd-foo.so? > I mean a freebsd-foo.so to which I can link with objects compiled by > a native FreeBSD compiler. Or equivalently how to create a FreeBSD > foo.so from a linux foo.so which would be identical to that which > would be compiled from source in FreeBSD? I don't think either of these are possible because internal library structures (the size of off_t, or the field sizes and ordering of struct stat or FILE, for example) are different. Any converter would have to decompile the code into C (impossible in practice) and recompile it at a FreeBSD binary. > I do not need to run a Linux binary. What I need to do is to link my > object (.o) files compiled natively in FreeBSD with a foo.so which is > a linux library. Take a look at the www/linuxpluginwrapper port, which creates wrapper libraries that convert Linux function calls to FreeBSD ones. You then use libmap.conf to substitute these libraries for any ones called by the Linux shared library. Depending on what your library's API looks like, and what external functions it calls, you might be able to get it to work. The correct solution would be to ask your vendor for either a FreeBSD shared library, or the source :) -- Dan Nelson dnelson@allantgroup.com