Home > Mobile >  Issues Installing Intel's Decimal Floating-Point Math Library on Mac OS Monterey
Issues Installing Intel's Decimal Floating-Point Math Library on Mac OS Monterey

Time:08-30

I'm trying to install Intel's Decimal Floating-Point Math Library both on my Apple M1 Mac mini and an older MacBook Pro with an intel CPU both running Mac OS Monterey. In trying to run the recommended RUNOSX bash script from the LIBRARY subfolder I begin encountering several errors. The first of which are

src/bid64_pow.c:183:17: error: implicitly declaring library function 'abs' with type 'int (int)' [-Werror,-Wimplicit-function-declaration]
      exact_y = abs(exact_y);
src/bid64_pow.c:183:17: note: include the header <stdlib.h> or explicitly provide a declaration for 'abs'
      1 error generated.

but which are easily fixed by adding the suggested #include <stdlib.h> to the offending files (in this case, src/bid64_pow.c).

After fixing the above, I get the following errors,

float128/dpml_exception.c:186:13: error: implicit declaration of function 'raise' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
            DPML_SIGNAL(p);
            ^
float128/dpml_exception.c:135:28: note: expanded from macro 'DPML_SIGNAL'
#   define DPML_SIGNAL(p)        raise(SIGFPE)
                                 ^
1 error generated.

which I'm unable to fix.

Since the library claims to support Mac OSX, I'm a bit surprised that it wouldn't install right off the bat even on my intel laptop without having to edit the source code. Perhaps then I'm missing something else. In any case, please help!

CodePudding user response:

I don't have MAC os. However I tried sample code using cygwin(gcc.exe) at windows. Here goes sample code using raise and your macro.

#include <stdio.h>
#include <signal.h>             // TO USE raise
#   define DPML_SIGNAL(p)        raise(SIGFPE)
void mysig( int sig)
{
        switch( sig )
        {
                case SIGFPE:
                        printf( "mysig SIGFPE\n");
                        break;
                default:
                        printf( "mysig other signal\n");
        }
        return;
}
int main()
{
        #define p SIGFPE
        signal( p, mysig);
        DPML_SIGNAL(p);
        return 0;
}
/*
$ gcc raise.c -Wall -o ./a.out
$ ./a.out
mysig SIGFPE
OR
C:> gcc.exe raise.c -Wall -o .\a.out
C:> .\a.out
mysig SIGFPE
C:> ldd.exe a.out
ntdll.dll => /cygdrive/c/Windows/SYSTEM32/ntdll.dll
KERNEL32.DLL => /cygdrive/c/Windows/System32/KERNEL32.DLL
KERNELBASE.dll => /cygdrive/c/Windows/System32/KERNELBASE.dll
cygwin1.dll => /usr/bin/cygwin1.dll
*/

If you need further comments(from others), provide more information. Example:

  1. Including related header file.
  2. provide type of variable you are using (p)
  3. compilation option you are using to include dependent libraries(static/dynamic)
  4. provide 32/64 bit compilation information and related compiler(C/C , if C provide -std=c ... version)
  5. Try writing sample program for compilation(for you to follow privacy policy of your IT) whether/not to share your code outside. :) Provide related compilation error/output if any?
  • Related