Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[WIP] build pysam on Windows #964

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

fo40225
Copy link

@fo40225 fo40225 commented Nov 3, 2020

dirty fix, need improvement.

The attachment wheel can be installed to Anaconda3 2020.02 without other dependencies.

pysam-0.16.0.1-cp37-cp37m-win_amd64.whl.zip

How to build the wheel with this fix:

Windows 10 (assume that the username is User)
Visual Studio 2019 16.7 (with C++ development installed)
Anaconda3 2020.02 (assume that the install path is C:\Users\User\anaconda3)
MSYS2 x86_64 20200903 (assume that the install path is C:\msys64)

  • edit C:\Users\User\anaconda3\Lib\distutils\cygwinccompiler.py Line 87
        elif int(msc_ver) >= 1900:
            # VS2015 / MSVC 14.0
            return ['msvcr140']

to

        elif int(msc_ver) >= 1900:
            # VS2015 / MSVC 14.0
            return ['vcruntime140']
  • Open Start > MSYS2 64bit > MSYS2 MSYS
    execute pacman -S --needed --noconfirm libraries mingw-w64-x86_64-toolchain

  • copy C:\msys64\mingw64\bin\mingw32-make.exe to C:\msys64\mingw64\bin\make.exe

  • Open Start > MSYS2 64bit > MSYS2 MinGW 64-bit

export LIBRARY_PATH=/c/Users/User/anaconda3

export PATH=/c/Users/User/anaconda3:\
/c/Users/User/anaconda3/Library/mingw-w64/bin:\
/c/Users/User/anaconda3/Library/usr/bin:\
/c/Users/User/anaconda3/Library/bin:\
/c/Users/User/anaconda3/Scripts:$PATH

cd pysam
python setup.py bdist_wheel

@teepean
Copy link

teepean commented Nov 12, 2020

Couple of problems:

libvcruntime140.a is missing when following above instructions.

Fix:

gendef vcruntime140.dll dlltool -D vcruntime140.dll -d vcruntime140.def -l libvcruntime140.a

libws2_32.a cannot be found unless this line in setup.py:

internal_htslib_libraries.append("ws2_32")

is changed to this:

external_htslib_objects.append("C:/msys64/mingw64/x86_64-w64-mingw32/lib/libws2_32.a".format(lib))

@KhanhLPBao
Copy link

KhanhLPBao commented Apr 13, 2021

Hi, I just follow your instruction but the final step there is no pysam folder. Also my Anaconda3 folder does not have bin/usr folder too. What should I do?

@fo40225
Copy link
Author

fo40225 commented Apr 13, 2021

pysam folder is the source code folder.

@teepean
Copy link

teepean commented May 25, 2024

Here's a recent version compiled using Anaconda with the instructions from this PR + my MinGW patch.

pysam-0.22.0-cp311-cp311-win_amd64.zip

Support files that have to be extracted to Lib\site-packages\pysam

pysam-mingw-support_dlls.zip

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants