radio-astro-tools / casa-formats-io

Code to handle I/O from/to data in CASA format
Other
10 stars 7 forks source link

Added CI jobs that use conda compilers #52

Closed astrofrog closed 2 years ago

astrofrog commented 2 years ago

This re-uses an approach we developed in extension-helpers - I wonder whether issues such as https://github.com/radio-astro-tools/casa-formats-io/issues/48 are due to our C code not compiling properly with conda compilers - and in any case it's not a bad idea to have these jobs.

I do want to try and switch over the rest of the tests to the OA workflow but that's not urgent.

codecov-commenter commented 2 years ago

Codecov Report

Base: 46.04% // Head: 76.33% // Increases project coverage by +30.29% :tada:

Coverage data is based on head (95cb86c) compared to base (aae8c8c). Patch has no changes to coverable lines.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #52 +/- ## =========================================== + Coverage 46.04% 76.33% +30.29% =========================================== Files 18 17 -1 Lines 2235 1348 -887 =========================================== Hits 1029 1029 + Misses 1206 319 -887 ``` | [Impacted Files](https://codecov.io/gh/radio-astro-tools/casa-formats-io/pull/52?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=radio-astro-tools) | Coverage Δ | | |---|---|---| | [casa\_formats\_io/casa\_low\_level\_io.py](https://codecov.io/gh/radio-astro-tools/casa-formats-io/pull/52/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=radio-astro-tools#diff-Y2FzYV9mb3JtYXRzX2lvL2Nhc2FfbG93X2xldmVsX2lvLnB5) | | | Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=radio-astro-tools). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=radio-astro-tools)

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

astrofrog commented 2 years ago

Interestingly the compilation fails with the conda clang compiler:

clang-10 -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /Users/runner/work/casa-formats-io/casa-formats-io/.tox/py39-test-osxclang-conda/include -arch x86_64 -I/Users/runner/work/casa-formats-io/casa-formats-io/.tox/py39-test-osxclang-conda/include -fPIC -O2 -isystem /Users/runner/work/casa-formats-io/casa-formats-io/.tox/py39-test-osxclang-conda/include -arch x86_64 -I/private/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/pip-build-env-l_cyc01w/overlay/lib/python3.9/site-packages/numpy/core/include -I/Users/runner/work/casa-formats-io/casa-formats-io/.tox/py39-test-osxclang-conda/include/python3.9 -c casa_formats_io/_casa_chunking.c -o build/temp.macosx-10.9-x86_64-cpython-39/casa_formats_io/_casa_chunking.o
[271](https://github.com/radio-astro-tools/casa-formats-io/actions/runs/3112828612/jobs/5046700184#step:9:272)
      In file included from casa_formats_io/_casa_chunking.c:4:
[272](https://github.com/radio-astro-tools/casa-formats-io/actions/runs/3112828612/jobs/5046700184#step:9:273)
      /Users/runner/work/casa-formats-io/casa-formats-io/.tox/py39-test-osxclang-conda/include/python3.9/Python.h:25:10: fatal error: 'stdio.h' file not found
[273](https://github.com/radio-astro-tools/casa-formats-io/actions/runs/3112828612/jobs/5046700184#step:9:274)
      #include <stdio.h>
[274](https://github.com/radio-astro-tools/casa-formats-io/actions/runs/3112828612/jobs/5046700184#step:9:275)
               ^~~~~~~~~
[275](https://github.com/radio-astro-tools/casa-formats-io/actions/runs/3112828612/jobs/5046700184#step:9:276)
      1 error generated.

which I don't really understand as I thought stdio.h was pretty standard and is being included by Python header files. But this does seem similar to the error in e.g. https://github.com/radio-astro-tools/casa-formats-io/issues/23 (although there it was stdarg.h). Let's see what happens with the conda gcc build.

astrofrog commented 2 years ago

The conda-forge gcc works fine, so it seems it's clang from the default anaconda channel which has issues. I've found other issues complaining of broken conda compilers (e.g. https://github.com/davisking/dlib/issues/1525) so maybe this is beyond our control and not due to anything specifically in casa-formats-io.

With the v0.2 wheels, we should see fewer installation issues since fewer users will be installing from source, but users running into installation problems with the source build and using conda might need to switch what compiler they are using and report the issues to continuum?

I'll see if I can report the current clang failure here to the continuum folk.

astrofrog commented 2 years ago

I've emailed the anaconda maintainers with a link to this PR.

sumit0190 commented 2 years ago

There is nothing wrong with clang in this case; the problem is the missing sysroot. clang needs to know where to look at in order to find common headers. These headers usually reside in the SDK folders, commonly found by running xcrun -show-sdk-path -sdk macosx. For licensing reasons such files cannot be included as a part of clang or any other non-Apple package; see this link for details.

In order to fix this, you can explicitly point to the sysroot in your tox.ini file like so: CC=clang-10 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk

Of course, you'd have to point it to wherever your CI system installs the SDK for OSX. I verified that adding this line makes your error go away.

astrofrog commented 2 years ago

@sumit0190 - thank you for the detailed explanation! I'll try and wrap up the PR along the lines you suggest.

astrofrog commented 2 years ago

Well this hasn't revealed any issues with our extension though no harm in merging it to safeguard against future issues