root icon indicating copy to clipboard operation
root copied to clipboard

Cling not recognizing __sincospif on MacOS (from math.h)

Open pcanal opened this issue 1 year ago • 1 comments

Check duplicate issues.

  • [ ] Checked for duplicates

Description

Cling is not seeing of the content of math.h on MacOS.

Reproducer

With the file header.h

#include <math.h>

void func()
{
   float a = 0, b = 0, c = 0;
   __sincospif(a, &b, &c);
}

the file compiles:

clang++ -c header.h 
clang: warning: treating 'c-header' input as 'c++-header' when in C++ mode, this behavior is deprecated [-Wdeprecated]

but fails to be parsed by Cling (well rootcling)

rootcling -f dict.cxx header.h
In file included from input_line_8:3:
header.h:6:4: error: use of undeclared identifier '__sincospif'
   __sincospif(a, &b, &c);
   ^
Error: rootcling: compilation failure (dict51adc8b8cb_dictUmbrella.h)

ROOT version

Tested on master likely also on older releases.

Installation method

manual build and/or spack

Operating system

MacOS

Additional context

No response

pcanal avatar Jan 25 '24 16:01 pcanal

adding @devajithvs , maybe he has ideas.

dpiparo avatar May 22 '24 08:05 dpiparo

It works on master and 6.34 on macOS 15. It's likely that the evolution of the interpreter fixed it - at this point, once a test is added, the issue can be closed.

dpiparo avatar Mar 19 '25 21:03 dpiparo

Hi @dpiparo @devajithvs @pcanal @vgvassilev I was thinking on this, if we will add a test for this, the CI would run it on all the operating systems, so would it not fail for all of them and just pass on Mac OS?

Some online resources state that __sincospif is macOS specific and some state that it is provided by CUDA, and some state that is just a function which is called to improve performance... I Would love to know more about this!

Aditya-138-12 avatar Apr 22 '25 16:04 Aditya-138-12

I also tried compiling this on Ubuntu 24.04.2 LTS, and got this error

Image

Aditya-138-12 avatar Apr 22 '25 17:04 Aditya-138-12