Skip to content

ZLIB_LIBRARY ZLIB_INCLUDE_DIR being ignored (LNK2019 errors) in OpenEXR\IlmImf\IlmImf.vcxproj #379

Closed
@mprevot

Description

In windows 10 x64; using VS2017; using cmake 3.13.14 and a powershell script.

I have multiple LNK2019 error, despite a correct configuration:

ImfDwaCompressor.obj : error LNK2019: unresolved external symbol compress2 referenced in function "private: int __cdecl
 Imf_2_3::DwaCompressor::compress(char const *,int,class Imath_2_3::Box<class Imath_2_3::Vec2<int> >,char const * &)" (
?compress@DwaCompressor@Imf_2_3@@AEAAHPEBDHV?$Box@V?$Vec2@H@Imath_2_3@@@Imath_2_3@@AEAPEBD@Z) [I:\lib\master-openexr\bu
ild\OpenEXR\IlmImf\IlmImf.vcxproj]
ImfDwaCompressor.obj : error LNK2019: unresolved external symbol compressBound referenced in function "private: int __c
decl Imf_2_3::DwaCompressor::compress(char const *,int,class Imath_2_3::Box<class Imath_2_3::Vec2<int> >,char const * &
)" (?compress@DwaCompressor@Imf_2_3@@AEAAHPEBDHV?$Box@V?$Vec2@H@Imath_2_3@@@Imath_2_3@@AEAPEBD@Z) [I:\lib\master-openex
r\build\OpenEXR\IlmImf\IlmImf.vcxproj]
ImfDwaCompressor.obj : error LNK2019: unresolved external symbol uncompress referenced in function "private: int __cdec
l Imf_2_3::DwaCompressor::uncompress(char const *,int,class Imath_2_3::Box<class Imath_2_3::Vec2<int> >,char const * &)
" (?uncompress@DwaCompressor@Imf_2_3@@AEAAHPEBDHV?$Box@V?$Vec2@H@Imath_2_3@@@Imath_2_3@@AEAPEBD@Z) [I:\lib\master-opene
xr\build\OpenEXR\IlmImf\IlmImf.vcxproj]
ImfPxr24Compressor.obj : error LNK2001: unresolved external symbol uncompress [I:\lib\master-openexr\build\OpenEXR\IlmI
mf\IlmImf.vcxproj]
ImfZip.obj : error LNK2001: unresolved external symbol uncompress [I:\lib\master-openexr\build\OpenEXR\IlmImf\IlmImf.vc
xproj]
ImfPxr24Compressor.obj : error LNK2019: unresolved external symbol compress referenced in function "private: int __cdec
l Imf_2_3::Pxr24Compressor::compress(char const *,int,class Imath_2_3::Box<class Imath_2_3::Vec2<int> >,char const * &)
" (?compress@Pxr24Compressor@Imf_2_3@@AEAAHPEBDHV?$Box@V?$Vec2@H@Imath_2_3@@@Imath_2_3@@AEAPEBD@Z) [I:\lib\master-opene
xr\build\OpenEXR\IlmImf\IlmImf.vcxproj]
ImfZip.obj : error LNK2001: unresolved external symbol compress [I:\lib\master-openexr\build\OpenEXR\IlmImf\IlmImf.vcxp
roj]
I:\lib\master-openexr\build\OpenEXR\IlmImf\Release\IlmImf-2_3.dll : fatal error LNK1120: 4 unresolved externals [I:\lib
\master-openexr\build\OpenEXR\IlmImf\IlmImf.vcxproj]

Repro:
using zlib 1.2.11, compiled in Win64 at I:\lib\zlib

I configure and build openexr with this script:

$target = "Visual Studio 15 2017 Win64"
$zlib_prefix = "I:\lib\zlib"

function configure {
	cmake.exe -G $target -T v141, host=x64 -j8 `
		-DZLIB_LIBRARY="${zlib_prefix}\lib" -DZLIB_INCLUDE_DIR="${zlib_prefix}\include" `
		-DOPENEXR_BUILD_PYTHON_LIBS=0 -DCMAKE_INSTALL_PREFIX="I:\lib\openexr" `
		..
}

function build {
	"build openexr debug"
	MSBuild.exe OpenEXR.sln /verbosity:m /m
	"build openexr release"
	MSBuild.exe OpenEXR.sln /p:Configuration=Release /verbosity:m /m
}

function install {
	"install openexr debug"
	MSBuild.exe INSTALL.vcxproj /verbosity:m /m
	"install openexr release"
	MSBuild.exe INSTALL.vcxproj /p:Configuration=Release /verbosity:m /m
}

if (!(test-path build)) {
	New-Item -ItemType Directory build
}
Set-Location build
configure
build
#install
Set-Location ..

Proof: hand-edit IlmImf.vcxproj to use the zlib.lib and zlibd.lib provided works.

Metadata

Assignees

No one assigned

    Labels

    Needs DiscussionTo be discussed in the technical steering committee

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions