macs3-project / MACS

MACS -- Model-based Analysis of ChIP-Seq
https://macs3-project.github.io/MACS/
BSD 3-Clause "New" or "Revised" License
708 stars 268 forks source link

MACS2 Cython compilation fails #40

Closed JeanFred closed 10 years ago

JeanFred commented 10 years ago

When building from source, one has to regenerate the .c file, using the setup_w_cython.py.

This fails for me when compiling the MACS2/IO/cCallPeakUnit.pyx file.

I’m using Python 2.7.3 under Ubuntu 12.04, Cython 0.15.1

Steps to reproduce:

Stack trace:

MACS2/IO/cScoreTrack.c:14071:37: attention : ‘__pyx_v_cutoff’ may be used uninitialized in this function [-Wuninitialized]
gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro build/temp.linux-i686-2.7/MACS2/IO/cScoreTrack.o -o build/lib.linux-i686-2.7/MACS2/IO/cScoreTrack.so
cythoning MACS2/IO/cCallPeakUnit.pyx to MACS2/IO/cCallPeakUnit.c

Error compiling Cython file:
------------------------------------------------------------
...
                if call_summits:
                    #for x in peak_content:
                    #    if x[2] >= 10:
                    #        print peak_content
                    #        break
                    self.__close_peak_with_subpeaks (peak_content, peaks, min_length, chrom, smoothlen = min_length, score_cutoff_s = score_cutoff_s ) # smooth length is min_length, i.e. fragment size 'd'
                                                   ^
------------------------------------------------------------

MACS2/IO/cCallPeakUnit.pyx:689:52: Keyword and starred arguments not allowed in cdef functions.

Error compiling Cython file:
------------------------------------------------------------
...
                    #    if x[2] >= 10:
                    #        print peak_content
                    #        break
                    self.__close_peak_with_subpeaks (peak_content, peaks, min_length, chrom, smoothlen = min_length, score_cutoff_s = score_cutoff_s ) # smooth length is min_length, i.e. fragment size 'd'
                else:
                    self.__close_peak_wo_subpeaks   (peak_content, peaks, min_length, chrom, smoothlen = min_length, score_cutoff_s = score_cutoff_s ) # smooth length is min_length, i.e. fragment size 'd'
                                                   ^
------------------------------------------------------------

MACS2/IO/cCallPeakUnit.pyx:691:52: Keyword and starred arguments not allowed in cdef functions.

Error compiling Cython file:
------------------------------------------------------------
...
        # save the last peak
        if not peak_content:
            return peaks
        else:
            if call_summits:
                self.__close_peak_with_subpeaks (peak_content, peaks, min_length, chrom, smoothlen = min_length, score_cutoff_s = score_cutoff_s ) # smooth length is min_length, i.e. fragment size 'd'
                                               ^
------------------------------------------------------------

MACS2/IO/cCallPeakUnit.pyx:699:48: Keyword and starred arguments not allowed in cdef functions.

Error compiling Cython file:
------------------------------------------------------------
...
            return peaks
        else:
            if call_summits:
                self.__close_peak_with_subpeaks (peak_content, peaks, min_length, chrom, smoothlen = min_length, score_cutoff_s = score_cutoff_s ) # smooth length is min_length, i.e. fragment size 'd'
            else:
                self.__close_peak_wo_subpeaks   (peak_content, peaks, min_length, chrom, smoothlen = min_length, score_cutoff_s = score_cutoff_s ) # smooth length is min_length, i.e. fragment size 'd'
                                               ^
------------------------------------------------------------

MACS2/IO/cCallPeakUnit.pyx:701:48: Keyword and starred arguments not allowed in cdef functions.
building 'MACS2.IO.cCallPeakUnit' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/lib/python2.7/dist-packages/numpy/core/include -I/usr/include/python2.7 -c MACS2/IO/cCallPeakUnit.c -o build/temp.linux-i686-2.7/MACS2/IO/cCallPeakUnit.o
MACS2/IO/cCallPeakUnit.c:1:2: erreur: #error Do not use this file, it is the result of a failed Cython compilation.
error: command 'gcc' failed with exit status 1
taoliu commented 10 years ago

Hi Jean-Frédéric,

Please do not use git clone since git is for code development which means it’s unstable. Please use the package on PyPI site: https://pypi.python.org/pypi/MACS2

HTH, Tao

On Jun 10, 2014, at 2:00 PM, Jean-Frédéric notifications@github.com wrote:

When building from source, one has to regenerate the .c file, using the setup_w_cython.py.

This fails for me when compiling the MACS2/IO/cCallPeakUnit.pyx file.

I’m using Python 2.7.3 under Ubuntu 12.04, Cython 0.15.1

Steps to reproduce:

Straight out Git clone python setup_w_cython.py build Stack trace:

MACS2/IO/cScoreTrack.c:14071:37: attention : ‘__pyx_v_cutoff’ may be used uninitialized in this function [-Wuninitialized] gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro build/temp.linux-i686-2.7/MACS2/IO/cScoreTrack.o -o build/lib.linux-i686-2.7/MACS2/IO/cScoreTrack.so cythoning MACS2/IO/cCallPeakUnit.pyx to MACS2/IO/cCallPeakUnit.c

Error compiling Cython file:

... if call_summits:

for x in peak_content:

                #    if x[2] >= 10:
                #        print peak_content
                #        break
                self.__close_peak_with_subpeaks (peak_content, peaks, min_length, chrom, smoothlen = min_length, score_cutoff_s = score_cutoff_s ) # smooth length is min_length, i.e. fragment size 'd'

^

MACS2/IO/cCallPeakUnit.pyx:689:52: Keyword and starred arguments not allowed in cdef functions.

Error compiling Cython file:

...

if x[2] >= 10:

                #        print peak_content
                #        break
                self.__close_peak_with_subpeaks (peak_content, peaks, min_length, chrom, smoothlen = min_length, score_cutoff_s = score_cutoff_s ) # smooth length is min_length, i.e. fragment size 'd'
            else:
                self.__close_peak_wo_subpeaks   (peak_content, peaks, min_length, chrom, smoothlen = min_length, score_cutoff_s = score_cutoff_s ) # smooth length is min_length, i.e. fragment size 'd'

^

MACS2/IO/cCallPeakUnit.pyx:691:52: Keyword and starred arguments not allowed in cdef functions.

Error compiling Cython file:

...

save the last peak

    if not peak_content:
        return peaks
    else:
        if call_summits:
            self.__close_peak_with_subpeaks (peak_content, peaks, min_length, chrom, smoothlen = min_length, score_cutoff_s = score_cutoff_s ) # smooth length is min_length, i.e. fragment size 'd'

^

MACS2/IO/cCallPeakUnit.pyx:699:48: Keyword and starred arguments not allowed in cdef functions.

Error compiling Cython file:

... return peaks else: if call_summits: self.__close_peak_with_subpeaks (peak_content, peaks, min_length, chrom, smoothlen = min_length, score_cutoff_s = score_cutoff_s ) # smooth length is min_length, i.e. fragment size 'd' else: self.__close_peak_wo_subpeaks (peak_content, peaks, min_length, chrom, smoothlen = min_length, score_cutoff_s = score_cutoff_s ) # smooth length is min_length, i.e. fragment size 'd'

^

MACS2/IO/cCallPeakUnit.pyx:701:48: Keyword and starred arguments not allowed in cdef functions. building 'MACS2.IO.cCallPeakUnit' extension gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/lib/python2.7/dist-packages/numpy/core/include -I/usr/include/python2.7 -c MACS2/IO/cCallPeakUnit.c -o build/temp.linux-i686-2.7/MACS2/IO/cCallPeakUnit.o MACS2/IO/cCallPeakUnit.c:1:2: erreur: #error Do not use this file, it is the result of a failed Cython compilation. error: command 'gcc' failed with exit status 1 — Reply to this email directly or view it on GitHub.

taoliu commented 10 years ago

I believe the problem was due to the old Cython 0.15 with your Ubuntu. Try newer version such as cython>=0.18. I have added the requirement for newer cython in setup_w_cython.py code. Tests passed both on my Mac and Linux server. If you still have such problem, please re-open the thread.