Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Compile lanms on windows successfully! #120

Closed
ZhuMingmin9123 opened this issue Mar 20, 2018 · 45 comments
Closed

Compile lanms on windows successfully! #120

ZhuMingmin9123 opened this issue Mar 20, 2018 · 45 comments

Comments

@ZhuMingmin9123
Copy link

ZhuMingmin9123 commented Mar 20, 2018

my environment is:
windows10 ,
python3.6 (ps:I use Anaconda3),
vs2015 Update 3 (ps: Visual Studio version should be vs2015 Update 3 or newer)

Step 1:Open the console make sure you can use X64 compiler:cl.exe(note: not X86, not X86, not X86 )
2
default

Step 2:to compile adaptor.cpp to adaptor.pyd
execute:cd your_dir\lanms
execute:cl adaptor.cpp ./include/clipper/clipper.cpp /I ./include /I "C:\ProgramData\Anaconda3\include" /LD /Fe:adaptor.pyd /link/LIBPATH:"C:\ProgramData\Anaconda3\libs"
1
ok,adaptor.pyd appears!

Step 3:comment some code in __init__.py
comment line7 and line8
2

Step 4:Congratulations! You can import lanms.

@zxytim
Copy link
Collaborator

zxytim commented Mar 20, 2018

Thanks for sharing!
I've added a link to this issue at the bottom of README.

@zxytim zxytim closed this as completed Mar 20, 2018
@ghost
Copy link

ghost commented Apr 4, 2018

if you have space in your path, like "Program Files", then you should input the command like "Progra~1"

@aricelover
Copy link

I've finished these steps, so what should I do next?(a beginner)

@chclock
Copy link

chclock commented May 31, 2018

For VS2017, you can find X64 tool on path like "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Visual Studio 2017\Visual Studio Tools\VC"

@Vivianwxf
Copy link

@ZhuMingmin9123 Thanks for your sharing~! my environment is Win7 python3.5 vs2015, but after I finished testing few images, I find that the capacity of my disk C is decreasing obviously,there only 8.5Gleft, I have no idea about this, could you please tell me how can I operate to clean the space for disk C?

@mm1860
Copy link

mm1860 commented Jul 9, 2018

a touching post

@RameshOswal
Copy link

thanks alot. by the way how did you find this solution :P

@mm1860
Copy link

mm1860 commented Jul 19, 2018

find this solution from "https://github.com/mm1860/EAST_ICPR"

@jsxyhelu
Copy link

that's great,many thanks

@zqm840527
Copy link

zqm840527 commented Aug 31, 2018

Hi there, does anyone encountered the same problem?
#184
FileNotFoundError: [Errno 2] No such file or directory: '/proc/cpuinfo'


problem solved, thanks for @harshthaker's help, solution as below:
#184 (comment)
I am not sure if it is because of it being a linux call. I am using Mac and I received the same error. But to make it work, I just commented out the following line which is get_host_info() function call in run_demo_server.py file. It works for me.
line 136
#ret.update(get_host_info())

@EDGSCOUT
Copy link

EDGSCOUT commented Sep 7, 2018

F:\CaiCheng\EAST-master\lanms>cl adaptor.cpp ./include/clipper/clipper.cpp / I ./include / I"E:\Anaconda\include
用于 x64 的 Microsoft (R) C/C++ 优化编译器 19.00.24215.1 版
版权所有(C) Microsoft Corporation。保留所有权利。

cl: 命令行 warning D9002 :忽略未知选项“/”
cl: 命令行 warning D9002 :忽略未知选项“/”
cl: 命令行 warning D9024 :无法识别的源文件类型“I”,假定为对象文件
cl: 命令行 warning D9024 :无法识别的源文件类型“./include”,假定为对象文件
cl: 命令行 warning D9024 :无法识别的源文件类型“IE:\Anaconda\include”,假定为对象文件
adaptor.cpp
adaptor.cpp(1): fatal error C1083: 无法打开包括文件: “pybind11/pybind11.h”: No such file or directory
clipper.cpp
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE\xlocale(341): warning C4530: 使用了 C++ 异常处理程序,但 未启用展开语义。请指定 /EHsc
./include/clipper/clipper.cpp(3795): warning C4819: 该文件包含不能在当前代码页(936)中表示的字符。请将该文件保存为 Unicode 格式以防止数据丢失
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE\limits(210): warning C4577: 在未指定异常处理模式的情况下 使用了 "noexcept";不一定会在异常时终止。指定 /EHsc
正在生成代码...

F:\CaiCheng\EAST-master\lanms>" / LD /Fe:adaptor.pyd / link / LIBPATH:"E:\Anaconda\libs"
文件名、目录名或卷标语法不正确。

@DaisyLoveU
Copy link

F:\CaiCheng\EAST-master\lanms>cl adaptor.cpp ./include/clipper/clipper.cpp / I ./include / I"E:\Anaconda\include
用于 x64 的 Microsoft (R) C/C++ 优化编译器 19.00.24215.1 版
版权所有(C) Microsoft Corporation。保留所有权利。

cl: 命令行 warning D9002 :忽略未知选项“/”
cl: 命令行 warning D9002 :忽略未知选项“/”
cl: 命令行 warning D9024 :无法识别的源文件类型“I”,假定为对象文件
cl: 命令行 warning D9024 :无法识别的源文件类型“./include”,假定为对象文件
cl: 命令行 warning D9024 :无法识别的源文件类型“IE:\Anaconda\include”,假定为对象文件
adaptor.cpp
adaptor.cpp(1): fatal error C1083: 无法打开包括文件: “pybind11/pybind11.h”: No such file or directory
clipper.cpp
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE\xlocale(341): warning C4530: 使用了 C++ 异常处理程序,但 未启用展开语义。请指定 /EHsc
./include/clipper/clipper.cpp(3795): warning C4819: 该文件包含不能在当前代码页(936)中表示的字符。请将该文件保存为 Unicode 格式以防止数据丢失
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE\limits(210): warning C4577: 在未指定异常处理模式的情况下 使用了 "noexcept";不一定会在异常时终止。指定 /EHsc
正在生成代码...

F:\CaiCheng\EAST-master\lanms>" / LD /Fe:adaptor.pyd / link / LIBPATH:"E:\Anaconda\libs"
文件名、目录名或卷标语法不正确。

cl adaptor.cpp ./include/clipper/clipper.cpp /I ./include /I "D:\Anaconda3\include(你的anaconda3的的文件路径,下面的也是)" /LD /Fe:adaptor.pyd /link/LIBPATH:"D:\Anaconda3\libs"

@Phantom1003
Copy link

C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.12.25827\include\xlocale(313): warning C4530: 使用了 C++ 异常处理程序,但未启用展开语义。请指定 /EHsc
clipper.cpp
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.12.25827\include\xlocale(313): warning C4530: 使用了 C++ 异常处理程序,但未启用展开语义。请指定 /EHsc
./include/clipper/clipper.cpp(3794): warning C4819: 该文件包含不能在当前代码页(936)中表示的字符。请将该文件保存为 Unicode 格式以防止数据丢失
正在生成代码...
Microsoft (R) Incremental Linker Version 14.12.25835.0
Copyright (C) Microsoft Corporation. All rights reserved.

/dll
/implib:adaptor.lib
/out:adaptor.pyd
/LIBPATH:E:\Anaconda\libs
adaptor.obj
clipper.obj
python37.lib(python37.dll) : fatal error LNK1112: 模块计算机类型“x64”与目标计算机类型“x86”冲突

我使用VS2017,最后报错这个该怎么解决,谢谢!

@LyanJin
Copy link

LyanJin commented Jan 7, 2019

我按照你所说的成功的生成pyd文件,setup之后 在import时报错 No model named 'lanms.adaptor' 请问你遇到这个问题了么? 或者有什么解决方案?

@LyanJin
Copy link

LyanJin commented Jan 8, 2019

@aricelover have you solved it?

@Sukanya-Kudi
Copy link

I am able to generate the .pyd , .obj files but unable to import lanms. Do we need to add these file in some path ? I am using anaconda.

@245123030
Copy link

VS2017成功编译,复制上面路径时注意删除很多不必要的空格

@aligoglos
Copy link

I've tried to compile with python with this command but this error occurred :

D:\Artificial Intelligence\_TextDetection\RFB-Text-Detection-master\lanms>cl adaptor.cpp ./include/clipper/clipper.cpp /I ./include /I "C:\Users\127051\AppData\Local\Programs\Python\Python35\include" /LD /Fe:adaptor.pyd /link/LIBPATH: "C:\Users\127051\AppData\Local\Programs\Python\Python35\libs"
Microsoft (R) C/C++ Optimizing Compiler Version 19.00.24215.1 for x86
Copyright (C) Microsoft Corporation.  All rights reserved.

adaptor.cpp
c:\users\127051\appdata\local\programs\python\python35\include\pyconfig.h(68): fatal error C1083: Cannot open include file: 'io.h': No such file or directory
clipper.cpp
d:\artificial intelligence\ocr\source\_textdetection\rfb-text-detection-master\lanms\include\clipper\clipper.hpp(52): fatal error C1083: Cannot open include file: 'vector': No such file or directory
Generating Code...

@aligoglos
Copy link

I solved issue by create this build script :

# --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------

import os
from os.path import join as pjoin
import numpy as np
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext


def find_in_path(name, path):
    "Find a file in a search path"
    # adapted fom http://code.activestate.com/recipes/52224-find-a-file-given-a-search-path/
    for dir in path.split(os.pathsep):
        binpath = pjoin(dir, name)
        if os.path.exists(binpath):
            return os.path.abspath(binpath)
    return None


def locate_cuda():
    """Locate the CUDA environment on the system

    Returns a dict with keys 'home', 'nvcc', 'include', and 'lib64'
    and values giving the absolute path to each directory.

    Starts by looking for the CUDAHOME env variable. If not found, everything
    is based on finding 'nvcc' in the PATH.
    """

    # first check if the CUDAHOME env variable is in use
    if 'CUDAHOME' in os.environ:
        home = os.environ['CUDAHOME']
        nvcc = pjoin(home, 'bin')
    else:
        # otherwise, search the PATH for NVCC
        default_path = pjoin(os.sep, 'usr', 'local', 'cuda', 'bin')
        nvcc = find_in_path('nvcc', os.environ['PATH'] + os.pathsep + default_path)
        if nvcc is None:
            raise EnvironmentError('The nvcc binary could not be '
                                   'located in your $PATH. Either add it to your path, or set $CUDAHOME')
        home = os.path.dirname(os.path.dirname(nvcc))

    cudaconfig = {'home': home, 'nvcc': nvcc,
                  'include': pjoin(home, 'include'),
                  'lib64': pjoin(home, 'lib/x64')}
    for k, v in cudaconfig.items():
        if not os.path.exists(v):
            raise EnvironmentError('The CUDA %s path could not be located in %s' % (k, v))

    return cudaconfig


CUDA = locate_cuda()

# Obtain the numpy include directory.  This logic works across numpy versions.
try:
    numpy_include = np.get_include()
except AttributeError:
    numpy_include = np.get_numpy_include()


def customize_compiler_for_nvcc(self):
    """inject deep into distutils to customize how the dispatch
    to gcc/nvcc works.

    If you subclass UnixCCompiler, it's not trivial to get your subclass
    injected in, and still have the right customizations (i.e.
    distutils.sysconfig.customize_compiler) run on it. So instead of going
    the OO route, I have this. Note, it's kindof like a wierd functional
    subclassing going on."""

    # tell the compiler it can processes .cu
    self.src_extensions.append('.cu')

    # save references to the default compiler_so and _comple methods
    #default_compiler_so = self.compiler_so
    super = self._compile

    # now redefine the _compile method. This gets executed for each
    # object but distutils doesn't have the ability to change compilers
    # based on source extension: we add it.
    def _compile(obj, src, ext, cc_args, extra_postargs, pp_opts):
        print(extra_postargs)
        if os.path.splitext(src)[1] == '.cu':
            # use the cuda for .cu files
            self.set_executable('compiler_so', CUDA['nvcc'])
            # use only a subset of the extra_postargs, which are 1-1 translated
            # from the extra_compile_args in the Extension class
            postargs = extra_postargs['nvcc']
        else:
            postargs = extra_postargs['gcc']

        super(obj, src, ext, cc_args, postargs, pp_opts)
        # reset the default compiler_so, which we might have changed for cuda
        self.compiler_so = default_compiler_so

    # inject our redefined _compile method into the class
    self._compile = _compile


# run the customize_compiler
class custom_build_ext(build_ext):
    def build_extensions(self):
        customize_compiler_for_nvcc(self.compiler)
        build_ext.build_extensions(self)


ext_modules = [
    Extension(
        'lanms.adaptor',
        sources=[ 'adaptor.cpp', 'include/clipper/clipper.cpp'],
        include_dirs=[numpy_include, './' , 'include/clipper', 'include/'],
        extra_compile_args={
            'gcc': ['-Wno-cpp', '-Wno-unused-function', '-std=c99']},
    ),
]

setup(
    name='lanms',
    ext_modules=ext_modules,
    # inject our custom trigger
    cmdclass={'build_ext': custom_build_ext},
)

@sudo-thamaraikannan
Copy link

sudo-thamaraikannan commented Oct 22, 2019

Anyone can help regarding ,LANMS Compile cmds for Ubuntu 16.04 LTS with G++ Compiler 5.4.0. When try compile, got this below error.

g++ -o adaptor adaptor.cpp
adaptor.cpp:1:31: fatal error: pybind11/pybind11.h: No such file or directory

@YCTLYSLX
Copy link

您好,我也遇到同样的问题。
Z:\wangGraduate\EAST_ICPR\lanms>cl adaptor.cpp ./include/clipper/clipper.cpp /I ./include /I "C:\ProgramData\Anaconda3\include" /LD /Fe:adaptor.pyd /link/LIBPATH:"C:\ProgramData\Anaconda3\libs"
用于 x64 的 Microsoft (R) C/C++ 优化编译器 19.23.28106.4 版
版权所有(C) Microsoft Corporation。保留所有权利。

adaptor.cpp
C:\ProgramData\Anaconda3\include\pyconfig.h(59): fatal error C1083: 无法打开包括文件: “io.h”: No such file or directory
clipper.cpp
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.23.28105\include\crtdefs.h(10): fatal error C1083: 无法打开包括文件: “corecrt.h”: No such file or directory
正在生成代码...

请问这个问题如何解决

@YCTLYSLX
Copy link

您好,我也遇到同样的问题。
Z:\wangGraduate\EAST_ICPR\lanms>cl adaptor.cpp ./include/clipper/clipper.cpp /I ./include /I "C:\ProgramData\Anaconda3\include" /LD /Fe:adaptor.pyd /link/LIBPATH:"C:\ProgramData\Anaconda3\libs"
用于 x64 的 Microsoft (R) C/C++ 优化编译器 19.23.28106.4 版
版权所有(C) Microsoft Corporation。保留所有权利。

adaptor.cpp
C:\ProgramData\Anaconda3\include\pyconfig.h(59): fatal error C1083: 无法打开包括文件: “io.h”: No such file or directory
clipper.cpp
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.23.28105\include\crtdefs.h(10): fatal error C1083: 无法打开包括文件: “corecrt.h”: No such file or directory
正在生成代码...

请问这个问题如何解决

本人已解决,安装完win10 SDK之后,在运行就好了

@marisaedwina
Copy link

I've tried to compile with python with this command but this error occurred :

D:\Artificial Intelligence\_TextDetection\RFB-Text-Detection-master\lanms>cl adaptor.cpp ./include/clipper/clipper.cpp /I ./include /I "C:\Users\127051\AppData\Local\Programs\Python\Python35\include" /LD /Fe:adaptor.pyd /link/LIBPATH: "C:\Users\127051\AppData\Local\Programs\Python\Python35\libs"
Microsoft (R) C/C++ Optimizing Compiler Version 19.00.24215.1 for x86
Copyright (C) Microsoft Corporation.  All rights reserved.

adaptor.cpp
c:\users\127051\appdata\local\programs\python\python35\include\pyconfig.h(68): fatal error C1083: Cannot open include file: 'io.h': No such file or directory
clipper.cpp
d:\artificial intelligence\ocr\source\_textdetection\rfb-text-detection-master\lanms\include\clipper\clipper.hpp(52): fatal error C1083: Cannot open include file: 'vector': No such file or directory
Generating Code...

I solved issue by create this build script :

# --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------

import os
from os.path import join as pjoin
import numpy as np
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext


def find_in_path(name, path):
    "Find a file in a search path"
    # adapted fom http://code.activestate.com/recipes/52224-find-a-file-given-a-search-path/
    for dir in path.split(os.pathsep):
        binpath = pjoin(dir, name)
        if os.path.exists(binpath):
            return os.path.abspath(binpath)
    return None


def locate_cuda():
    """Locate the CUDA environment on the system

    Returns a dict with keys 'home', 'nvcc', 'include', and 'lib64'
    and values giving the absolute path to each directory.

    Starts by looking for the CUDAHOME env variable. If not found, everything
    is based on finding 'nvcc' in the PATH.
    """

    # first check if the CUDAHOME env variable is in use
    if 'CUDAHOME' in os.environ:
        home = os.environ['CUDAHOME']
        nvcc = pjoin(home, 'bin')
    else:
        # otherwise, search the PATH for NVCC
        default_path = pjoin(os.sep, 'usr', 'local', 'cuda', 'bin')
        nvcc = find_in_path('nvcc', os.environ['PATH'] + os.pathsep + default_path)
        if nvcc is None:
            raise EnvironmentError('The nvcc binary could not be '
                                   'located in your $PATH. Either add it to your path, or set $CUDAHOME')
        home = os.path.dirname(os.path.dirname(nvcc))

    cudaconfig = {'home': home, 'nvcc': nvcc,
                  'include': pjoin(home, 'include'),
                  'lib64': pjoin(home, 'lib/x64')}
    for k, v in cudaconfig.items():
        if not os.path.exists(v):
            raise EnvironmentError('The CUDA %s path could not be located in %s' % (k, v))

    return cudaconfig


CUDA = locate_cuda()

# Obtain the numpy include directory.  This logic works across numpy versions.
try:
    numpy_include = np.get_include()
except AttributeError:
    numpy_include = np.get_numpy_include()


def customize_compiler_for_nvcc(self):
    """inject deep into distutils to customize how the dispatch
    to gcc/nvcc works.

    If you subclass UnixCCompiler, it's not trivial to get your subclass
    injected in, and still have the right customizations (i.e.
    distutils.sysconfig.customize_compiler) run on it. So instead of going
    the OO route, I have this. Note, it's kindof like a wierd functional
    subclassing going on."""

    # tell the compiler it can processes .cu
    self.src_extensions.append('.cu')

    # save references to the default compiler_so and _comple methods
    #default_compiler_so = self.compiler_so
    super = self._compile

    # now redefine the _compile method. This gets executed for each
    # object but distutils doesn't have the ability to change compilers
    # based on source extension: we add it.
    def _compile(obj, src, ext, cc_args, extra_postargs, pp_opts):
        print(extra_postargs)
        if os.path.splitext(src)[1] == '.cu':
            # use the cuda for .cu files
            self.set_executable('compiler_so', CUDA['nvcc'])
            # use only a subset of the extra_postargs, which are 1-1 translated
            # from the extra_compile_args in the Extension class
            postargs = extra_postargs['nvcc']
        else:
            postargs = extra_postargs['gcc']

        super(obj, src, ext, cc_args, postargs, pp_opts)
        # reset the default compiler_so, which we might have changed for cuda
        self.compiler_so = default_compiler_so

    # inject our redefined _compile method into the class
    self._compile = _compile


# run the customize_compiler
class custom_build_ext(build_ext):
    def build_extensions(self):
        customize_compiler_for_nvcc(self.compiler)
        build_ext.build_extensions(self)


ext_modules = [
    Extension(
        'lanms.adaptor',
        sources=[ 'adaptor.cpp', 'include/clipper/clipper.cpp'],
        include_dirs=[numpy_include, './' , 'include/clipper', 'include/'],
        extra_compile_args={
            'gcc': ['-Wno-cpp', '-Wno-unused-function', '-std=c99']},
    ),
]

setup(
    name='lanms',
    ext_modules=ext_modules,
    # inject our custom trigger
    cmdclass={'build_ext': custom_build_ext},
)

Hi,
I also encounter the same issue like this.
Can you specify the file name and where do I need to put the script?

Thank you!

@aligoglos
Copy link

Hi @marisaedwina,
You can save script as build.py in lanms folder and run below command in cmd:
python build.py install

@marisaedwina
Copy link

Thank you for the feedback @aligoglos
I tried to run the script but it gives me an error

error

@aligoglos
Copy link

I think you can remove or comment CUDA = locate_cuda() line.

@marisaedwina
Copy link

marisaedwina commented Oct 25, 2019

I think you can remove or comment CUDA = locate_cuda() line.

Thanks for your correction,
I could run the script but still give me an error

error2

@William1Wu
Copy link

William1Wu commented Nov 21, 2019

Does anyone can help me?
I reference @ZhuMingmin9123 suggestion and using VS2015 x64 compiler to build code and get adaptor.pyd.

  • Win10 x64
  • Anaconda
  • Python3.5
  • Tensorflow-gpu 1.5.0

Traceback (most recent call last):
File "eval.py", line 196, in
tf.app.run()
File "D:\Software\Anaconda3\envs\east\lib\site-packages\tensorflow\python\platform\app.py", line 125, in run
sys.exit(main(argv))
File "eval.py", line 162, in main
boxes, timer = detect(score_map=score, geo_map=geometry, timer=timer)
File "eval.py", line 100, in detect
boxes = lanms.merge_quadrangle_n9(boxes.astype('float32'), nms_thres)
File "C:\Users\703\Desktop\EAST-master\lanms_init
.py", line 14, in merge_quadrangle_n9
from .adaptor import merge_quadrangle_n9 as nms_impl
ImportError: DLL load failed: \u627e\u4e0d\u5230\u6307\u5b9a\u7684\u6a21\u7d44\u3002

@Abbasi92
Copy link

Abbasi92 commented Mar 4, 2020

C:\Users\admin\Desktop\EAST-master\lanms>cl adaptor.cpp ./include/clipper/clippe
r.cpp /I ./include /I "C:\ProgramData\Anaconda3\include" /LD /Fe:adaptor.pyd /li
nk/LIBPATH:"C:\ProgramData\Anaconda3\libs"
'cl' is not recognized as an internal or external command,
operable program or batch file.

@Abbasi92
Copy link

Abbasi92 commented Mar 4, 2020

Please help

@FortuneStar
Copy link

if you have space in your path, like "Program Files", then you should input the command like "Progra~1"

Your answer is right.

@RamjiB
Copy link

RamjiB commented Mar 19, 2020

I think you can remove or comment CUDA = locate_cuda() line.

Thanks for your correction,
I could run the script but still give me an error

error2

I am facing the same issue. Do you have a solution for this?

@Memhueet
Copy link

/dll
/implib:adaptor.lib
/out:adaptor.pyd
/LIBPATH:D:Tools\Miniconda\envs\ov\libs
adaptor.obj
clipper.obj

LINK : fatal error LNK1104: can't open file“python37.lib”

how to solve this problem,please?

@samtlink
Copy link

/dll
/implib:adaptor.lib
/out:adaptor.pyd
/LIBPATH:C:\ProgramData\Anaconda3\libs
adaptor.obj
clipper.obj
python37.lib(python37.dll) : fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'x86'

Can anybody help with this error? I don't know what more information to post so kindly ask if it is needed.
Thanks a lot.

@samtlink
Copy link

C:\Users\admin\Desktop\EAST-master\lanms>cl adaptor.cpp ./include/clipper/clippe
r.cpp /I ./include /I "C:\ProgramData\Anaconda3\include" /LD /Fe:adaptor.pyd /li
nk/LIBPATH:"C:\ProgramData\Anaconda3\libs"
'cl' is not recognized as an internal or external command,
operable program or batch file.

@Abbasi92 I know I am late but you have to type that comment in the visual studio's developer console.
Hope this helps. Stay safe.

@KKDDD
Copy link

KKDDD commented Apr 21, 2020

/ dll
/implib:adaptor.lib
/out:adaptor.pyd
/ LIBPATH:D:Tools \ Miniconda \ envs \ ov \ libs
Adaptor.obj
clipper.obj

链接:致命错误LNK1104:无法打开文件“ python37.lib”

请问如何解决这个问题?

Hi,i have same problem,do you solve it?

@KKDDD
Copy link

KKDDD commented Apr 22, 2020

/ dll
/implib:adaptor.lib
/out:adaptor.pyd
/ LIBPATH:D:Tools \ Miniconda \ envs \ ov \ libs
Adaptor.obj
clipper.obj
链接:致命错误LNK1104:无法打开文件“ python37.lib”
请问如何解决这个问题?

嗨,我有同样的问题,你解决了吗?

well,i solve this problem, copy python37.lib to MSVC lib

@ghost
Copy link

ghost commented Jun 12, 2020

adaptor.lib - adaptor.zip

@GanWang
Copy link

GanWang commented Oct 16, 2020

my environment is:
windows10 ,
python3.6 (ps:I use Anaconda3),
vs2015 Update 3 (ps: Visual Studio version should be vs2015 Update 3 or newer)

Step 1:Open the console make sure you can use X64 compiler:cl.exe(note: not X86, not X86, not X86 )
2
default

Step 2:to compile adaptor.cpp to adaptor.pyd
execute:cd your_dir\lanms
execute:cl adaptor.cpp ./include/clipper/clipper.cpp /I ./include /I "C:\ProgramData\Anaconda3\include" /LD /Fe:adaptor.pyd /link/LIBPATH:"C:\ProgramData\Anaconda3\libs"
1
ok,adaptor.pyd appears!

Step 3:comment some code in init.py
comment line7 and line8
2

Step 4:Congratulations! You can import lanms.

Thank you for your replay!It really works!But i dont know why it works,if possible,please teach me! let me know the meanings of your actions.

@hung-doan
Copy link

Does anyone can help me?
I reference @ZhuMingmin9123 suggestion and using VS2015 x64 compiler to build code and get adaptor.pyd.

  • Win10 x64
  • Anaconda
  • Python3.5
  • Tensorflow-gpu 1.5.0

Traceback (most recent call last):
File "eval.py", line 196, in
tf.app.run()
File "D:\Software\Anaconda3\envs\east\lib\site-packages\tensorflow\python\platform\app.py", line 125, in run
sys.exit(main(argv)) File "eval.py", line 162, in main boxes, timer = detect(score_map=score, geo_map=geometry, timer=timer) File "eval.py", line 100, in detect boxes = lanms.merge_quadrangle_n9(boxes.astype('float32'), nms_thres) File "C:\Users\703\Desktop\EAST-master\lanms__init_.py", line 14, in merge_quadrangle_n9
from .adaptor import merge_quadrangle_n9 as nms_impl
ImportError: DLL load failed: \u627e\u4e0d\u5230\u6307\u5b9a\u7684\u6a21\u7d44\u3002

I fixed this issue by using the the includes & libs folder of the python
For example my python is installed at C:\Users\hungdoan\AppData\Local\Programs\Python\Python38
Then I will use the includes and libs from this folder rather than from the Anaconda.

e.g (NOTE: the python location will be changed base on your installation)

cl adaptor.cpp ./include/clipper/clipper.cpp /I ./include /I "C:\Users\hungdoan\AppData\Local\Programs\Python\Python38\include" /LD /Fe:adaptor.pyd /link/LIBPATH:"C:\Users\hungdoan\AppData\Local\Programs\Python\Python38\libs"

@burak-yildizoz
Copy link

Solution for Windows with CMake: #370

@VIJAY-KUMAR-TG
Copy link

can u please give step by step procedure to run this project plz...

@burak-yildizoz
Copy link

@kevinunger
Copy link

Just fixed it by just installing this:
pip install lanms-neo

https://github.com/gen-ko/lanms-neo

@papayalove
Copy link

D:\projects\EAST\lanms>cl adaptor.cpp ./include/clipper/clipper.cpp /I ./include /I "D:\softwares\anaconda3\include" /LD /Fe:adaptor.pyd /link/LIBPATH:"D:\softwares\anaconda3\libs"
用于 x64 的 Microsoft (R) C/C++ 优化编译器 19.36.32537 版
版权所有(C) Microsoft Corporation。保留所有权利。

adaptor.cpp
D:\projects\EAST\lanms\include\pybind11\cast.h(90): warning C4530: 使用了 C++ 异常处理程序,但未启用展开语义。请指定 /EHsc
D:\projects\EAST\lanms\include\pybind11\cast.h(490): error C2027: 使用了未定义类型“_frame”
D:\softwares\anaconda3\include\pytypedefs.h(22): note: 参见“_frame”的声明
D:\projects\EAST\lanms\include\pybind11\cast.h(492): error C2027: 使用了未定义类型“_frame”
D:\softwares\anaconda3\include\pytypedefs.h(22): note: 参见“_frame”的声明
D:\projects\EAST\lanms\include\pybind11\cast.h(493): error C2027: 使用了未定义类型“_frame”
D:\softwares\anaconda3\include\pytypedefs.h(22): note: 参见“_frame”的声明
./include\pybind11/pybind11.h(1794): error C2039: "frame": 不是 "_ts" 的成员
D:\softwares\anaconda3\include\cpython/pystate.h(82): note: 参见“_ts”的声明
./include\pybind11/pybind11.h(1795): error C2027: 使用了未定义类型“_frame”
D:\softwares\anaconda3\include\pytypedefs.h(22): note: 参见“_frame”的声明
./include\pybind11/pybind11.h(1796): error C2027: 使用了未定义类型“_frame”
D:\softwares\anaconda3\include\pytypedefs.h(22): note: 参见“_frame”的声明
./include\pybind11/pybind11.h(1799): error C2027: 使用了未定义类型“_frame”
D:\softwares\anaconda3\include\pytypedefs.h(22): note: 参见“_frame”的声明
./include\pybind11/pybind11.h(1798): error C2660: “PyDict_GetItem”: 函数不接受 1 个参数
D:\softwares\anaconda3\include\dictobject.h(22): note: 参见“PyDict_GetItem”的声明
./include\pybind11/pybind11.h(1798): note: 尝试匹配参数列表“()”时
./include\pybind11/numpy.h(35): error C2065: “ssize_t”: 未声明的标识符
./include\pybind11/numpy.h(35): error C2338: static_assert failed: 'ssize_t != Py_intptr_t'
clipper.cpp
./include/clipper/clipper.cpp(1066): warning C4530: 使用了 C++ 异常处理程序,但未启用展开语义。请指定 /EHsc
./include/clipper/clipper.cpp(3795): warning C4819: 该文件包含不能在当前代码页(936)中表示的字符。请将该文件保存为 Unicode 格式以防止数据丢失
正在生成代码...

什么问题呢

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

No branches or pull requests