簡體   English   中英

在 Mac OS Monterey 上安裝英特爾的十進制浮點數學庫時出現問題

[英]Issues Installing Intel's Decimal Floating-Point Math Library on Mac OS Monterey

我正在嘗試在我的 Apple M1 Mac mini 和帶有運行 Mac OS Monterey 的英特爾 CPU 的舊 MacBook Pro 上安裝英特爾的十進制浮點數學庫 在嘗試從LIBRARY子文件夾運行推薦的RUNOSX bash 腳本時,我開始遇到幾個錯誤。 其中第一個是

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.

但是通過將建議的#include <stdlib.h>添加到有問題的文件(在本例中為src/bid64_pow.c )很容易解決這些問題。

修復上述問題后,出現以下錯誤,

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.

我無法修復。

由於該庫聲稱支持 Mac OSX,我有點驚訝即使在我的英特爾筆記本電腦上也不會立即安裝它而無需編輯源代碼。 也許那時我還缺少其他東西。 無論如何,請幫忙!

我沒有MAC操作系統。 但是我在 windows 嘗試了使用 cygwin(gcc.exe) 的示例代碼。 這是使用 raise 和您的宏的示例代碼。

#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
*/

如果您需要進一步的評論(來自其他人),請提供更多信息。 例子:

  1. 包括相關的 header 文件。
  2. 提供您正在使用的變量類型 (p)
  3. 您用於包含依賴庫的編譯選項(靜態/動態)
  4. 提供32/64位編譯信息及相關編譯器(C/C++, if C++ 提供-std=c++...版本)
  5. 嘗試編寫用於編譯的示例程序(以便您遵循 IT 的隱私政策)是否在外部共享您的代碼。 :) 提供相關的編譯錯誤/輸出(如果有)?

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM