Re: problem building sparse 0.6.0 (sparse-llvm)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 26/04/2019 03:44, Randy Dunlap wrote:
> On 4/25/19 6:55 PM, Randy Dunlap wrote:
>> Hi,
>>
>> I'm trying to build 0.6.0 and I get these error messages:
>>
>>   CC      sparse-llvm.o
>> In file included from /usr/include/llvm-c/Types.h:17:0,
>>                  from /usr/include/llvm-c/ErrorHandling.h:17,
>>                  from /usr/include/llvm-c/Core.h:18,
>>                  from sparse-llvm.c:6:
>> /usr/include/llvm/Support/DataTypes.h:57:3: error: #error "Must #define __STDC_LIMIT_MACROS before #including Support/DataTypes.h"
>>  # error "Must #define __STDC_LIMIT_MACROS before #including Support/DataTypes.h"
>>    ^
>> /usr/include/llvm/Support/DataTypes.h:61:3: error: #error "Must #define __STDC_CONSTANT_MACROS before " "#including Support/DataTypes.h"
>>  # error "Must #define __STDC_CONSTANT_MACROS before " \
>>    ^
>> Makefile:206: recipe for target 'sparse-llvm.o' failed
>>
>>
>> Any hints or help on that?
>>
>> thanks.
>>
> 
> This is what I did to build sparse-llvm.  FWIW.
> 
> ---
> From: Randy Dunlap <rdunlap@xxxxxxxxxxxxx>
> 
> Certain macros have to be defined in order to use the llvm
> DataTypes.h header file.  Fixes these build errors when building
> sparse-llvm:
> 
>   CC      sparse-llvm.o
> In file included from /usr/include/llvm-c/Types.h:17:0,
>                  from /usr/include/llvm-c/ErrorHandling.h:17,
>                  from /usr/include/llvm-c/Core.h:18,
>                  from sparse-llvm.c:6:
> /usr/include/llvm/Support/DataTypes.h:57:3: error: #error "Must #define __STDC_LIMIT_MACROS before #including Support/DataTypes.h"
>  # error "Must #define __STDC_LIMIT_MACROS before #including Support/DataTypes.h"
>    ^
> /usr/include/llvm/Support/DataTypes.h:61:3: error: #error "Must #define __STDC_CONSTANT_MACROS before " "#including Support/DataTypes.h"
>  # error "Must #define __STDC_CONSTANT_MACROS before " \
>    ^
> 
> This is from using llvm 3.8.0.
> 
> Signed-off-by: Randy Dunlap <rdunlap@xxxxxxxxxxxxx>
> ---
>  Makefile |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> --- sparse-0.6.0.orig/Makefile
> +++ sparse-0.6.0/Makefile
> @@ -160,7 +160,8 @@ ifeq ($(shell expr "$(LLVM_VERSION)" : '
>  LLVM_PROGS := sparse-llvm
>  $(LLVM_PROGS): LD := g++
>  LLVM_LDFLAGS := $(shell $(LLVM_CONFIG) --ldflags)
> -LLVM_CFLAGS := -I$(shell $(LLVM_CONFIG) --includedir)
> +LLVM_CFLAGS := -I$(shell $(LLVM_CONFIG) --includedir) \
> +	-D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS

Hmm, I only build sparse-llvm on cygwin these days (I don't have
llvm installed on Linux at the moment). You didn't say which system
and versions of OS, compiler and llvm you are using.

However, I think it may be more appropriate to add:

    $(shell $(LLVM_CONFIG) --cppflags)

rather than these specific '-D'efines.

On cygwin, for example, I see:

  $ llvm-config --cppflags
-I/usr/include   -DLLVM_BUILD_GLOBAL_ISEL -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
  $ 

Looking at the cygwin header files, they automatically #define
these same macros before the '#include <stdint.h>', so this
addition to the Makefile is not required there ... :-D

[assuming that works for you, of course! hint, hint ;-) ]

ATB,
Ramsay Jones

>  LLVM_LIBS := $(shell $(LLVM_CONFIG) --libs)
>  LLVM_LIBS += $(shell $(LLVM_CONFIG) --system-libs 2>/dev/null)
>  LLVM_LIBS += $(shell $(LLVM_CONFIG) --cxxflags | grep -F -q -e '-stdlib=libc++' && echo -lc++)
> 
> 



[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux