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

"O. Hartmann" <[email protected]>
Newsgroups gmane.os.freebsd.performance,gmane.os.freebsd.devel.ports
Message-ID <[email protected]>
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
signature.asc (application/pgp-signature, 488 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.19 (FreeBSD)

iQEcBAEBAgAGBQJQSOtbAAoJEOgBcD7A/5N8GYMIAMcRzFu0/Mc8a1Jke+tO6gT4
QsPTDGUPJo+K8irt/tPXtMnV6jwYGpgSVlOt4QehZiwV822Y9IepXTT4snl2lVcc
OhjfWnLhiljTJF9fSlw6j4/4PP4L82oPXfGJKMhb4mv6XF7v2ySIk1qVvaTtXZSM
Rg4ToiYeD4/5xNf6GDTTU2cRWFDwV2g551jf9htH/WqJPYq51WjJ7BIeaklEmqds
rMg0l+e33jSBY9/qNdVVZrUlrS47QvLMBkc69TttwxGIAOAX13YdBSNuGdhB/yDo
/IpVbToGewqDKk7EAIbq1nWQUQ1drtzbkoLmpC+T3NvLwRPJf+4V3SG+SklWo3w=
=ixdR
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.