Build a panda from source

My configuration:

C:\PandaSourse>call makepanda\makepanda --nothing --use-direct --use-gl --use-openal --use-bullet --use-png --use-pandaparticlesystem --threads=2 --optimize=3 --windows-sdk=10 --msvc-version=14.1
Version: 1.10.4.1
Platform: win-amd64
10.0.18362.0
Using Windows SDK 10.0.18362.0
Using Visual Studio 2017
Using MSVC 14.1
Target OS: windows
Target arch: x64

I cannot collect the panda, as the following error occurs.

[T1] Building C++ object built_x64/tmp/p3framework_composite1.obj
p3framework_composite1.cxx
libpng16_static.lib(png.obj) : error LNK2019: unresolved external symbol inflateReset referenced in function png_reset_zstream
libpng16_static.lib(pngrutil.obj) : error LNK2001: unresolved external symbol inflateReset
libpng16_static.lib(png.obj) : error LNK2019: unresolved external symbol adler32 referenced in function png_compare_ICC_profile_with_sRGB
libpng16_static.lib(png.obj) : error LNK2019: unresolved external symbol crc32 referenced in function png_calculate_crc
libpng16_static.lib(pngread.obj) : error LNK2019: unresolved external symbol inflateEnd referenced in function png_read_destroy
libpng16_static.lib(pngwrite.obj) : error LNK2019: unresolved external symbol deflateEnd referenced in function png_write_destroy
libpng16_static.lib(pngwutil.obj) : error LNK2001: unresolved external symbol deflateEnd
libpng16_static.lib(pngwutil.obj) : error LNK2019: unresolved external symbol deflate referenced in function png_compress_IDAT
libpng16_static.lib(pngwutil.obj) : error LNK2019: unresolved external symbol deflateReset referenced in function png_deflate_claim
libpng16_static.lib(pngwutil.obj) : error LNK2019: unresolved external symbol deflateInit2_ referenced in function png_deflate_claim
libpng16_static.lib(pngrutil.obj) : error LNK2019: unresolved external symbol inflate referenced in function png_inflate
libpng16_static.lib(pngrutil.obj) : error LNK2019: unresolved external symbol inflateReset2 referenced in function png_inflate_claim
libpng16_static.lib(pngrutil.obj) : error LNK2019: unresolved external symbol inflateInit2_ referenced in function png_inflate_claim
libpng16_static.lib(pngrutil.obj) : error LNK2019: unresolved external symbol inflateValidate referenced in function png_inflate_claim
built_x64/bin/libpanda.dll : fatal error LNK1120: 12 unresolved externals
The following command returned a non-zero value: link /nologo /NOD:MFC90.LIB /NOD:MFC80.LIB /NOD:LIBCMT /NOD:LIBCI.LIB /DEBUG /nod:libc /nod:libcmtd /nod:atlthunk /nod:atls /nod:atlsd /DLL /MAP:NUL /NOD:MSVCRTD.LIB /NOD:MSVCPRTD.LIB /NOD:MSVCIRTD.LI
B /FIXED:NO /OPT:REF /STACK:4194304 /INCREMENTAL:NO /OUT:built_x64/bin/libpanda.dll /SUBSYSTEM:CONSOLE,5.02 /IMPLIB:built_x64/lib/libpanda.lib built_x64/tmp/panda_panda.obj built_x64/tmp/p3recorder_composite1.obj built_x64/tmp/p3recorder_composite2.
obj built_x64/tmp/p3pgraphnodes_composite1.obj built_x64/tmp/p3pgraphnodes_composite2.obj built_x64/tmp/p3pgraph_nodePath.obj built_x64/tmp/p3pgraph_composite1.obj built_x64/tmp/p3pgraph_composite2.obj built_x64/tmp/p3pgraph_composite3.obj built_x64/
tmp/p3pgraph_composite4.obj built_x64/tmp/p3cull_composite1.obj built_x64/tmp/p3cull_composite2.obj built_x64/tmp/p3movies_composite1.obj built_x64/tmp/p3grutil_multitexReducer.obj built_x64/tmp/p3grutil_composite1.obj built_x64/tmp/p3grutil_composit
e2.obj built_x64/tmp/p3chan_composite1.obj built_x64/tmp/p3chan_composite2.obj built_x64/tmp/p3pstatclient_composite1.obj built_x64/tmp/p3pstatclient_composite2.obj built_x64/tmp/p3char_composite1.obj built_x64/tmp/p3char_composite2.obj built_x64/tmp
/p3collide_composite1.obj built_x64/tmp/p3collide_composite2.obj built_x64/tmp/p3device_composite1.obj built_x64/tmp/p3device_composite2.obj built_x64/tmp/p3dgraph_composite1.obj built_x64/tmp/p3dgraph_composite2.obj built_x64/tmp/p3display_graphicsS
tateGuardian.obj built_x64/tmp/p3display_composite1.obj built_x64/tmp/p3display_composite2.obj built_x64/tmp/p3pipeline_composite1.obj built_x64/tmp/p3pipeline_composite2.obj built_x64/tmp/p3pipeline_contextSwitch.obj built_x64/tmp/p3event_composite1
.obj built_x64/tmp/p3event_composite2.obj built_x64/tmp/p3gobj_composite1.obj built_x64/tmp/p3gobj_composite2.obj built_x64/tmp/p3gsgbase_composite1.obj built_x64/tmp/p3linmath_composite1.obj built_x64/tmp/p3linmath_composite2.obj built_x64/tmp/p3mat
hutil_composite1.obj built_x64/tmp/p3mathutil_composite2.obj built_x64/tmp/p3parametrics_composite1.obj built_x64/tmp/p3parametrics_composite2.obj built_x64/tmp/p3pnmimagetypes_composite1.obj built_x64/tmp/p3pnmimagetypes_composite2.obj built_x64/tmp
/p3pnmimage_composite1.obj built_x64/tmp/p3pnmimage_composite2.obj built_x64/tmp/p3pnmimage_convert_srgb_sse2.obj built_x64/tmp/p3text_composite1.obj built_x64/tmp/p3text_composite2.obj built_x64/tmp/p3tform_composite1.obj built_x64/tmp/p3tform_compo
site2.obj built_x64/tmp/p3putil_composite1.obj built_x64/tmp/p3putil_composite2.obj built_x64/tmp/p3audio_composite1.obj built_x64/tmp/p3pgui_composite1.obj built_x64/tmp/p3pgui_composite2.obj built_x64/tmp/p3net_composite1.obj built_x64/tmp/p3net_co
mposite2.obj built_x64/tmp/p3nativenet_composite1.obj built_x64/tmp/p3pandabase_pandabase.obj built_x64/lib/libpandaexpress.lib built_x64/tmp/p3dxml_composite1.obj built_x64/lib/libp3dtoolconfig.lib built_x64/lib/libp3dtool.lib wsock32.lib ws2_32.lib
user32.lib winmm.lib gdi32.lib advapi32.lib iphlpapi.lib setupapi.lib thirdparty/win-libs-vc14-x64/png/lib/libpng16_static.lib

These unresolved functions are from zlib library. You should build zlib as well if I remember correctly.

Maybe, but before I used the same configurations and the panda was going. I’ll try.

I checked by intuition, the flag --use-png causes this error. However, I wonder how inferior PNG support would be without it …

Yes, correct, libpng causes this error, and it relies on zlib.

If you are static linking, you should have
thirdparty\win-libs-vc14-x64\zlib\lib\zlibstatic.lib in your panda source folder.

If you are dynamic linking, you should have thirdparty\win-libs-vc14-x64\zlib\lib\zlib.lib to build, and then to use it, you need a zlib.dll.

I remember that one of the distributions was missing some of zlib files, I had to download the source from the github repo https://github.com/madler/zlib and build it separately.

In addition, the --use-freetype plugin is not going to, I do not remember the error. I have these files:

thirdparty \ win-libs-vc14-x64 \ zlib \ lib \ zlibstatic.lib
thirdparty \ win-libs-vc14-x64 \ zlib \ lib \ zlib.lib

I think the problem is most likely related to the optimization flag, because it says on the Zlib office page that for 64-bit you do not need to set a flag.

The problem was that I used to build 3D panda, Using MSVC 14.1
Accordingly, I need to build third-party libraries with this compiler, what will look like this.

thirdparty \ win-libs-vc15-x64 \ zlib \ lib \ zlibstatic.lib

I do not understand the logic of the panda assembly, I rebuilt the third-party library, and the path changed. When assembly begins, makepanda treacherously removes the plugins and continues to collect. The question is why? C ++ programming will lead me to the hospital. Accordingly, Zlib was simply ignored, I thought I collected it!

The solution will be to rebuild third-party plugins with the compiler that the panda was going to, in my case 14.1.

However, makepanda herself will not be able to find them, because the path has changed. You need to use the hack by changing the name of the folder:

win-libs-vc15-x64

on:

win-libs-vc14-x64

The whole problem is in using the VC prefix, which is simply not needed.
Also cmake panda and cmake of third-party libraries use different compiler names
14.1 - cmake panda
15 - cmake third-party.
Which is completely confusing.