windows-builds icon indicating copy to clipboard operation
windows-builds copied to clipboard

mapnik Python bindings fail with VS2015 Update 3

Open wilhelmberg opened this issue 8 years ago • 13 comments

/cc @artemp @springmeyer

AppVeyor doesn't ~~build~~ bail on a Python bindings build error so I don't know exactly for how long this has been failing.

Maybe just a missing reference to freetype.lib:

29>Link:
        Creating library lib/python2.7/mapnik/_mapnik.lib and object lib/python2.7/mapnik/_mapnik.exp
     Linker: LibDef Total time = 0.00196s PB: 410066944 [c:\mb\windows-builds-64\packages\mapnik-master\mapnik-gyp\build\lib\python2.7\mapnik\_mapnik.pyd] 
29>mapnik_font_engine.obj : error LNK2019: unresolved external symbol "class mapnik::freetype_engine const volatile * __cdecl boost::get_pointer<class mapnik::freetype_engine const volatile >(class mapnik::freetype_engine const volatile *)" (??$get_pointer@$$CDVfreetype_engine@mapnik@@@boost@@YAPEDVfreetype_engine@mapnik@@PEDV12@@Z) referenced in function "public: static struct _object * __cdecl boost::python::objects::make_instance_impl<class mapnik::freetype_engine,struct boost::python::objects::pointer_holder<class mapnik::freetype_engine *,class mapnik::freetype_engine>,struct boost::python::objects::make_ptr_instance<class mapnik::freetype_engine,struct boost::python::objects::pointer_holder<class mapnik::freetype_engine *,class mapnik::freetype_engine> > >::execute<class mapnik::freetype_engine *>(class mapnik::freetype_engine * &)" (??$execute@PEAVfreetype_engine@mapnik@@@?$make_instance_impl@Vfreetype_engine@mapnik@@U?$pointer_holder@PEAVfreetype_engine@mapnik@@V12@@objects@python@boost@@U?$make_ptr_instance@Vfreetype_engine@mapnik@@U?$pointer_holder@PEAVfreetype_engine@mapnik@@V12@@objects@python@boost@@@456@@objects@python@boost@@SAPEAU_object@@AEAPEAVfreetype_engine@mapnik@@@Z) [c:\mb\windows-builds-64\packages\mapnik-master\mapnik-gyp\build\_mapnik.vcxproj]
29>lib/python2.7/mapnik/_mapnik.pyd : fatal error LNK1120: 1 unresolved externals [c:\mb\windows-builds-64\packages\mapnik-master\mapnik-gyp\build\_mapnik.vcxproj]
     Linker:   Wait PDB close Total time = 0.00130s PB: 413396992 [c:\mb\windows-builds-64\packages\mapnik-master\mapnik-gyp\build\lib\python2.7\mapnik\_mapnik.pyd] 
     Linker:   Wait type merge Total time = 0.35704s PB: 388227072 [c:\mb\windows-builds-64\packages\mapnik-master\mapnik-gyp\build\lib\python2.7\mapnik\_mapnik.pyd] 
     Linker: Final Total time = 2.66497s < 88804153009 - 88830802662 > PB: 35565568 [c:\mb\windows-builds-64\packages\mapnik-master\mapnik-gyp\build\lib\python2.7\mapnik\_mapnik.pyd] 
29>Done Building Project "c:\mb\windows-builds-64\packages\mapnik-master\mapnik-gyp\build\_mapnik.vcxproj" (default targets) -- FAILED.
"c:\mb\windows-builds-64\packages\mapnik-master\mapnik-gyp\build\mapnik.sln" (default target) (1) ->
"c:\mb\windows-builds-64\packages\mapnik-master\mapnik-gyp\build\_mapnik.vcxproj.metaproj" (default target) (2) ->
"c:\mb\windows-builds-64\packages\mapnik-master\mapnik-gyp\build\_mapnik.vcxproj" (default target) (29) ->
(Link target) -> 
  mapnik_font_engine.obj : error LNK2019: unresolved external symbol "class mapnik::freetype_engine const volatile * __cdecl boost::get_pointer<class mapnik::freetype_engine const volatile >(class mapnik::freetype_engine const volatile *)" (??$get_pointer@$$CDVfreetype_engine@mapnik@@@boost@@YAPEDVfreetype_engine@mapnik@@PEDV12@@Z) referenced in function "public: static struct _object * __cdecl boost::python::objects::make_instance_impl<class mapnik::freetype_engine,struct boost::python::objects::pointer_holder<class mapnik::freetype_engine *,class mapnik::freetype_engine>,struct boost::python::objects::make_ptr_instance<class mapnik::freetype_engine,struct boost::python::objects::pointer_holder<class mapnik::freetype_engine *,class mapnik::freetype_engine> > >::execute<class mapnik::freetype_engine *>(class mapnik::freetype_engine * &)" (??$execute@PEAVfreetype_engine@mapnik@@@?$make_instance_impl@Vfreetype_engine@mapnik@@U?$pointer_holder@PEAVfreetype_engine@mapnik@@V12@@objects@python@boost@@U?$make_ptr_instance@Vfreetype_engine@mapnik@@U?$pointer_holder@PEAVfreetype_engine@mapnik@@V12@@objects@python@boost@@@456@@objects@python@boost@@SAPEAU_object@@AEAPEAVfreetype_engine@mapnik@@@Z) [c:\mb\windows-builds-64\packages\mapnik-master\mapnik-gyp\build\_mapnik.vcxproj]
  lib/python2.7/mapnik/_mapnik.pyd : fatal error LNK1120: 1 unresolved externals [c:\mb\windows-builds-64\packages\mapnik-master\mapnik-gyp\build\_mapnik.vcxproj]

wilhelmberg avatar Jun 29 '16 13:06 wilhelmberg

Seems like this might be related to https://github.com/mapnik/python-mapnik/blob/master/src/boost_std_shared_shim.hpp. Could BOOST_NO_CXX11_SMART_PTR be being set to true in this build?

springmeyer avatar Jun 30 '16 18:06 springmeyer

Could BOOST_NO_CXX11_SMART_PTR be being set to true in this build?

As far as I can tell that's not the problem. Used compiler switches /E, /E, /P, /EP to dump all preprocessor directives to files and looking through them couldn't find any reference to BOOST_NO_CXX11_SMART_PTR.

wilhelmberg avatar Jul 01 '16 14:07 wilhelmberg

Also tried additionally linking to freetype.lib, but the output of the /VERBOSE linker switch tells me that it is not used. Being already linked into to mapnik.dll before.

Unused libraries:
  c:\mb\windows-builds-64\packages\mapnik-master\mapnik-gyp\mapnik-sdk/lib/\freetype.lib
  c:\mb\windows-builds-64\packages\mapnik-master\mapnik-gyp\mapnik-sdk/lib/\libboost_regex-vc140-mt-1_60.lib
  c:\mb\windows-builds-64\packages\mapnik-master\mapnik-gyp\mapnik-sdk/lib/\icuin.lib
  C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\lib\amd64\OLDNAMES.lib
  C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x64\uuid.lib

wilhelmberg avatar Jul 01 '16 14:07 wilhelmberg

Hello ! I am running into the same error as above. Is there a resolution for this ? Or as a temporary fix will switching to a old commit help ?

stoicio avatar Jul 18 '16 20:07 stoicio

@mbhala as temporary workaround till we find a solution you can use the pre-built Windows mapnik SDK without Python bindings.

64-bit: https://mapnik.s3.amazonaws.com/dist/dev/mapnik-win-sdk-v3.0.11-163-g00e5d00-x64-14.0.7z

32-bit: https://mapnik.s3.amazonaws.com/dist/dev/mapnik-win-sdk-v3.0.11-163-g00e5d00-x86-14.0.7z

wilhelmberg avatar Jul 19 '16 11:07 wilhelmberg

If any one still wants to compile one on their own, they can do so after uninstalling VS 2015 update 2.

Below are the steps that I followed:

Dependencies:

  • 64bit windows 7 or later operating system
  • Visual Studio 2015 with Update 2 (Not available on Microsoft site. Use below link to download it.)

Download link - <TBD> [Important note* - Make sure you install VS2015 without 'update 3'. If you go with recommended installation wizzard then it will automatically install the update 3. Hence, choose the custom installation option and uncheck the 'update 3' checkbox.]

  • Python 2.7 32 bit installed into C:\Python27 [No. 64-bit version of python is not going to work. Don't even experiment!]

git installed into C:\Program Files (x86)\Git

Mapbox script:

  • Clone the mapbox windows builscript project from https://github.com/mapbox/windows-builds. (Go to terminal and run below commands.) git clone https://github.com/mapbox/windows-builds.git [Let's call current directory <MAPBOX_HOME>]
  • cd windows-builds
  • settings.bat
  • scripts\build.bat [Succeful build will create 'mapnik-win-sdk-.7z' file in 'windows-builds\bin' director]

jadavbheda avatar Aug 03 '16 06:08 jadavbheda

Any update on this?

thisisbinod avatar Mar 27 '17 19:03 thisisbinod

@thisisbinod currently no update, but we plan on testing with VS2017 within a few weeks.

wilhelmberg avatar Mar 28 '17 06:03 wilhelmberg

Here is the bug description: https://connect.microsoft.com/VisualStudio/Feedback/Details/2852624 http://stackoverflow.com/questions/38261530/unresolved-external-symbols-since-visual-studio-2015-update-3-boost-python-link

alex85k avatar Apr 23 '17 14:04 alex85k

^^ /cc @springmeyer @artemp

wilhelmberg avatar Apr 23 '17 15:04 wilhelmberg

The suggested workaround worked for pyosimium: https://github.com/osmcode/pyosmium/pull/35/commits/3fa34712ac067fc8f4030ef944c6c2ab1915b83f

alex85k avatar Apr 23 '17 18:04 alex85k

Thank you so much for that insight @alex85k. We should try this with mapnik.

springmeyer avatar Apr 25 '17 01:04 springmeyer

I am certified Google&StackOverflow user :) The only problem with this workaround is that additional get_pointer functions should not be defined twice.

alex85k avatar Apr 25 '17 11:04 alex85k