Skip to content

otb: include legacy vcl header file#410844

Merged
GaetanLepage merged 1 commit intoNixOS:masterfrom
qbisi:otb
Jun 10, 2025
Merged

otb: include legacy vcl header file#410844
GaetanLepage merged 1 commit intoNixOS:masterfrom
qbisi:otb

Conversation

@qbisi
Copy link
Contributor

@qbisi qbisi commented May 25, 2025

part of #407910

It's not a regression caused by updating vtk.

related hydra build succeed https://hydra.nixos.org/build/298128281
though it failed on my local build

[ 34%] �[32m�[1mLinking CXX executable ../../../../bin/OTBImageNoiseHeaderTest1�[0m
[ 34%] �[32m�[1mLinking CXX executable ../../../bin/OTBIndicesHeaderTest1�[0m
In file included from �[01m�[K/build/source/build/Modules/Core/Mosaic/test/OTBMosaicHeaderTest1.cxx:23�[m�[K:
�[01m�[K/build/source/Modules/Core/Mosaic/include/otbMosaicFunctors.h:�[m�[K In constructor '�[01m�[Kotb::Functor::RGB2LAB<TInput, TOutput>::�[01;32m�[KRGB2LAB�[m�[K()�[m�[K':
�[01m�[K/build/source/Modules/Core/Mosaic/include/otbMosaicFunctors.h:61:22:�[m�[K �[01;31m�[Kerror: �[m�[Kthere are no arguments to '�[01m�[Kvcl_sqrt�[m�[K' that depend on a template parameter, so a declaration of '�[01m�[Kvcl_sqrt�[m�[K' must be available [�[01;31m�[K�]8;;https://gcc.gnu.org/onlinedocs/gcc-14.2.0/gcc/Warning-Options.html#index-fpermissive�-fpermissive�]8;;��[m�[K]
   61 |     D1[0][0] = 1.0 / �[01;31m�[Kvcl_sqrt�[m�[K(3.0);
      |                      �[01;31m�[K^~~~~~~~�[m�[K
�[01m�[K/build/source/Modules/Core/Mosaic/include/otbMosaicFunctors.h:61:22:�[m�[K �[01;36m�[Knote: �[m�[K(if you use '�[01m�[K�]8;;https://gcc.gnu.org/onlinedocs/gcc-14.2.0/gcc/Warning-Options.html#index-fpermissive�-fpermissive�]8;;��[m�[K', G++ will accept your code, but allowing the use of an undeclared name is deprecated)
�[01m�[K/build/source/Modules/Core/Mosaic/include/otbMosaicFunctors.h:62:22:�[m�[K �[01;31m�[Kerror: �[m�[Kthere are no arguments to '�[01m�[Kvcl_sqrt�[m�[K' that depend on a template parameter, so a declaration of '�[01m�[Kvcl_sqrt�[m�[K' must be available [�[01;31m�[K�]8;;https://gcc.gnu.org/onlinedocs/gcc-14.2.0/gcc/Warning-Options.html#index-fpermissive�-fpermissive�]8;;��[m�[K]
   62 |     D1[1][1] = 1.0 / �[01;31m�[Kvcl_sqrt�[m�[K(6.0);
      |                      �[01;31m�[K^~~~~~~~�[m�[K
�[01m�[K/build/source/Modules/Core/Mosaic/include/otbMosaicFunctors.h:63:22:�[m�[K �[01;31m�[Kerror: �[m�[Kthere are no arguments to '�[01m�[Kvcl_sqrt�[m�[K' that depend on a template parameter, so a declaration of '�[01m�[Kvcl_sqrt�[m�[K' must be available [�[01;31m�[K�]8;;https://gcc.gnu.org/onlinedocs/gcc-14.2.0/gcc/Warning-Options.html#index-fpermissive�-fpermissive�]8;;��[m�[K]
   63 |     D1[2][2] = 1.0 / �[01;31m�[Kvcl_sqrt�[m�[K(2.0);
      |                      �[01;31m�[K^~~~~~~~�[m�[K
�[01m�[K/build/source/Modules/Core/Mosaic/include/otbMosaicFunctors.h:�[m�[K In member function '�[01m�[KTOutput otb::Functor::RGB2LAB<TInput, TOutput>::�[01;32m�[Koperator()�[m�[K(const TInput&) const�[m�[K':
�[01m�[K/build/source/Modules/Core/Mosaic/include/otbMosaicFunctors.h:108:26:�[m�[K �[01;31m�[Kerror: �[m�[Kthere are no arguments to '�[01m�[Kvcl_log�[m�[K' that depend on a template parameter, so a declaration of '�[01m�[Kvcl_log�[m�[K' must be available [�[01;31m�[K�]8;;https://gcc.gnu.org/onlinedocs/gcc-14.2.0/gcc/Warning-Options.html#index-fpermissive�-fpermissive�]8;;��[m�[K]
  108 |     const double log10 = �[01;31m�[Kvcl_log�[m�[K(10);
      |                          �[01;31m�[K^~~~~~~�[m�[K
�[01m�[K/build/source/Modules/Core/Mosaic/include/otbMosaicFunctors.h:109:26:�[m�[K �[01;31m�[Kerror: �[m�[Kthere are no arguments to '�[01m�[Kvcl_log�[m�[K' that depend on a template parameter, so a declaration of '�[01m�[Kvcl_log�[m�[K' must be available [�[01;31m�[K�]8;;https://gcc.gnu.org/onlinedocs/gcc-14.2.0/gcc/Warning-Options.html#index-fpermissive�-fpermissive�]8;;��[m�[K]
  109 |     lms[0][0]          = �[01;31m�[Kvcl_log�[m�[K(lms[0][0]) / log10;
      |                          �[01;31m�[K^~~~~~~�[m�[K
�[01m�[K/build/source/Modules/Core/Mosaic/include/otbMosaicFunctors.h:110:26:�[m�[K �[01;31m�[Kerror: �[m�[Kthere are no arguments to '�[01m�[Kvcl_log�[m�[K' that depend on a template parameter, so a declaration of '�[01m�[Kvcl_log�[m�[K' must be available [�[01;31m�[K�]8;;https://gcc.gnu.org/onlinedocs/gcc-14.2.0/gcc/Warning-Options.html#index-fpermissive�-fpermissive�]8;;��[m�[K]
  110 |     lms[1][0]          = �[01;31m�[Kvcl_log�[m�[K(lms[1][0]) / log10;
      |                          �[01;31m�[K^~~~~~~�[m�[K
�[01m�[K/build/source/Modules/Core/Mosaic/include/otbMosaicFunctors.h:111:26:�[m�[K �[01;31m�[Kerror: �[m�[Kthere are no arguments to '�[01m�[Kvcl_log�[m�[K' that depend on a template parameter, so a declaration of '�[01m�[Kvcl_log�[m�[K' must be available [�[01;31m�[K�]8;;https://gcc.gnu.org/onlinedocs/gcc-14.2.0/gcc/Warning-Options.html#index-fpermissive�-fpermissive�]8;;��[m�[K]
  111 |     lms[2][0]          = �[01;31m�[Kvcl_log�[m�[K(lms[2][0]) / log10;
      |                          �[01;31m�[K^~~~~~~�[m�[K
�[01m�[K/build/source/Modules/Core/Mosaic/include/otbMosaicFunctors.h:�[m�[K In constructor '�[01m�[Kotb::Functor::LAB2RGB<TInput, TOutput>::�[01;32m�[KLAB2RGB�[m�[K()�[m�[K':
�[01m�[K/build/source/Modules/Core/Mosaic/include/otbMosaicFunctors.h:162:22:�[m�[K �[01;31m�[Kerror: �[m�[Kthere are no arguments to '�[01m�[Kvcl_sqrt�[m�[K' that depend on a template parameter, so a declaration of '�[01m�[Kvcl_sqrt�[m�[K' must be available [�[01;31m�[K�]8;;https://gcc.gnu.org/onlinedocs/gcc-14.2.0/gcc/Warning-Options.html#index-fpermissive�-fpermissive�]8;;��[m�[K]
  162 |     D1[0][0] = 1.0 / �[01;31m�[Kvcl_sqrt�[m�[K(3.0);
      |                      �[01;31m�[K^~~~~~~~�[m�[K
�[01m�[K/build/source/Modules/Core/Mosaic/include/otbMosaicFunctors.h:163:22:�[m�[K �[01;31m�[Kerror: �[m�[Kthere are no arguments to '�[01m�[Kvcl_sqrt�[m�[K' that depend on a template parameter, so a declaration of '�[01m�[Kvcl_sqrt�[m�[K' must be available [�[01;31m�[K�]8;;https://gcc.gnu.org/onlinedocs/gcc-14.2.0/gcc/Warning-Options.html#index-fpermissive�-fpermissive�]8;;��[m�[K]
  163 |     D1[1][1] = 1.0 / �[01;31m�[Kvcl_sqrt�[m�[K(6.0);
      |                      �[01;31m�[K^~~~~~~~�[m�[K
�[01m�[K/build/source/Modules/Core/Mosaic/include/otbMosaicFunctors.h:164:22:�[m�[K �[01;31m�[Kerror: �[m�[Kthere are no arguments to '�[01m�[Kvcl_sqrt�[m�[K' that depend on a template parameter, so a declaration of '�[01m�[Kvcl_sqrt�[m�[K' must be available [�[01;31m�[K�]8;;https://gcc.gnu.org/onlinedocs/gcc-14.2.0/gcc/Warning-Options.html#index-fpermissive�-fpermissive�]8;;��[m�[K]
  164 |     D1[2][2] = 1.0 / �[01;31m�[Kvcl_sqrt�[m�[K(2.0);
      |                      �[01;31m�[K^~~~~~~~�[m�[K
�[01m�[K/build/source/Modules/Core/Mosaic/include/otbMosaicFunctors.h:�[m�[K In member function '�[01m�[KTOutput otb::Functor::LAB2RGB<TInput, TOutput>::�[01;32m�[Koperator()�[m�[K(const TInput&) const�[m�[K':
�[01m�[K/build/source/Modules/Core/Mosaic/include/otbMosaicFunctors.h:207:17:�[m�[K �[01;31m�[Kerror: �[m�[Kthere are no arguments to '�[01m�[Kvcl_pow�[m�[K' that depend on a template parameter, so a declaration of '�[01m�[Kvcl_pow�[m�[K' must be available [�[01;31m�[K�]8;;https://gcc.gnu.org/onlinedocs/gcc-14.2.0/gcc/Warning-Options.html#index-fpermissive�-fpermissive�]8;;��[m�[K]
  207 |     lms[0][0] = �[01;31m�[Kvcl_pow�[m�[K(10.0, lms[0][0]);
      |                 �[01;31m�[K^~~~~~~�[m�[K
�[01m�[K/build/source/Modules/Core/Mosaic/include/otbMosaicFunctors.h:208:17:�[m�[K �[01;31m�[Kerror: �[m�[Kthere are no arguments to '�[01m�[Kvcl_pow�[m�[K' that depend on a template parameter, so a declaration of '�[01m�[Kvcl_pow�[m�[K' must be available [�[01;31m�[K�]8;;https://gcc.gnu.org/onlinedocs/gcc-14.2.0/gcc/Warning-Options.html#index-fpermissive�-fpermissive�]8;;��[m�[K]
  208 |     lms[1][0] = �[01;31m�[Kvcl_pow�[m�[K(10.0, lms[1][0]);
      |                 �[01;31m�[K^~~~~~~�[m�[K
�[01m�[K/build/source/Modules/Core/Mosaic/include/otbMosaicFunctors.h:209:17:�[m�[K �[01;31m�[Kerror: �[m�[Kthere are no arguments to '�[01m�[Kvcl_pow�[m�[K' that depend on a template parameter, so a declaration of '�[01m�[Kvcl_pow�[m�[K' must be available [�[01;31m�[K�]8;;https://gcc.gnu.org/onlinedocs/gcc-14.2.0/gcc/Warning-Options.html#index-fpermissive�-fpermissive�]8;;��[m�[K]
  209 |     lms[2][0] = �[01;31m�[Kvcl_pow�[m�[K(10.0, lms[2][0]);
      |                 �[01;31m�[K^~~~~~~�[m�[K

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • Nixpkgs 25.11 Release Notes (or backporting 24.11 and 25.05 Nixpkgs Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
  • NixOS 25.11 Release Notes (or backporting 24.11 and 25.05 NixOS Release notes)
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@qbisi qbisi marked this pull request as draft May 25, 2025 16:41
@github-actions github-actions bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. labels May 25, 2025
@nix-owners nix-owners bot requested a review from daspk04 May 25, 2025 16:47
@qbisi qbisi marked this pull request as ready for review May 25, 2025 17:16
@daspk04
Copy link
Contributor

daspk04 commented Jun 2, 2025

Hi @qbisi !

So the otb builds without any error (related PR) excluding the changes done in this PR.

So do we really need the changes done here ?

@qbisi
Copy link
Contributor Author

qbisi commented Jun 2, 2025

During test builds of OTB on different machines, we observed a non-deterministic failure in the automatically generated file OTBMosaicHeaderTest1.cxx. The issue is caused by differing header include orders depending on the filesystem behavior (e.g., btrfs vs ext4). On some systems, the build fails with the following error:
error: there are no arguments to 'vcl_sqrt' that depend on a template parameter
which means vcl_sqrt should be declared somewhere.

This happens because otbMosaicFunctors.h uses vcl_sqrt, which depends on the macro VNL_CONFIG_LEGACY_METHODS. This macro is defined (transitively) via:
otbStreamingStatisticsMosaicFilter.h → itkArray.h → itkMacro.h

If otbStreamingStatisticsMosaicFilter.h appears before otbMosaicFunctors.h in the generated file, the build succeeds. If not, the macro is not defined when otbMosaicFunctors.h is parsed, and the build fails. This is a classic case of non-deterministic builds due to:

  1. Implicit dependencies between headers that are not explicitly #included;
  2. File listing order differences across filesystems;
  3. A build script generating source files by iterating over files in an undefined order.

@daspk04
Copy link
Contributor

daspk04 commented Jun 2, 2025

Thanks @qbisi !

OTBStatistics depends on -> OTBStreaming, OTBMosiac c.f

However, the tests for:
OTBStreaming depends on -> OTBStatistic c.f.

Not sure how these are handled during parallel build but seems like a cyclic dependency to me. I assume this is also one of the probable issue apart from what you have mentioned.

Thanks for fixing the issue as I cannot reproduce it.

@qbisi
Copy link
Contributor Author

qbisi commented Jun 2, 2025

Maybe you can reproduce this error on btrfs filesystem.

@imincik
Copy link
Contributor

imincik commented Jun 5, 2025

I get following error when trying to build OTB from this PR:

In file included from /build/source/build/Modules/Core/Mosaic/test/OTBMosaicHeaderTest1.cxx:23:
/build/source/Modules/Core/Mosaic/include/otbMosaicFunctors.h: In constructor 'otb::Functor::RGB2LAB<TInput, TOutput>::RGB2LAB()':
/build/source/Modules/Core/Mosaic/include/otbMosaicFunctors.h:62:22: error: there are no arguments to 'vcl_sqrt' that depend on a template parameter, so a declaration of 'vcl_sqrt' must be available []
   62 |     D1[0][0] = 1.0 / vcl_sqrt(3.0);
      |                      ^~~~~~~~
/build/source/Modules/Core/Mosaic/include/otbMosaicFunctors.h:62:22: note: (if you use '', G++ will accept your code, but allowing the use of an undeclared name is deprecated)
/build/source/Modules/Core/Mosaic/include/otbMosaicFunctors.h:63:22: error: there are no arguments to 'vcl_sqrt' that depend on a template parameter, so a declaration of 'vcl_sqrt' must be available []
   63 |     D1[1][1] = 1.0 / vcl_sqrt(6.0);
      |                      ^~~~~~~~
/build/source/Modules/Core/Mosaic/include/otbMosaicFunctors.h:64:22: error: there are no arguments to 'vcl_sqrt' that depend on a template parameter, so a declaration of 'vcl_sqrt' must be available []
   64 |     D1[2][2] = 1.0 / vcl_sqrt(2.0);
      |                      ^~~~~~~~
/build/source/Modules/Core/Mosaic/include/otbMosaicFunctors.h: In member function 'TOutput otb::Functor::RGB2LAB<TInput, TOutput>::operator()(const TInput&) const':
/build/source/Modules/Core/Mosaic/include/otbMosaicFunctors.h:109:26: error: there are no arguments to 'vcl_log' that depend on a template parameter, so a declaration of 'vcl_log' must be available []
  109 |     const double log10 = vcl_log(10);
      |                          ^~~~~~~
/build/source/Modules/Core/Mosaic/include/otbMosaicFunctors.h:110:26: error: there are no arguments to 'vcl_log' that depend on a template parameter, so a declaration of 'vcl_log' must be available []
  110 |     lms[0][0]          = vcl_log(lms[0][0]) / log10;
      |                          ^~~~~~~
/build/source/Modules/Core/Mosaic/include/otbMosaicFunctors.h:111:26: error: there are no arguments to 'vcl_log' that depend on a template parameter, so a declaration of 'vcl_log' must be available []
  111 |     lms[1][0]          = vcl_log(lms[1][0]) / log10;
      |                          ^~~~~~~
/build/source/Modules/Core/Mosaic/include/otbMosaicFunctors.h:112:26: error: there are no arguments to 'vcl_log' that depend on a template parameter, so a declaration of 'vcl_log' must be available []
  112 |     lms[2][0]          = vcl_log(lms[2][0]) / log10;
      |                          ^~~~~~~
/build/source/Modules/Core/Mosaic/include/otbMosaicFunctors.h: In constructor 'otb::Functor::LAB2RGB<TInput, TOutput>::LAB2RGB()':
/build/source/Modules/Core/Mosaic/include/otbMosaicFunctors.h:163:22: error: there are no arguments to 'vcl_sqrt' that depend on a template parameter, so a declaration of 'vcl_sqrt' must be available []
  163 |     D1[0][0] = 1.0 / vcl_sqrt(3.0);
      |                      ^~~~~~~~
/build/source/Modules/Core/Mosaic/include/otbMosaicFunctors.h:164:22: error: there are no arguments to 'vcl_sqrt' that depend on a template parameter, so a declaration of 'vcl_sqrt' must be available []
  164 |     D1[1][1] = 1.0 / vcl_sqrt(6.0);
      |                      ^~~~~~~~
/build/source/Modules/Core/Mosaic/include/otbMosaicFunctors.h:165:22: error: there are no arguments to 'vcl_sqrt' that depend on a template parameter, so a declaration of 'vcl_sqrt' must be available []
  165 |     D1[2][2] = 1.0 / vcl_sqrt(2.0);
      |                      ^~~~~~~~
/build/source/Modules/Core/Mosaic/include/otbMosaicFunctors.h: In member function 'TOutput otb::Functor::LAB2RGB<TInput, TOutput>::operator()(const TInput&) const':
/build/source/Modules/Core/Mosaic/include/otbMosaicFunctors.h:208:17: error: there are no arguments to 'vcl_pow' that depend on a template parameter, so a declaration of 'vcl_pow' must be available []
  208 |     lms[0][0] = vcl_pow(10.0, lms[0][0]);
      |                 ^~~~~~~
/build/source/Modules/Core/Mosaic/include/otbMosaicFunctors.h:209:17: error: there are no arguments to 'vcl_pow' that depend on a template parameter, so a declaration of 'vcl_pow' must be available []
  209 |     lms[1][0] = vcl_pow(10.0, lms[1][0]);
      |                 ^~~~~~~
/build/source/Modules/Core/Mosaic/include/otbMosaicFunctors.h:210:17: error: there are no arguments to 'vcl_pow' that depend on a template parameter, so a declaration of 'vcl_pow' must be available []
  210 |     lms[2][0] = vcl_pow(10.0, lms[2][0]);
      |                 ^~~~~~~

I get the same error when building OTB from latest master.

@qbisi
Copy link
Contributor Author

qbisi commented Jun 5, 2025

I did not dig much into the "itkMacro.h" header file which is complicate to investigate.
However by adding "itkMacro.h" in "otbMosaicFunctors.h" do fix build failure on my local machine.

@imincik can you have a try with this commit f29cb15.

@imincik
Copy link
Contributor

imincik commented Jun 5, 2025

Just tried with f29cb15 and got the same error.

@qbisi
Copy link
Contributor Author

qbisi commented Jun 5, 2025

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 410844 --package otb
Commit: f29cb15f33d3b4e5f4378ae1849dffb9d7e7bd7f


x86_64-linux

✅ 1 package built:
  • otb

@qbisi
Copy link
Contributor Author

qbisi commented Jun 5, 2025

@imincik can you run nixpkgs-review pr 410844 -p otb --post-result

@imincik
Copy link
Contributor

imincik commented Jun 5, 2025

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 410844


x86_64-linux

❌ 1 package failed to build:
  • otb

@qbisi
Copy link
Contributor Author

qbisi commented Jun 5, 2025

vcl_* is defined directly in "${otb-itk}/include/ITK-5.3/vcl_legacy_aliases.h"
it will be included in "vcl_compiler.h" header when MACRO VNL_CONFIG_LEGACY_METHODS is defined,
I guess the build failure indicate that "vcl_compiler.h" is included once before without VNL_CONFIG_LEGACY_METHODS defined.
That might explain why "vcl_legacy_aliases.h" is not included and vcl_* is not defined.

So the final fixup is to just include "vcl_legacy_aliases.h" in "otbMosaicFunctors.h" directly.

@imincik imincik linked an issue Jun 5, 2025 that may be closed by this pull request
3 tasks
@imincik
Copy link
Contributor

imincik commented Jun 5, 2025

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 410844


x86_64-linux

✅ 1 package built:
  • otb

@imincik
Copy link
Contributor

imincik commented Jun 5, 2025

@qbisi , finally, it works ! Great thanks for your work.

@imincik imincik self-requested a review June 5, 2025 21:19
@daspk04
Copy link
Contributor

daspk04 commented Jun 6, 2025

vcl_* is defined directly in "${otb-itk}/include/ITK-5.3/vcl_legacy_aliases.h" it will be included in "vcl_compiler.h" header when MACRO VNL_CONFIG_LEGACY_METHODS is defined, I guess the build failure indicate that "vcl_compiler.h" is included once before without VNL_CONFIG_LEGACY_METHODS defined. That might explain why "vcl_legacy_aliases.h" is not included and vcl_* is not defined.

So the final fixup is to just include "vcl_legacy_aliases.h" in "otbMosaicFunctors.h" directly.

Hi @qbisi !

Can you please add the below to otb-itk-cmake to confirm if only adding this fixes the issue ?

(lib.cmakeBool "VNL_CONFIG_LEGACY_METHODS" true)

I'm not sure if you checked my earlier reviewed comment, but my guess is that VNL_CONFIG_LEGACY_METHODS is set as 0 by default during ITK build step so if it needs to be enabled, then enabling it should probably should fix this issue, but I might be wrong. c.f

Please check by enabling it first, if it still doesn't fix then adding the header file directly to OTB should be fine .

@qbisi
Copy link
Contributor Author

qbisi commented Jun 6, 2025

I have tried at first priority.
But this setting will not work on two aspects:

  1. Itk has manualy force VNL_CONFIG_LEGACY_METHODS to be false in its cmake config file.
  2. VNL_CONFIG_LEGACY_METHODS is defined in vnl_config.h and used in vcl_compiler.h separately, you have to include vnl_config.h before vcl_compiler.h in every header files before using vcl_compiler.

@daspk04
Copy link
Contributor

daspk04 commented Jun 6, 2025

I have tried at first priority. But this setting will not work on two aspects:

  1. Itk has manualy force VNL_CONFIG_LEGACY_METHODS to be false in its cmake config file.
  2. VNL_CONFIG_LEGACY_METHODS is defined in vnl_config.h and used in vcl_compiler.h separately, you have to include vnl_config.h before vcl_compiler.h in every header files before using vcl_compiler.

Indeed it seems ITK has this forced to be off in the cmake. I would have preferred that we enable that in the CMake c.f. Technically we can also do a substituteInPlace to modify that CMake option but anyways, as the current solution works for let this be there.

I'll open an issue upstream regarding this possibly.

Comment on lines 241 to 243
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @qbisi !

Thanks. CI seems to fails because VNL_CONFIG_LEGACY_METHODS 1 is defined at 2 places likely. It already seems to exists at itk-5.3.0/include/ITK-5.3/vnl/vnl_config.h.

May be better to just update it under ITK during build i.e. under otb-itk. Just have to update the CMakeLists.txt possibly.

May be just adding it to the otb-itk cmakeflgs should be fine:

(lib.cmakeBool "VNL_CONFIG_LEGACY_METHODS" true)

However I tried to build otb based on this branch removing your changes and still seems to build fine for me, then do we then need these changes 🤔

Copy link
Contributor Author

@qbisi qbisi Jun 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This patched otb-itk will not result in a reproduceble otb build.
vcl_compiler.h will be included only once and it might be included before "otbMosaicFunctors.h" without VNL_CONFIG_LEGACY_METHODS being defined due to unpredicted sorting order of header files.
So the only solution is to just include "vcl_legacy_aliases.h" directly in "otbMosaicFunctors.h".

In fact, otb source use "vcl_legacy_aliases.h" directly in most of its test case, i guess the dev might missed this "vcl_legacy_aliases.h" in "otbMosaicFunctors.h" and they will happily adopt this change by adding "vcl_legacy_aliases.h" to "otbMosaicFunctors.h".

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please move this comment outside of this postPatch ?

@qbisi
Copy link
Contributor Author

qbisi commented Jun 8, 2025

@daspk04 do you have time/methods to contact upstream otb to adotp this patch.
I would prefer to use fetchpatch from upstream adopted commit.
I am not familiar with otb and do not have a gitlab account to contact upstream.

@wegank wegank added 12.approved-by: package-maintainer This PR was reviewed and approved by a maintainer listed in any of the changed packages. 12.approvals: 1 This PR was reviewed and approved by one person. labels Jun 9, 2025
@qbisi
Copy link
Contributor Author

qbisi commented Jun 9, 2025

@imincik can we merge this pr, or contact upstream to fix this problem and fetchpatch from the commit.

@daspk04
Copy link
Contributor

daspk04 commented Jun 10, 2025

@daspk04 do you have time/methods to contact upstream otb to adotp this patch. I would prefer to use fetchpatch from upstream adopted commit. I am not familiar with otb and do not have a gitlab account to contact upstream.

@qbisi I have reported the issue upstream, however I would suggest to add the link to the issue in the comment. However we can merge this PR first then during the next release for OTB (10.0.0) I can remove those if they are already added to upstream at that time.

Copy link
Contributor

@daspk04 daspk04 Jun 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @qbisi

Sorry may be I wasn't clear, I meant, that add the upstream issue link, so that we can keep a track of upstream issue and remove it later incase there is a fix already in upstream.

https://gitlab.orfeo-toolbox.org/orfeotoolbox/otb/-/issues/2484

@GaetanLepage
Copy link
Contributor

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 410844
Commit: 43fdc9248e6b43f690d4c571a06d9faabe5e63fe


x86_64-linux

✅ 5 packages built:
  • otb
  • python312Packages.pyotb
  • python312Packages.pyotb.dist
  • python313Packages.pyotb
  • python313Packages.pyotb.dist

aarch64-linux

✅ 5 packages built:
  • otb
  • python312Packages.pyotb
  • python312Packages.pyotb.dist
  • python313Packages.pyotb
  • python313Packages.pyotb.dist

Copy link
Contributor

@GaetanLepage GaetanLepage left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM :)

@daspk04
Copy link
Contributor

daspk04 commented Jun 10, 2025

Thanks @GaetanLepage !

This can be merged I believe as we have already reported the issue upstream, and the fix here already seems work for @qbisi and others (c.f1, c.f2)

@GaetanLepage GaetanLepage merged commit 6f2de94 into NixOS:master Jun 10, 2025
16 of 18 checks passed
@SpaceCyclist
Copy link

Hi, I am from OTB team. I currently pushed a MR in https://gitlab.orfeo-toolbox.org/orfeotoolbox/otb/-/merge_requests/1076 . When CI is ok, the changes will be merged into the "develop" branch. Thus they will be in the next OTB 10

@imincik :

I get the same error when building OTB from latest master.

If you want the latest changes (with ITK 5.3 for instance) prefer the "develop" branch. Master one is up-to-date with latest release, not latest changes.

Best regards

@imincik
Copy link
Contributor

imincik commented Jun 10, 2025

Hi, I am from OTB team. I currently pushed a MR in https://gitlab.orfeo-toolbox.org/orfeotoolbox/otb/-/merge_requests/1076 . When CI is ok, the changes will be merged into the "develop" branch. Thus they will be in the next OTB 10

Thank you very much @SpaceCyclist .

I get the same error when building OTB from latest master.

I meant nixpkgs master not OTB in this comment. But thanks for OTB branch usage clarification anyway.

@daspk04
Copy link
Contributor

daspk04 commented Jun 11, 2025

Hi, I am from OTB team. I currently pushed a MR in https://gitlab.orfeo-toolbox.org/orfeotoolbox/otb/-/merge_requests/1076 . When CI is ok, the changes will be merged into the "develop" branch. Thus they will be in the next OTB 10

@SpaceCyclist Thanks Tristan! 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 12.approvals: 1 This PR was reviewed and approved by one person. 12.approved-by: package-maintainer This PR was reviewed and approved by a maintainer listed in any of the changed packages.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Build failure: otb (OTBMosaicHeaderTest1.cxx.o)

6 participants