LNK1181: cannot open input file 'm.lib'
Asked Answered
C

2

14

When trying to install a certain Python geophysical toolkit, I get this error:

LINK : fatal error LNK1181: cannot open input file 'm.lib'

I believe it is due to my use of the MSVC's buildtools. In their setup.py I found:

setup(…, ext_modules=[ Extension(…, […], libraries=['m'], … ])

What do I need to change in this setup.py—and related files?—to make this work. IIRC there is a library other than m which I am to use.

Clotilda answered 12/10, 2013 at 11:54 Comment(2)
I had a similar problem. Although I can't tell with certainty the linker of gcc is looking for file libm.a if option -lm is given, while MSVC's tools are looking for m.lib which does not exist. If I find a solution I will post it.Recall
I had same problem when I compile ffmpeg with libopus. I took libm.a file from MinGW and it helped, but technically this file from MinGW is dummy.Spinifex
L
9

On Windows, the standard math functions are handled by MSVCR:

>>> from ctypes.util import find_library
>>> find_library('m')
'msvcr90.dll'

I don't have MSVC installed to test, but you just need to link against the runtime. Try removing 'm'.

Larhondalari answered 18/5, 2015 at 8:33 Comment(0)
P
0

I faced the same issue while installing cvxopt.

 MSVC: set this variable to 1 if compiling with MSVC 14 or later

Setting MSVC to 1 solved this issue for me.

For more info: https://cvxopt.org/install/

Platon answered 12/12, 2022 at 11:52 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.