Can't build pure-lang 0.64 with gcc > 4.9

Issue #37 closed
pSub
created an issue

Build fails with

Pure 0.64 is now configured for LLVM 3.5.0svn on x86_64-unknown-linux-gnu.

  Source directory:     .
  Installation prefix:  /nix/store/fcm76sg2jpwi20s1za4cr9psf9wl05sj-pure-0.64
  Versioned install:    no
  C compiler:           gcc -g0 -O3  -DNDEBUG -DDEBUG=0
  C++ compiler:         g++ -g -O2 -std=gnu++11 -g0 -O3  -DNDEBUG -DDEBUG=0
  Linker:               g++  -lm -lmpfr -lgmp 
  LLVM tool prefix:     
  Readline support: -lreadline
  Perl regex support:   no (use --with-pcre to enable)
  POSIX threads:    -pthread 
  Build libpure:        yes
  fastcc/TCO support:   yes

Now run 'make' to build everything, and 'make install' to install this
software on your system. To remove the installed software at a later
time use the 'make uninstall' command.

building
make flags: SHELL=/nix/store/3bi8j6baxqyx7hchcnjmjp194gh3g8g9-bash-4.3-p39/bin/bash    
g++ -g -O2 -std=gnu++11 -g0 -O3 -DNDEBUG -DDEBUG=0 -I/nix/store/9hx3vsq91hvbg255ih3zqm0gvv76r4wn-llvm-3.5.0/include    -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -pthread -I. -I. -DPURELIB='"/nix/store/fcm76sg2jpwi20s1za4cr9psf9wl05sj-pure-0.64/lib/pure"' -c -o pure.o pure.cc
g++ -g -O2 -std=gnu++11 -g0 -O3 -fPIC -DNDEBUG -DDEBUG=0 -I/nix/store/9hx3vsq91hvbg255ih3zqm0gvv76r4wn-llvm-3.5.0/include    -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I. -I. -c -o expr.o expr.cc
In file included from /nix/store/ircl89i32dvbpcw37l96jgwzcq5ymyhi-gmp-5.1.3/include/gmp.h:51:0,
                 from expr.hh:29,
                 from expr.cc:19:
/nix/store/8p0cgzn4azmn36fl29kkg9x17rmic4la-gcc-4.9.3/include/c++/4.9.3/cstddef:51:11: error: '::max_align_t' has not been declared
   using ::max_align_t;
           ^
In file included from /nix/store/9hx3vsq91hvbg255ih3zqm0gvv76r4wn-llvm-3.5.0/include/llvm/ADT/StringMap.h:18:0,
                 from /nix/store/9hx3vsq91hvbg255ih3zqm0gvv76r4wn-llvm-3.5.0/include/llvm/PassRegistry.h:23,
                 from /nix/store/9hx3vsq91hvbg255ih3zqm0gvv76r4wn-llvm-3.5.0/include/llvm/PassSupport.h:27,
                 from /nix/store/9hx3vsq91hvbg255ih3zqm0gvv76r4wn-llvm-3.5.0/include/llvm/Pass.h:377,
                 from /nix/store/9hx3vsq91hvbg255ih3zqm0gvv76r4wn-llvm-3.5.0/include/llvm/Target/TargetMachine.h:18,
                 from /nix/store/9hx3vsq91hvbg255ih3zqm0gvv76r4wn-llvm-3.5.0/include/llvm/ExecutionEngine/ExecutionEngine.h:26,
                 from interpreter.hh:22,
                 from expr.cc:20:
/nix/store/9hx3vsq91hvbg255ih3zqm0gvv76r4wn-llvm-3.5.0/include/llvm/Support/Allocator.h: In function 'void* operator new(size_t, llvm::BumpPtrAllocatorImpl<AllocatorT, SlabSize, SizeThreshold>&)':
/nix/store/9hx3vsq91hvbg255ih3zqm0gvv76r4wn-llvm-3.5.0/include/llvm/Support/Allocator.h:421:66: error: expected primary-expression before ',' token
       Size, std::min((size_t)llvm::NextPowerOf2(Size), offsetof(S, x)));
                                                                  ^
/nix/store/9hx3vsq91hvbg255ih3zqm0gvv76r4wn-llvm-3.5.0/include/llvm/Support/Allocator.h:421:68: error: 'x' was not declared in this scope
       Size, std::min((size_t)llvm::NextPowerOf2(Size), offsetof(S, x)));
                                                                    ^
/nix/store/9hx3vsq91hvbg255ih3zqm0gvv76r4wn-llvm-3.5.0/include/llvm/Support/Allocator.h:421:69: error: there are no arguments to 'offsetof' that depend on a template parameter, so a declaration of 'offsetof' must be available [-fpermissive]
       Size, std::min((size_t)llvm::NextPowerOf2(Size), offsetof(S, x)));
                                                                     ^
/nix/store/9hx3vsq91hvbg255ih3zqm0gvv76r4wn-llvm-3.5.0/include/llvm/Support/Allocator.h:421:69: note: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated)
Makefile:270: recipe for target 'expr.o' failed
make: *** [expr.o] Error 1
builder for ‘/nix/store/vnnciybv6vcwvgvqmn2nwmvgnikwnc0j-pure-0.64.drv’ failed with exit code 2

(full log: http://hydra.nixos.org/build/23533410/nixlog/1/raw)

I worked around this by

    for f in expr.cc matcher.cc printer.cc symtable.cc parserdefs.hh; do
      sed -i '1i\#include <stddef.h>' $f
    done

Using the information from https://gcc.gnu.org/gcc-4.9/porting_to.html

Comments (2)

  1. Albert Graef

    Looks like this is an intermittent problem with LLVM 3.5 from svn. Does this problem persist with the final LLVM 3.5.2 release? Running gcc 5.3.0 and LLVM 3.5.2 on Arch I can't reproduce the problem.

  2. Log in to comment