Help. Porting "FreeOCL" fails (atomic_ops.h missing, CLANG++ libc++ issues ...)

O. Hartmann ohartman at zedat.fu-berlin.de
Thu Sep 6 18:28:45 UTC 2012


On 09/06/12 14:51, Dimitry Andric wrote:
> On 2012-09-05 16:45, O. Hartmann wrote:
> ...
>> Well, I tried LLVM/CLANG, but Cmake of the sources fairly fails many
>> checks especuially for OpenMP.
> 
> Yes, it is currently not supported.  I am not sure if there are serious
> attempts to add it.
> 
> 
>> Using clang++ requisites the usage of the
>> new libc++ (CXXFLAGS+= -stdlib=libc++). But this fails with this error:
> ...
>> /usr/ports/devel/freeocl/work/FreeOCL-0.3.6-Source/src/parser/parser.h:118:15:
>>
>> error: no viable conversion from 'std::__1::basic_istream<char>' to
>> 'const bool'
>>                          const bool ok = in.get(c);
>>                                     ^    ~~~~~~~~~
> 
> This is a bug in FreeOCL.  The istream::get() function returns an
> istream reference, which can't be cast directly to bool.  However, there
> is a negation operator defined for istream, so the line can be changed
> to:
> 
>                          const bool ok = !!in.get(c);
> 
> I have attached a patch for the port as I have built it here with clang.
> I didn't add the dependency on atomic_ops yet, but it should be fairly
> trivial.
> 
> Note I also needed a fix for Mk/bsd.cmake.mk, otherwise the required
> ${CPPFLAGS} would not be passed along to CMake, and then the build would
> still fail to find the atomic_ops headers in /usr/local/include.


With the patch for Mk/bsd.cmake.mk attached, I can not compile the port
with CLANG, compilation results in

[ 15%] Building CXX object src/CMakeFiles/FreeOCL.dir/image.cpp.o
/usr/ports/devel/freeocl/work/FreeOCL-0.3.6-Source/src/image.cpp:442:27:
error: member access into incomplete type 'struct _cl_event'
                                if (event_wait_list[i]->status < 0)
                                                      ^
/usr/local/include/CL/cl.h:46:16: note: forward declaration of '_cl_event'
typedef struct _cl_event *          cl_event;
               ^
/usr/ports/devel/freeocl/work/FreeOCL-0.3.6-Source/src/image.cpp:449:58:
error: allocation of incomplete type '_cl_event'
                cmd->event = (blocking_read == CL_TRUE || event) ? new
_cl_event(command_queue->context) : NULL;

^~~~~~~~~
/usr/local/include/CL/cl.h:46:16: note: forward declaration of '_cl_event'
typedef struct _cl_event *          cl_event;
               ^
/usr/ports/devel/freeocl/work/FreeOCL-0.3.6-Source/src/image.cpp:463:14:
error: member access into incomplete type '_cl_event'
                        cmd->event->command_queue = command_queue;
                                  ^
/usr/local/include/CL/cl.h:46:16: note: forward declaration of '_cl_event'
typedef struct _cl_event *          cl_event;
               ^
/usr/ports/devel/freeocl/work/FreeOCL-0.3.6-Source/src/image.cpp:464:14:
error: member access into incomplete type '_cl_event'
                        cmd->event->command_type = CL_COMMAND_READ_IMAGE;
                                  ^
/usr/local/include/CL/cl.h:46:16: note: forward declaration of '_cl_event'
typedef struct _cl_event *          cl_event;


Without the patch, CLANG++ doesn't find the atomic_ops.h header as you
wrote.

Oliver

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
Url : http://lists.freebsd.org/pipermail/freebsd-performance/attachments/20120906/ba40a231/signature.pgp


More information about the freebsd-performance mailing list