| 
    
 [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [UNIKRAFT/LIB-MUSL PATCH] math: Provide constants to Unikraft
 Hi,
I was trying to compile the maths library from musl when this error occurred:
/root/workspace/unikraft/apps/app/build/libmusl/origin/musl-1.1.19//src/math/cosf.c:21:12:
 error: ‘M_PI_2’ undeclared here (not in a function)
c1pio2 = 1*M_PI_2, /* 0x3FF921FB, 0x54442D18 */
           ^~~~~~
This constant is only provided when one of those definitions are provided, but 
I can simply define them if this is the better approach.
Thanks,
Alex
On 07.07.20, 10:58, "Minios-devel on behalf of Simon Kuenzer" 
<minios-devel-bounces@xxxxxxxxxxxxxxxxxxxx on behalf of 
simon.kuenzer@xxxxxxxxx> wrote:
    Hey Alex,
    which program has an issue with this? Shouldn't it define _XOPEN_SOURCE, 
_GNU_SOURCE, or _BSD_SOURCE in the sources before including <math.h>? I think 
we should not change this libc standard since it may break other programs.
    Thanks,
    Simon
    On 29.06.20, 21:05, "Alexander Jung" <a.jung@xxxxxxxxxxx> wrote:
        This patch modifes the math library to provide Mathematical constants
        such as Pi and e in the header <math.h>.
        Signed-off-by: Alexander Jung <a.jung@xxxxxxxxxxx>
        ---
         .../0008-math-Provide-constants-to-Unikraft.patch  | 29 
++++++++++++++++++++++
         1 file changed, 29 insertions(+)
         create mode 100644 
patches/0008-math-Provide-constants-to-Unikraft.patch
        diff --git a/patches/0008-math-Provide-constants-to-Unikraft.patch 
b/patches/0008-math-Provide-constants-to-Unikraft.patch
        new file mode 100644
        index 0000000..ba7282e
        --- /dev/null
        +++ b/patches/0008-math-Provide-constants-to-Unikraft.patch
        @@ -0,0 +1,29 @@
        +From 4f1964346aad513869a1543868847ade767130e2 Mon Sep 17 00:00:00 2001
        +From: Alexander Jung <alexander.jung@xxxxxxxxx>
        +Date: Mon, 29 Jun 2020 20:51:34 +0200
        +Subject: [PATCH] math: Provide constants to Unikraft
        +
        +This patch modifes the math library to provide Mathematical constants
        +such as Pi and e in the header <math.h>.
        +
        +Signed-off-by: Alexander Jung <alexander.jung@xxxxxxxxx>
        +---
        + include/math.h | 2 +-
        + 1 file changed, 1 insertion(+), 1 deletion(-)
        +
        +diff --git a/include/math.h b/include/math.h
        +index 6ac91da..d95e06d 100644
        +--- a/include/math.h
        ++++ b/include/math.h
        +@@ -354,7 +354,7 @@ long double truncl(long double);
        + #define MAXFLOAT        3.40282346638528859812e+38F
        + #endif
        + 
        +-#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || 
defined(_BSD_SOURCE)
        ++#if defined(__Unikraft__)
        + #define M_E             2.7182818284590452354   /* e */
        + #define M_LOG2E         1.4426950408889634074   /* log_2 e */
        + #define M_LOG10E        0.43429448190325182765  /* log_10 e */
        +-- 
        +2.20.1
        +
        -- 
        2.11.0
 
  | 
  
![]()  | 
            
         Lists.xenproject.org is hosted with RackSpace, monitoring our  |