Open yoda-vid opened 3 years ago
FYI, We're preparing to upgrade ITK for elastix as well: https://github.com/SuperElastix/elastix/tree/Upgrade-ITK-to-v5.2.0
Great! I hope this might be helpful at least for troubleshooting.
@yoda-vid For what it's worth, I reproduced the original compilation error at https://godbolt.org/z/rbnsxarYW
#include <math.h>
long lrintf(float) { return 0; }
int main() {}
Compiler command line: /Oi /Bv
(/Oi
enables intrinsic functions.)
Output:
error C2169: 'lrintf': intrinsic function, cannot be defined
Compiler version:
C:\data\msvc\14.28.29914\bin\Hostx64\x64\cl.exe: Version 19.28.29914.0
For the record, the lrintf
function from OpenJPEG was originally renamed to "opj_lrintf" by Matthieu Darbois (@mayeut), 26 July 2015, "Remove some warnings when building" https://github.com/uclouvain/openjpeg/commit/c423cc84e7be79051a7f9631fa26aa7d072361f2#diff-91c70438e617694516cb0ab60919517ff67034354cf73070cb243a7680411f89R126
This commit is included with OpenJPEG tag v2.1.1
This is really cool, thanks for sleuthing that out! So from my understanding:
Seems to make sense now why my previous build of SimpleElastix (on commit 2a79d151894021c66dceeb2c8a64ff61506e7155) with Visual Studio 2019 (MSVC 14.22.27905) worked, whereas my recent build on the same commit did not on MSVC 14.28.29910.
- OpenJPEG fixed this awhile back
- ITK ships an older version of OpenJPEG that did not include this fix
- The recent MSVC update now gives an error (eg as suggested in microsoft/vcpkg#16645 (comment))?
- The ITK PR fixed this issue for their version
@yoda-vid Well summarized, David 😃 By the way, ITK's fix is not entirely complete, as it defines opj_lrintf
for MSVC, but not for Clang and GCC. As I mentioned at https://github.com/InsightSoftwareConsortium/ITK/pull/2388#issuecomment-815633013 But in practice it doesn't matter much, I guess, because ITK does not use opj_lrintf
anyway 🤔
Good to know! At least we will have a place to start looking if the builds start to break on Clang or GCC.
Great, thanks @yoda-vid! Could you make the PR against develop instead of master? Develop was just updated to SimpleITK v2.0.2 and I hope to merge into master soon. Better check these changes are compatible :)
Thanks, @kaspermarstal ! I made a new PR on develop
: https://github.com/SuperElastix/SimpleElastix/pull/428 . Initially I tried to use the GitHub function to change the PR base here, but it didn't seem to update the base when I pulled it, so I just created a new PR instead.
Hi, not sure if this issue has solved or not for simpleElastix. I tried with both the master branch and the develop branch over the weekend, but the issue still exists. error C2169 repeated 19 times. Is there a solution? An old version (early 2020) of the package would also work for me. Is there a way to clone that? Thanks a million!
@davidweioct
Hi, not sure if this issue has solved or not for simpleElastix. I tried with both the master branch and the develop branch over the weekend, but the issue still exists. error C2169 repeated 19 times.
As a quick-fix you may simply remove both static lrintf
function definitions from you copy of ITK/Modules/ThirdParty/OpenJPEG/src/openjpeg/opj_includes.h The function isn't being called by anyway, neither by ITK nor by elastix.
HTH, Niels
As a quick-fix you may simply remove both static lrintf function definitions
This is good to know, thanks @N-Dekker!
Just to add on, the build is working in PR #428 on develop
(at least at the time of posting). I've checked it out locally by:
git fetch origin pull/428/head:test_pr428
git checkout test_pr428
(Assuming origin
points to the main repo.)
Thank you both @N-Dekker @yoda-vid .
I tried by commenting out those lines, and this works for me without any error.
This ITK update fixes a build error I encountered on Windows using Microsoft Visual Studio 16.9.3. The error occurs while compiling OpenJPEG for ITK with this message (multiple times):
This error appears to the be the same as the one fixed recently in ITK: https://github.com/InsightSoftwareConsortium/ITK/issues/1967 https://github.com/InsightSoftwareConsortium/ITK/pull/2388
I do not know of a way to pull this fix into SimpleElastix other than to pull in a more recent ITK commit (if there's another way, please let me know!). I simply bumped the tag from v5.1rc02 to v5.2.0 since this appears to be the only tag currently with this fix. I also found this update in SimpleITK (https://github.com/SimpleITK/SimpleITK/pull/1366), so feel free to ignore this PR if upstream SimpleITK will be pulled in anyway.
With this update, the ITK compilation completes. Note that I could not fully complete the SimpleElastix compilation until I also checked out the latest branch here,
update-simpleitk
, which I built on commit 175864a504abb7856432ef0c1308524f83e58f12 , to avoid an Elastix build error.I also had to use the official Cmake (tested on the latest version, v3.20.0) rather than MSVC Cmake (tested on v3.19.20122902-MSVC_2) to avoid an error when configuring Eigen3, which may be related to these issues: https://github.com/InsightSoftwareConsortium/ITK/issues/1888 https://github.com/ANTsX/ANTsR/issues/275