Error building functions branch

When I build the function branch on macOS I get this error:

/Users/wouter/Documents/Blender/Functions/blender/source/blender/functions/backends/llvm/builder.hpp:4:10: fatal error: 
      'llvm/IR/IRBuilder.h' file not found
#include <llvm/IR/IRBuilder.h>
1 Like

I got a new error:

In file included from /Users/wouter/Documents/Blender/functions/blender/source/blender/blenlib/intern/BLI_range.cpp:1:
/Users/wouter/Documents/Blender/functions/blender/source/blender/blenlib/BLI_range.hpp:135:24: error: no member named 'ceil' in namespace 'std'; did
      you mean simply 'ceil'?
        m_chunk_amount(std::ceil(m_total_range.size() / (float)m_chunk_size))
                       ^~~~~~~~~
                       ceil
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/math.h:841:1: note: 'ceil' declared here
ceil(_A1 __lcpp_x) _NOEXCEPT {return ::ceil((double)__lcpp_x);}
^
1 error generated.

does it help if you put a

#include <cmath>

at the top of BLI_range.hpp ?

it does resolve the error but I’ve got some new ones

/Users/wouter/Documents/Blender/functions/blender/source/blender/blenlib/BLI_math.hpp:82:10: error: call to 'abs' is ambiguous
x = (std::abs(x) < eps) ? 0.0f : x;
     ^~~~~~~~

/Users/wouter/Documents/Blender/functions/blender/source/blender/blenlib/BLI_math.hpp:83:10: error: call to 'abs' is ambiguous
y = (std::abs(y) < eps) ? 0.0f : y;
     ^~~~~~~~

/Users/wouter/Documents/Blender/functions/blender/source/blender/blenlib/BLI_math.hpp:84:10: error: call to 'abs' is ambiguous
z = (std::abs(z) < eps) ? 0.0f : z;
     ^~~~~~~~

Yeah it may do this a few times so ill tell you the way to trouble shoot this.

  1. on cppreference search for std::abs or anything else it is confused about.

  2. it’ll give you some results, abs(float) sounds interesting, lets click on that

near the top of the page it will mention

Defined in header <cmath>
Defined in header <cstdlib> (since C++17)

so in this case, BLI_math.hpp probably needs an #include <cmath> as well.

thanks for helping out.

Only BLI_math.hpp and BLI_range.hpp had to be edited. But when building is almost done, I get a error related to llvm again:

[100%] Linking CXX executable ../../bin/Blender.app/Contents/MacOS/Blender
Undefined symbols for architecture x86_64:
  "llvm::EnableABIBreakingChecks", referenced from:
      llvm::VerifyEnableABIBreakingChecks in libbf_functions.a(initialize.cpp.o)
      llvm::VerifyEnableABIBreakingChecks in libbf_functions.a(function_generation.cpp.o)
      llvm::VerifyEnableABIBreakingChecks in libbf_functions.a(numeric.cpp.o)
      llvm::VerifyEnableABIBreakingChecks in libbf_functions.a(numeric_lists.cpp.o)
      llvm::VerifyEnableABIBreakingChecks in libbf_functions.a(llvm_types.cpp.o)
      llvm::VerifyEnableABIBreakingChecks in libbf_functions.a(fgraph_tuple_call.cpp.o)
      llvm::VerifyEnableABIBreakingChecks in libbf_functions.a(fgraph_ir_generation.cpp.o)
      ...
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

seems to be the same issue as this post

Last week I finally managed to make a successful build. But this week a new build error showed up:

/Users/wouter/Documents/Blender/functions/blender/source/blender/blenlib/BLI_monotonic_allocator.hpp:73:58: error: 
      non-const lvalue reference to type 'size_t' (aka 'unsigned long') cannot
      bind to a value of unrelated type 'uint64_t' (aka 'unsigned long long')
    void *aligned_ptr = std::align(alignment, size, ptr, space);
                                                         ^~~~~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/memory:5592:81: note: 
      passing argument to parameter '__space' here
  ...void* align(size_t __align, size_t __sz, void*& __ptr, size_t& __space);
                                                                    ^
1 error generated.

I will fix this today.

[EDIT] should be fixed now.

Thanks for the quick fix

New week, new error

/Users/wouter/Documents/Blender/functions/blender/source/blender/blenlib/BLI_string_map.hpp:314:52: error:
constexpr function’s 1st parameter type ‘BLI::StringRef’ is not a literal
type
constexpr uint32_t compute_string_hash(StringRef key) const
~~~~~~~~^
/Users/wouter/Documents/Blender/functions/blender/source/blender/blenlib/BLI_string_ref.hpp:139:7: note:
‘StringRef’ is not literal because it is not an aggregate and has no
constexpr constructors other than copy or move constructors
class StringRef : public StringRefBase {
^
1 error generated.

Thanks, will upload a fix in a couple of minutes. Would be nice if you could just contact me in blender.chat if you encounter build errors.