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

3.5.0 does not build due to LNK2001 in CPyCppyy 1.13.0 #282

Open
fzsombor opened this issue Jan 4, 2025 · 4 comments
Open

3.5.0 does not build due to LNK2001 in CPyCppyy 1.13.0 #282

fzsombor opened this issue Jan 4, 2025 · 4 comments

Comments

@fzsombor
Copy link

fzsombor commented Jan 4, 2025

As in the title. I tried compiling it with VS2017 and 2022 on Win11, but it fails with the following error:

     cl : Command line warning D9025 : overriding '/EHc' with '/EHc-'
      Utility.cxx
      creating C:\Users\fzsombor\AppData\Local\Temp\pip-install-ml1t_t8d\cpycppyy_130c6dd297034ee9a303c07cb0121775\build\lib.win-amd64-cpython-312 
      "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.42.34433\bin\HostX86\x64\link.exe" /nologo /INCREMENTAL:NO /
LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPATH:C:\Users\fzsombor\AppData\Local\Temp\pip-build-env-9q5973ej\overlay\Lib\site-packages\cppyy
_backend\lib /LIBPATH:C:\Users\fzsombor\PycharmProjects\simconnect\.venv\libs /LIBPATH:C:\Users\fzsombor\AppData\Local\Programs\Python\Python312\li
bs /LIBPATH:C:\Users\fzsombor\AppData\Local\Programs\Python\Python312 /LIBPATH:C:\Users\fzsombor\PycharmProjects\simconnect\.venv\PCbuild\amd64 "/L
IBPATH:C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.42.34433\ATLMFC\lib\x64" "/LIBPATH:C:\Program Files (x86)\Mi
crosoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.42.34433\lib\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.22621.0\ucrt\x64
" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\\lib\10.0.22621.0\\um\x64" "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTo
ols\VC\Tools\MSVC\14.42.34433\ATLMFC\lib\x64" "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.42.34433\li
b\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.22621.0\ucrt\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\\lib\10.0.22621
.0\\um\x64" "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.42.34433\ATLMFC\lib\x64" "/LIBPATH:C:\Program
 Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.42.34433\lib\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.2
2621.0\ucrt\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\\lib\10.0.22621.0\\um\x64" libcppyy_backend.lib libCoreLegacy.lib /EXPORT:PyInit_
libcppyy build\temp.win-amd64-cpython-312\Release\src\API.obj build\temp.win-amd64-cpython-312\Release\src\CPPClassMethod.obj build\temp.win-amd64-
cpython-312\Release\src\CPPConstructor.obj build\temp.win-amd64-cpython-312\Release\src\CPPDataMember.obj build\temp.win-amd64-cpython-312\Release\
src\CPPEnum.obj build\temp.win-amd64-cpython-312\Release\src\CPPExcInstance.obj build\temp.win-amd64-cpython-312\Release\src\CPPFunction.obj build\
temp.win-amd64-cpython-312\Release\src\CPPGetSetItem.obj build\temp.win-amd64-cpython-312\Release\src\CPPInstance.obj build\temp.win-amd64-cpython-
312\Release\src\CPPMethod.obj build\temp.win-amd64-cpython-312\Release\src\CPPOperator.obj build\temp.win-amd64-cpython-312\Release\src\CPPOverload
.obj build\temp.win-amd64-cpython-312\Release\src\CPPScope.obj build\temp.win-amd64-cpython-312\Release\src\CPyCppyyModule.obj build\temp.win-amd64
-cpython-312\Release\src\CallContext.obj build\temp.win-amd64-cpython-312\Release\src\Converters.obj build\temp.win-amd64-cpython-312\Release\src\C
ustomPyTypes.obj build\temp.win-amd64-cpython-312\Release\src\DispatchPtr.obj build\temp.win-amd64-cpython-312\Release\src\Dispatcher.obj build\tem
p.win-amd64-cpython-312\Release\src\Executors.obj build\temp.win-amd64-cpython-312\Release\src\LowLevelViews.obj build\temp.win-amd64-cpython-312\R
elease\src\MemoryRegulator.obj build\temp.win-amd64-cpython-312\Release\src\ProxyWrappers.obj build\temp.win-amd64-cpython-312\Release\src\PyExcept
ion.obj build\temp.win-amd64-cpython-312\Release\src\PyResult.obj build\temp.win-amd64-cpython-312\Release\src\PyStrings.obj build\temp.win-amd64-c
python-312\Release\src\Pythonize.obj build\temp.win-amd64-cpython-312\Release\src\TPyArg.obj build\temp.win-amd64-cpython-312\Release\src\TPyClassG
enerator.obj build\temp.win-amd64-cpython-312\Release\src\TemplateProxy.obj build\temp.win-amd64-cpython-312\Release\src\TupleOfInstances.obj build
\temp.win-amd64-cpython-312\Release\src\TypeManip.obj build\temp.win-amd64-cpython-312\Release\src\Utility.obj /OUT:build\lib.win-amd64-cpython-312
\libcppyy.cp312-win_amd64.pyd /IMPLIB:build\temp.win-amd64-cpython-312\Release\src\libcppyy.cp312-win_amd64.lib /EXPORT:_Init_thread_abort /EXPORT:_Init_thread_epoch /EXPORT:_Init_thread_footer /EXPORT:_Init_thread_header /EXPORT:_tls_index
         Creating library build\temp.win-amd64-cpython-312\Release\src\libcppyy.cp312-win_amd64.lib and object build\temp.win-amd64-cpython-312\Release\src\libcppyy.cp312-win_amd64.exp
      CPPMethod.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) unsigned __int64 __cdecl Cppyy::GetNumBasesLongestBranch(unsigned __int64)" (__imp_?GetNumBasesLongestBranch@Cppyy@@YA_K_K@Z)
      build\lib.win-amd64-cpython-312\libcppyy.cp312-win_amd64.pyd : fatal error LNK1120: 1 unresolved externals
      error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.42.34433\\bin\\HostX86\\x64\\link.exe' failed with exit code 1120
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for CPyCppyy
Failed to build CPyCppyy
ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (CPyCppyy)

3.1.2 with CPyCppyy 1.12.16 builds without an issue both VS17 and 2022. Tried with the following tooling:

vs17 vs2022
@wlav
Copy link
Owner

wlav commented Jan 4, 2025

Since it is only missing that one method that was added recently to the public API of cppyy-backend, I suspect the installation script is somehow linking with an older version. I suspect this path /LIBPATH:C\Users\fzsombor\AppData\Local\Programs\Python\Python312\libs gives access to that earlier installed version.

What pip command did you run? PEP517 should guarantee an isolated build environment, meaning the path mentioned above should not show up on the linker command. If you have further information here, that would be helpful.

To make progress, please install the dependencies one by one with individual pip commands. That guarantees that even when the run-time environment path somehow makes it into the build environment, that the correct version is picked up:

python -m pip install cppyy-cling==6.32.8
python -m pip install cppyy-backend==1.15.3
python -m pip install CPyCppyy==1.13.0
python -m pip install cppyy==3.5.0

Alternatively, uninstalling the prior version of cppyy before installing the newer one may do the trick.

@dsuedholt
Copy link

Same error here, even using the individual pip commands suggested. VS2022.

@wlav
Copy link
Owner

wlav commented Jan 23, 2025

I have an idea of what it may be. Could you run:

python -m pip install cppyy-cling==6.32.8 --no-deps --no-build-isolation --force-reinstall
python -m pip install cppyy-backend==1.15.3 --no-deps --no-build-isolation --force-reinstall
python -m pip install CPyCppyy==1.13.0 --no-deps --no-build-isolation --force-reinstall
python -m pip install cppyy==3.5.0 --no-deps --no-build-isolation --force-reinstall

and let me know if it makes any difference?

@dsuedholt
Copy link

It does! These commands run successfully and so does import cppyy. Thanks!

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

3 participants