Hi Armin,
The test `rpython.rtyper.lltypesystem.test.TestPlatform.test_prefix` 
illustrates the problem quite well. Currently this test is skipped on non-linux 
platforms. When that is turned off, the test fails on macOS X.
With `Darwin_x86.so_prefix == (‘’, )`, line ll2ctypes:1218 will fail, because 
it’s trying to load `c_file.dylib` rather than `libc_file.dylib`.
Shared libraries on macOS X should also have ‘lib’ prefix just as on linux.
According to man page of `ld`:
-lx This option tells the linker to search for libx.dylib or libx.a in the 
library search path. If string x is of the form y.o, then that file is searched 
for in the same places, but without prepending `lib' or appending `.a' or 
`.dylib' to the filename.
And on Apple developer website 
(https://developer.apple.com/library/content/documentation/DeveloperTools/Conceptual/DynamicLibraries/100-Articles/DynamicLibraryDesignGuidelines.html):
The filename of a dynamic library normally contains the library’s name with the 
lib prefix and the .dylib extension. For example, a library called Dynamo would 
have the filename libDynamo.dylib.

So I think it’s right to make a simple fix as suggested in the patch to include 
‘lib’ in the so_prefix on Darwin platforms.

The attached is a suggested solution patch.

Regards,
John Zhang


------------------------------------------------------
John Zhang
Research Assistant
Programming Languages, Design & Implementation Division
Computer Systems Group
ANU College of Engineering & Computer Science
108 North Rd
The Australian National University
Acton ACT 2601
john.zh...@anu.edu.au<mailto:john.zh...@anu.edu.au>





On 1 Dec. 2016, at 04:56, Armin Rigo 
<armin.r...@gmail.com<mailto:armin.r...@gmail.com>> wrote:

Hi John,

On 30 November 2016 at 04:14, John Zhang 
<john.zh...@anu.edu.au<mailto:john.zh...@anu.edu.au>> wrote:
`so_prefixes`. This is causing me some problems with not being able to find
my shared libraries on macOS X.
I’m wondering if that’s intentional, or just a mistake? It should be a
simple fix if it’s a mistake.

I don't know, and that's a good question.  But the first question is:
how does it work for PyPy on OS/X?  All (or most) tests pass there.
Can you pinpoint the difference?  If not, can you point us to your
version of the code, so that we can have a guess at what the
difference might be?


A bientôt,

Armin.

Attachment: fix_darwin_so_prefix.patch
Description: fix_darwin_so_prefix.patch

_______________________________________________
pypy-dev mailing list
pypy-dev@python.org
https://mail.python.org/mailman/listinfo/pypy-dev

Reply via email to