brittneybrinsfield / pysam

Automatically exported from code.google.com/p/pysam
0 stars 0 forks source link

Doesn't compile on OS X 10.8 (or clang) #103

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Due to inlining grammar in C99, clang cannot export some symbols defined inline 
in samtools' ksort.h header.

What steps will reproduce the problem?
1. build pysam with clang (os x 10.8)
2. install 
3. run

What is the expected output? What do you see instead?
>>> import pysam
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "pysam/__init__.py", line 1, in <module>
    from csamtools import *
ImportError: 
dlopen(/Library/Python/2.7/site-packages/pysam-0.6-py2.7-macosx-10.8-intel.egg/c
samtools.so, 2): Symbol not found: ___ks_insertsort_heap
  Referenced from: /Library/Python/2.7/site-packages/pysam-0.6-py2.7-macosx-10.8-intel.egg/csamtools.so
  Expected in: flat namespace
 in /Library/Python/2.7/site-packages/pysam-0.6-py2.7-macosx-10.8-intel.egg/csamtools.so

What version of the product are you using? On what operating system?
I'm using latest pysam code (change set add4ce397e78), python2.7 

Please provide any additional information below.
A correct patch (also submitted to samtools project) is to make the inlined 
static:

diff -r add4ce397e78 samtools/ksort.h
--- a/samtools/ksort.h  Mon Oct 08 16:09:33 2012 +0100
+++ b/samtools/ksort.h  Wed Oct 17 11:16:01 2012 +0200
@@ -141,7 +141,7 @@
            tmp = *l; *l = l[i]; l[i] = tmp; ks_heapadjust_##name(0, i, l); \
        }                                                               \
    }                                                                   \
-   inline void __ks_insertsort_##name(type_t *s, type_t *t)            \
+   static inline void __ks_insertsort_##name(type_t *s, type_t *t)         \
    {                                                                   \
        type_t *i, *j, swap_tmp;                                        \
        for (i = s + 1; i < t; ++i)                                     \

see here http://clang.llvm.org/compatibility.html#inline

Original issue reported on code.google.com by daweonline on 17 Oct 2012 at 9:19

GoogleCodeExporter commented 9 years ago
Thanks, i have applied this patch manually.

Note that unless it is fixed in samtools, it will re-appear.

Best wishes,
Andreas

Original comment by andreas....@gmail.com on 21 Nov 2012 at 3:23

GoogleCodeExporter commented 9 years ago

Original comment by andreas....@gmail.com on 21 Nov 2012 at 3:24