<div dir="ltr"><div><div><div><div><div>Hi,<br><br>I am currently looking into porting beignet over to FreeBSD. My motivation is strictly based on wanting to use my preferred system for OpenCL development so please bear with me that I am a bit shaky in some stuff especially in the grittier C++ details...<br><br></div>I should start by saying in general the "graphics" support within FreeBSD is currently lagging behind Linux a bit but we are fortunate to have a few talented and driven developers working on that and hopefully changing that eventually (I am not one of them :-) ).<br><br></div>Please find attached a few patches that enable configuring and the first few compilations on FreeBSD. Namely, those are:<br><br>* FindLLVM.patch: adds FreeBSD names of llvm-config to the search list (both llvm 3.4 and 3.5).<br></div><br>* alloc.patch: for backend/src/sys/alloc.cpp , adds a FreeBSD clause to the alignedMalloc function, using the POSIX standard function posix_memalign.<br><br></div>My next issue is the hash_map.hpp. You use std::tr1::unordered_map while FreeBSD (according to my research) requires the use of std::unordered_map instead (see a patch to that extend attached as hash_map.patch). However, I am uncertain as I get the following errors at compile time:<br><br>[  8%] Building CXX object backend/src/CMakeFiles/gbe.dir/ir/unit.cpp.o<br>cd /usr/home/sid/software/beignet/build/backend/src && /usr/local/bin/clang++34   -DEMULATE_GEN=0 -DGEN7_SAMPLER_CLAMP_BORDER_WORKAROUND -DUSE_FULSIM=0 -Dgbe_EXPORTS -funroll-loops -fstrict-aliasing -msse2 -msse3 -mssse3 -msse4.1 -fPIC -Wall -mfpmath=sse -Wcast-align -Wl,-E -std=c++0x -Wno-invalid-offsetof -fno-rtti -I/usr/local/llvm34/include  -DNDEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -DGBE_DEBUG_MEMORY=0  -DGBE_COMPILER_AVAILABLE=1 -fvisibility=hidden -O2 -g -DGBE_DEBUG=1 -fPIC -I/usr/home/sid/software/beignet/build -I/usr/home/sid/software/beignet -I/usr/local/include -I/usr/local/include/libdrm -I/usr/home/sid/software/beignet/build/backend -I/usr/home/sid/software/beignet/backend/src/.    -D__sid__ -DLLVM_34 -o CMakeFiles/gbe.dir/ir/unit.cpp.o -c /usr/home/sid/software/beignet/backend/src/ir/unit.cpp<br>clang: warning: -Wl,-E: 'linker' input unused<br>In file included from /usr/home/sid/software/beignet/backend/src/ir/unit.cpp:24:<br>In file included from /usr/home/sid/software/beignet/backend/src/./ir/unit.hpp:27:<br>In file included from /usr/home/sid/software/beignet/backend/src/./ir/constant.hpp:28:<br>In file included from /usr/home/sid/software/beignet/backend/src/./sys/vector.hpp:28:<br>In file included from /usr/home/sid/software/beignet/backend/src/./sys/platform.hpp:26:<br>In file included from /usr/include/c++/v1/iostream:38:<br>In file included from /usr/include/c++/v1/ios:216:<br>In file included from /usr/include/c++/v1/__locale:15:<br>In file included from /usr/include/c++/v1/string:439:<br>In file included from /usr/include/c++/v1/algorithm:627:<br>/usr/include/c++/v1/memory:1568:28: error: cannot initialize a parameter of type 'pointer' (aka 'std::__1::__hash_node<std::__1::__hash_value_type<std::__1::basic_string<char, std::__1::char_traits<char>,<br>      std::__1::allocator<char> >, gbe::ir::Function *>, void *> *') with an lvalue of type 'gbe::ir::Function **'<br>            {__a.construct(__p, _VSTD::forward<_Args>(__args)...);}<br>                           ^~~<br>/usr/include/c++/v1/memory:1449:14: note: in instantiation of function template specialization 'std::__1::allocator_traits<gbe::Allocator<std::__1::__hash_node<std::__1::__hash_value_type<std::__1::basic_string<char,<br>      std::__1::char_traits<char>, std::__1::allocator<char> >, gbe::ir::Function *>, void *> > >::__construct<gbe::ir::Function *>' requested here<br>            {__construct(__has_construct<allocator_type, pointer, _Args...>(),<br>             ^<br>/usr/include/c++/v1/tr1/unordered_map:1340:20: note: in instantiation of function template specialization<br>      'std::__1::allocator_traits<gbe::Allocator<std::__1::__hash_node<std::__1::__hash_value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, gbe::ir::Function *>, void *> ><br>      >::construct<gbe::ir::Function *>' requested here<br>    __node_traits::construct(__na, _VSTD::addressof(__h->__value_.__cc.second));<br>                   ^<br>/usr/include/c++/v1/tr1/unordered_map:1363:25: note: in instantiation of member function 'std::__1::unordered_map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, gbe::ir::Function *,<br>      std::__1::hash<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::equal_to<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >,<br>      gbe::Allocator<std::__1::pair<const std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, gbe::ir::Function *> > >::__construct_node_with_key' requested here<br>    __node_holder __h = __construct_node_with_key(__k);<br>                        ^<br>/usr/home/sid/software/beignet/backend/src/ir/unit.cpp:45:14: note: in instantiation of member function 'std::__1::unordered_map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >,<br>      gbe::ir::Function *, std::__1::hash<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::equal_to<std::__1::basic_string<char, std::__1::char_traits<char>,<br>      std::__1::allocator<char> > >, gbe::Allocator<std::__1::pair<const std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, gbe::ir::Function *> > >::operator[]' requested here<br>    functions[name] = fn;<br>             ^<br>/usr/home/sid/software/beignet/backend/src/./sys/alloc.hpp:159:35: note: passing argument to parameter 'p' here<br>    INLINE void construct(pointer p, const T& t = T()) { ::new(p) T(t); }<br>                                  ^<br>1 error generated.<br>*** Error code 1<br><br>Stop.<br>make[2]: stopped in /usr/home/sid/software/beignet/build<br>*** Error code 1<br><br>Stop.<br><br></div><div>I hope somebody can shed some light on what the cause of this is and where I can look to fix this! :-)<br><br></div><div>Thanks a lot!<br><br></div><div>Johannes<br></div><div><br></div></div>