HenrikBengtsson / affxparser

🔬 R package: This is the Bioconductor devel version of the affxparser package.
http://bioconductor.org/packages/devel/bioc/html/affxparser.html
7 stars 3 forks source link

error: use of undeclared identifier 'finite'; did you mean 'isfinite'? (was: OSX 10.9 (Mavericks) build generates concerning compile warnings) #6

Closed HenrikBengtsson closed 2 years ago

HenrikBengtsson commented 9 years ago

When building affxparser on OSX 10.9 (Mavericks), there lots of warnings are reported while compiling the native code, e.g.

fusion_sdk/calvin_files/data/src/CDFProbeSetInformation.cpp:109:15: 
warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
        if (groupIdx < 0 || groupIdx >= groupCnt)

and

fusion_sdk/util/Util.cpp:856:10: 
warning: 'finite' is deprecated: first deprecated in OS X 10.9 [-Wdeprecated-declarations]
  isOk = finite(x);

You can see them all at http://master.bioconductor.org/checkResults/devel/bioc-LATEST/affxparser/morelia-checksrc.html

These warnings do neither show up on other OSX version nor on other OSes, but they do look worrisome. Except from one:

R_affx_cdf_parser.cpp:169:31: warning: expression result unused [-Wunused-value]
        for(int i = 0; i++; i < length(unitIndices)) {

they're all related to fusion_sdk/ code.

@kasperdanielhansen, since you've navigated the Fusion SDK code more than I and are way more OSX savvy than I am, is this something you could look into?

HenrikBengtsson commented 9 years ago

I've fixed the error in R_affx_cdf_parser.cpp, cf. commit 9c40a84cef805d9b6f418b4a54e3f7598c455bb. It caused readCdf() and readCdfQc() to fail detecting out-of-range units, which in turn could lead to a core dump (at least on Windows). Added package tests for this.

The compile warning for this was more subtle on other OSes, i.e.

R_affx_cdf_parser.cpp:169: warning: value computed is not used
HenrikBengtsson commented 9 years ago

@kasperdanielhansen, I'll looked into more of these and some are obvious. I'll fix those and see what the Bioc checks will say. It might come down to me asking you to provide an updated set of /inst/info/fusion_1.1.2_patches/.

HenrikBengtsson commented 9 years ago

The remaining warnings (on OSX Mavericks) are now:

fusion_sdk/util/AffxConv.cpp:124:8:
warning: self-comparison always evaluates to false [-Wtautological-compare]
        if (i != i) {return "nan";}

fusion_sdk/util/Util.cpp:858:10:
warning: 'finite' is deprecated: first deprecated in OS X 10.9 [-Wdeprecated-declarations]
  isOk = finite(x);

/usr/include/math.h:718:12: 
note: 'finite' has been explicitly marked deprecated here
extern int finite(double) __OSX_AVAILABLE_BUT_DEPRECATED(
  __MAC_10_0, __MAC_10_9, __IPHONE_NA, __IPHONE_NA);

fusion_sdk/util/TableFile.h:231:8:
warning: private field 'm_Comment' is not used [-Wunused-private-field]
  char m_Comment;            ///< Comment character for data.
HenrikBengtsson commented 9 years ago

BTW, on Mac OS X Snow Leopard (10.6.8) / x86_64 there is a single compile warning on:

fusion_sdk/calvin_files/fusion/src/CalvinAdapter/CalvinCELDataAdapter.cpp: In member function ‘virtual int affymetrix_fusion_io::CalvinCELDataAdapter::GetCellMargin()’:
fusion_sdk/calvin_files/fusion/src/CalvinAdapter/CalvinCELDataAdapter.cpp:267: warning: control reaches end of non-void function

EDIT: This is a false warning; in all cases there is a return statement. Though, could add a fake return 0; at the end to please the compile.

HenrikBengtsson commented 8 years ago

Updated link to check results: http://master.bioconductor.org/checkResults/devel/bioc-LATEST/affxparser/oaxaca-checksrc.html

bjmt commented 3 years ago

Hi,

Not sure if I should make a new issue instead of dredging up an old one but the 'finite' is deprecated warning has now become an error (undeclared identifier) on my macbook pro M1 (macOS 11.2.3) when trying to compile the package. Using Apple clang 12.0.0 for arm64 with R 4.0.4. Please let me know if there's any other info I can provide that might be helpful.

HenrikBengtsson commented 3 years ago

Thanks for letting us know. I was dreading that this day would eventually come. I have to leave it to someone else to troubleshoot and patch this because I don't have access to macOS myself.

HenrikBengtsson commented 2 years ago

Just for the record, Simon Urbanek also reports/confirms that there is now an "error: use of undeclared identifier 'finite'; did you mean 'isfinite'?" and followed up with a confirmation that finite() is not part of C99.

From: Simon Urbanek Date: Wed, Sep 8, 2021 at 3:23 AM Subject: affxparser fails on macOS arm64 To: Henrik Bengtsson

Henrik,

I'm trying to get more CRAN packages to build on the M1 setup and this involves getting BioC into shape and I noticed that affxparser fails with:

clang++ -arch arm64 -std=gnu++14 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I. -Ifusion_sdk/calvin_files/array/src -Ifusion_sdk/calvin_files/data/src -Ifusion_sdk/calvin_files/exception/src -Ifusion_sdk/calvin_files/fusion/src -Ifusion_sdk/calvin_files/fusion/src/GCOSAdapter -Ifusion_sdk/calvin_files/fusion/src/CalvinAdapter -Ifusion_sdk/calvin_files/parameter/src -Ifusion_sdk/calvin_files/parsers/src -Ifusion_sdk/calvin_files/portability/src -Ifusion_sdk/calvin_files/template/src -Ifusion_sdk/calvin_files/utils/src -Ifusion_sdk/calvin_files/writers/src -Ifusion_sdk/file -Ifusion_sdk/file/TsvFile -Ifusion_sdk/portability -Ifusion_sdk/util -Ifusion_sdk -D_USE_MEMMAPPING -I/opt/R/arm64/include -fPIC -falign-functions=64 -Wall -g -O2 -Wno-sign-compare -O0 -c fusion_sdk/util/Util.cpp -o fusion_sdk/util/Util.o fusion_sdk/util/Util.cpp:858:10: error: use of undeclared identifier 'finite'; did you mean 'isfinite'? isOk = finite(x); ^~ isfinite /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/math.h:441:1: note: 'isfinite' declared here isfinite(_A1 __lcpp_x) _NOEXCEPT ^ 1 error generated. make: *** [fusion_sdk/util/Util.o] Error 1 ERROR: compilation failed for package ‘affxparser’

FWIW there is also

clang++ -arch arm64 -std=gnu++14 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I. -Ifusion_sdk/calvin_files/array/src -Ifusion_sdk/calvin_files/data/src -Ifusion_sdk/calvin_files/exception/src -Ifusion_sdk/calvin_files/fusion/src -Ifusion_sdk/calvin_files/fusion/src/GCOSAdapter -Ifusion_sdk/calvin_files/fusion/src/CalvinAdapter -Ifusion_sdk/calvin_files/parameter/src -Ifusion_sdk/calvin_files/parsers/src -Ifusion_sdk/calvin_files/portability/src -Ifusion_sdk/calvin_files/template/src -Ifusion_sdk/calvin_files/utils/src -Ifusion_sdk/calvin_files/writers/src -Ifusion_sdk/file -Ifusion_sdk/file/TsvFile -Ifusion_sdk/portability -Ifusion_sdk/util -Ifusion_sdk -D_USE_MEMMAPPING -I/opt/R/arm64/include -fPIC -falign-functions=64 -Wall -g -O2 -Wno-sign-compare -O0 -c fusion_sdk/util/AffxConv.cpp -o fusion_sdk/util/AffxConv.o fusion_sdk/util/AffxConv.cpp:124:8: warning: self-comparison always evaluates to false [-Wtautological-compare] if (i != i) {return "nan";} ^ 1 warning generated.

Since there are dependencies, it would be nice if there was a way to fix that.

Thanks, Simon

From: Simon Urbanek Date: Wed, Sep 8, 2021 at 2:48 AM Subject: Re: affxparser fails on macOS arm64 To: Henrik Bengtsson

FWIW I looked and it is a genuine bug - math.h and cmath only define isfinite(x) [defined since C99] - there is no such thing as finite(x) in the standards. The other warning is a benign dead code since it works on an integer which can never be NaN.

It means I was able to get it to work by hand with PKG_CXXFLAGS=-Dfinite=isfinite but for the package to build on BioC you probably want to fix it in the sources.

Cheers, Simon

HenrikBengtsson commented 2 years ago

Fixed and live now.