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

[openjpeg] build failure x64-windows with features (jp3d,jpip,jpwl,mj2) on VS 2019 latest update 16.9.1 #16645

Closed
StarGate-One opened this issue Mar 10, 2021 · 5 comments · Fixed by #16661
Assignees
Labels
category:port-bug The issue is with a library, which is something the port should already support depends:upstream-changes Waiting on a change to the upstream project

Comments

@StarGate-One
Copy link
Contributor

StarGate-One commented Mar 10, 2021

Host Environment

  • OS: [Microsoft Windows [Version 10.0.19042.867]]
  • Compiler:
    Visual Studio 2019 Community Edition [Version 16.9.1]
    Visual Studio Toolset [Version 14.28.29910]
    Microsoft (R) C/C++ Optimizing Compiler [Version 19.28.29912 for x64]

To Reproduce
Steps to reproduce the behavior:

  1. Default triplet VCPKG_DEFAULT_TRIPLET = x64-windows
  2. PS D:\2019\test>vcpkg install openjpeg[core,jp3d,jpip,jpwl,mj2]

Failure logs

  • Cut and past the appropriate build messages from the console output.

Computing installation plan...
The following packages will be built and installed:
openjpeg[core,jp3d,jpip,jpwl,mj2]:x64-windows -> 2.3.1#2
Starting package 1/1: openjpeg:x64-windows
Building package openjpeg[core,jp3d,jpip,jpwl,mj2]:x64-windows...
-- Using cached D:/2019/test/downloads/uclouvain-openjpeg-v2.3.1.tar.gz
-- Cleaning sources at D:/2019/test/buildtrees/openjpeg/src/v2.3.1-ea4b63573b.clean. Use --editable to skip cleaning for the packages you specify.
-- Extracting source D:/2019/test/downloads/uclouvain-openjpeg-v2.3.1.tar.gz
-- Applying patch dll.location.patch
-- Using source at D:/2019/test/buildtrees/openjpeg/src/v2.3.1-ea4b63573b.clean
CMake Deprecation Warning at scripts/cmake/vcpkg_check_features.cmake:182 (message):
calling vcpkg_check_features without the FEATURES keyword has been
deprecated.

 Please add the `FEATURES` keyword to the call.

Call Stack (most recent call first):
ports/openjpeg/portfile.cmake:18 (vcpkg_check_features)
scripts/ports.cmake:139 (include)

-- Configuring x64-windows
-- Building x64-windows-dbg
-- Building x64-windows-rel
CMake Error at scripts/cmake/vcpkg_execute_build_process.cmake:144 (message):
Command failed: "C:/Program Files/CMake/bin/cmake.exe" --build . --config Release --target install -- -v -j8
Working Directory: D:/2019/test/buildtrees/openjpeg/x64-windows-rel
See logs for more information:
D:\2019\test\buildtrees\openjpeg\install-x64-windows-rel-out.log

Call Stack (most recent call first):
scripts/cmake/vcpkg_build_cmake.cmake:105 (vcpkg_execute_build_process)
scripts/cmake/vcpkg_install_cmake.cmake:45 (vcpkg_build_cmake)
ports/openjpeg/portfile.cmake:38 (vcpkg_install_cmake)
scripts/ports.cmake:139 (include)

Error: Building package openjpeg:x64-windows failed with: BUILD_FAILED
Please ensure you're using the latest portfiles with .\vcpkg update, then
submit an issue at [https://github.com/Microsoft/vcpkg/issues] including:
Package: openjpeg:x64-windows
Vcpkg version: 2021-01-13-8027bea90b47d50fd6090bbf5ded330f00f87570

Additionally, attach any relevant sections from the log files above.

  • Please attach any additional failure logs mentioned in the console output.
    Several iterations of error within attached file:
    D:\2019\test\buildtrees\openjpeg\src\v2.3.1-ea4b63573b.clean\src\lib\openmj2\opj_includes.h(97): error C2169: 'lrintf': intrinsic function, cannot be defined
    D:\2019\test\buildtrees\openjpeg\install-x64-windows-rel-out.log

Additional context
Add any other context about the problem here, such as what you have already tried to resolve the issue.

  1. Port openjpeg[core,jp3d,jpip,jpwl,mj2] works on latest update of VS 2017:
    Visual Studio 2017 Community Edition [Version 15.9.34]
    Visual Studio Toolset [Version 14.16.27023]
    Microsoft (R) C/C++ Optimizing Compiler [Version 19.16.27045 for x64]
  2. Port openjpeg will install without features [jp3d,jpip,jpwl,mj2] (but these features are needed)
  3. This worked on VS 2019 before install of latest update of VS 2019 (do not know if it was 16.9.0 or 16.9.1 causing the break, as I upgraded from the most current 16.8.xx to 16.9.1 skipping 16.9.0)
  4. The debug build portion of the port install appears to work as seen in the attached D:\2019\test\buildtrees\openjpeg\install-x64-windows-dbg-out.log
@StarGate-One StarGate-One changed the title [openjpeg] build failure with features (jp3d,jpip,jpwl,mj2) on VS 2019 latest update 16.9.1 [openjpeg] build failure x64-windows with features (jp3d,jpip,jpwl,mj2) on VS 2019 latest update 16.9.1 Mar 10, 2021
@Neumann-A
Copy link
Contributor

@StarGate-One: Please report upstream:
the code states:

/* MSVC and Borland C do not have lrintf */
#if defined(_MSC_VER) || defined(__BORLANDC__)

@NancyLi1013
Copy link
Contributor

It seems that openjepg has dropped lrintf . We can see that upstream has renamed lrintf as opj_lrintf in openjp2 module.

But it still uses lrintf in openmj2 module.

As @Neumann-A suggested, we should report this to upstream.

ITK also fixed the same issue for openjpeg embedded in itk. InsightSoftwareConsortium/ITK#1967

@NancyLi1013 NancyLi1013 added category:port-bug The issue is with a library, which is something the port should already support depends:upstream-changes Waiting on a change to the upstream project labels Mar 11, 2021
@StarGate-One
Copy link
Contributor Author

@NancyLi1013 /cc @Neumann-A

  1. So the openjpeg is only supporting openjp2.
  2. I would agree we probably need to upgrade openjpeg to v3.4.0, with feature jp2 and leave out the other features jp3d, jpip, jpwl and mj2.
  3. Unless we go through and make changes like mentioned in ITK PR COMP: Fix OpenJPEG build error with Visual Studio 16.9 InsightSoftwareConsortium/ITK#2388
  4. But I am confused, as the port with these features still build/compile/install under VS 2017, leading me to think either:
    a. The port never really installed these features properly -or-
    b. MS changed how it supports lrintf in this latest update to VS 2019 as it did install prior to VS 2019 16.9.0?

Install on 2017:
config-x64-windows-out.log
install-x64-windows-dbg-out.log
install-x64-windows-rel-out.log

PS D:\2017\test> vcpkg install openjpeg[core,jp3d,jpip,jpwl,mj2]
Computing installation plan...
The following packages will be built and installed:
openjpeg[core,jp3d,jpip,jpwl,mj2]:x64-windows -> 2.3.1#2
Starting package 1/1: openjpeg:x64-windows
Building package openjpeg[core,jp3d,jpip,jpwl,mj2]:x64-windows...
-- Using cached D:/2017/test/downloads/uclouvain-openjpeg-v2.3.1.tar.gz
-- Extracting source D:/2017/test/downloads/uclouvain-openjpeg-v2.3.1.tar.gz
-- Applying patch dll.location.patch
-- Using source at D:/2017/test/buildtrees/openjpeg/src/v2.3.1-ea4b63573b.clean
CMake Deprecation Warning at scripts/cmake/vcpkg_check_features.cmake:182 (message):
calling vcpkg_check_features without the FEATURES keyword has been
deprecated.

 Please add the `FEATURES` keyword to the call.

Call Stack (most recent call first):
ports/openjpeg/portfile.cmake:18 (vcpkg_check_features)
scripts/ports.cmake:142 (include)

-- Configuring x64-windows
-- Building x64-windows-dbg
-- Building x64-windows-rel
-- Using msys root at D:/2017/test/downloads/tools/msys2/50864d9fae363d6e
-- Fixing pkgconfig file: D:/2017/test/packages/openjpeg_x64-windows/lib/pkgconfig/libopenjp2.pc
-- Fixing pkgconfig file: D:/2017/test/packages/openjpeg_x64-windows/lib/pkgconfig/libopenjp3d.pc
-- Fixing pkgconfig file: D:/2017/test/packages/openjpeg_x64-windows/lib/pkgconfig/libopenjpip.pc
-- Fixing pkgconfig file: D:/2017/test/packages/openjpeg_x64-windows/lib/pkgconfig/libopenjpwl.pc
-- Fixing pkgconfig file: D:/2017/test/packages/openjpeg_x64-windows/debug/lib/pkgconfig/libopenjp2.pc
-- Fixing pkgconfig file: D:/2017/test/packages/openjpeg_x64-windows/debug/lib/pkgconfig/libopenjp3d.pc
-- Fixing pkgconfig file: D:/2017/test/packages/openjpeg_x64-windows/debug/lib/pkgconfig/libopenjpip.pc
-- Fixing pkgconfig file: D:/2017/test/packages/openjpeg_x64-windows/debug/lib/pkgconfig/libopenjpwl.pc
-- Installing: D:/2017/test/packages/openjpeg_x64-windows/share/openjpeg/copyright
-- Performing post-build validation
-- Performing post-build validation done
Building package openjpeg[core,jp3d,jpip,jpwl,mj2]:x64-windows... done
Installing package openjpeg[core,jp3d,jpip,jpwl,mj2]:x64-windows...
Installing package openjpeg[core,jp3d,jpip,jpwl,mj2]:x64-windows... done
Elapsed time for package openjpeg:x64-windows: 45.34 s

Total elapsed time: 45.61 s

The package openjpeg:x64-windows provides CMake targets:

find_package(OpenJPEG CONFIG REQUIRED)
target_link_libraries(main PRIVATE openjp2 openjpip openjpwl)

@Neumann-A
Copy link
Contributor

MS changed how it supports lrintf in this latest update to VS 2019 as it did install prior to VS 2019 16.9.0?

seemingly yes. VS updates sometimes add missing intrinsics.

Personally I would just patch the #ifdef to include a _MSC_VER version check.

@StarGate-One
Copy link
Contributor Author

I created a patch by doing what ITK did:
diff --git a/src/lib/openmj2/opj_includes.h b/src/lib/openmj2/opj_includes.h
index 340e8a9..11bb0e4 100644
--- a/src/lib/openmj2/opj_includes.h
+++ b/src/lib/openmj2/opj_includes.h
@@ -93,7 +93,7 @@ Most compilers implement their own version of this keyword ...

/* MSVC and Borland C do not have lrintf */
#if defined(_MSC_VER) || defined(__BORLANDC__)
-static INLINE long lrintf(float f)
+static INLINE long opj_lrintf(float f)
{
#ifdef _M_X64
return (long)((f > 0.0f) ? (f + 0.5f) : (f - 0.5f));

  • It seems all the features call this same opj_includes.h file, so it allows all features to be installed again.
  • For some reason the intrinsic function was changed from lrintf to opj_lrintf.
  • I just do not know why it works in 2017 but not 2019 with the lrintf name? (It just keeps me wondering)
  • Anyway, the patch I made works on both 2017 and 2019 x64-windows.
  • I will try to submit PR with patch shortly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:port-bug The issue is with a library, which is something the port should already support depends:upstream-changes Waiting on a change to the upstream project
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants