[cfe-dev] OpenCL : invalid operands to binary expression

Xiuxia Zhang zhangxiuxia1 at gmail.com
Tue Apr 22 10:45:34 PDT 2014


Hi Sam,
        After I remove the  /usr/include path.
5 kinds of errors dispear.  But there is still one error left,
 /sandbox/xiuxia/llvm_build/Debug+Asserts/lib/clang/3.4/include/mm_malloc.h:27:10:
fatal error: 'stdlib.h' file not found.

stdlib is under /usr/include , and it include lots of other heads which is
also located in /usr/include.

Thanks,
Xiuxia


On Tue, Apr 22, 2014 at 10:53 AM, Sam Parker <S.Parker3 at lboro.ac.uk> wrote:

> Ok, so we're getting somewhere! i'd remove the /usr/include from your
> search path too, i suspect there's a conflict and kernels shouldn't need
> anything that
> isn't included from clc.h - i think.
>
> Looking at your kernels, I'd also remove the includes too. and if
> MMD_floatK3 are just a renaming for float3 - why not just use the float3
> specifier?
>
> hope that helps,
> sam
>
> Sam Parker
> Research Student
> Electronic Systems Design Group
> Loughborough University
> UK
>
> ________________________________________
> From: Xiuxia Zhang [zhangxiuxia1 at gmail.com]
> Sent: 22 April 2014 16:13
> To: Sam Parker
> Cc: cfe-dev at cs.uiuc.edu
> Subject: Re: [cfe-dev] OpenCL : invalid operands to binary expression
>
> Hi Sam,
>     Thanks for your advice.   I've tried to include clang header path
> instead of gcc header, and it works, and the  compiler doesn't complain the
> following 2 kinds of  errors anymore:
>  1. unknown builtin '__builtin_ia32_cmpneqps'
>  2.  error: invalid conversion between vector type '__m128' and integer
> type 'int' of different size
>
> However  there are some other 5 kinds of errors  reported as before,
>  /usr/include/stdlib.h:337:4: error: unknown type name 'size_t'; did you
> mean 'ssize_t'?
>
> /usr/include/stdlib.h:857:20: error: unknown type name 'wchar_t'
>
> /sandbox/xiuxia/llvm_build/Debug+Asserts/lib/clang/3.4/include/mm_malloc.h:33:44:
> error: unknown type name 'size_t'; did you mean 'ssize_t'?
>
> /usr/include/CL/cl.h:562:17: error: redefinition of parameter 'size_t'
> /sandbox/xiuxia/libclc/libclc/generic/include/clc/integer/abs.inc:1:41:
> error: conflicting types for 'abs'
>
> atom_kernel.h:45:24: error: invalid operands to binary expression
> ('MMD_floatK3' (aka 'struct sdouble3') and 'MMD_floatK3')
>
>
> I am not very familiar with clang,  and find it is difficult to find
> materials about how to learning clang. I feel perplexed when encounter this
> kind of problems.  Hope you could give me some suggestions.
>
>
> Best,
> Xiuxia
>
>
> On Tue, Apr 22, 2014 at 5:36 AM, Sam Parker <S.Parker3 at lboro.ac.uk<mailto:
> S.Parker3 at lboro.ac.uk>> wrote:
> Hi,
>
> Have you ensured you are meeting this requirement?
>
>     // <Warning!!> -- Platform Specific Code lives here
>     // This depends on A) that you're running linux and
>     // B) that you have the same GCC LIBs installed that
>     // I do.
>     // Search through Clang itself for something like this,
>     // go on, you won't find it. The reason why is Clang
>     // has its own versions of std* which are installed under
>     // /usr/local/lib/clang/<version>/include/
>     // See somewhere around Driver.cpp:77 to see Clang adding
>     // its version of the headers to its include path.
>
> you're using the gcc include path, and i've always used the clang path
> instead.
>
> cheers,
> sam
>
> Sam Parker
> Research Student
> Electronic Systems Design Group
> Loughborough University
> UK
>
> ________________________________________
> From: cfe-dev-bounces at cs.uiuc.edu<mailto:cfe-dev-bounces at cs.uiuc.edu> [
> cfe-dev-bounces at cs.uiuc.edu<mailto:cfe-dev-bounces at cs.uiuc.edu>] on
> behalf of Xiuxia [zhangxiuxia1 at gmail.com<mailto:zhangxiuxia1 at gmail.com>]
> Sent: 22 April 2014 00:30
> To: cfe-dev at cs.uiuc.edu<mailto:cfe-dev at cs.uiuc.edu>
> Subject: Re: [cfe-dev] OpenCL : invalid operands to binary expression
>
> Hi Sam,
>    Thanks for your reply and suggestions.
> I followed your suggestion, and add necessary source code to CI_opencl.cpp
> and input file.  However there are same problems.
>
>
> Here is my input file(atom_kernel.h) and clang consumer file(CI_opencl.cpp)
> and error output (error.output). Makefile is the same.
>
> almost the same error. Compiler still complain types and sse instructions
> missing.
>
>
> Thanks,
> Xiuxia
>
>
> On Mon, Apr 21, 2014 at 4:40 PM, Sam Parker [via Clang Developers] <
> ml-node+s42468n4038933h96 at n3.nabble.com<mailto:
> ml-node%2Bs42468n4038933h96 at n3.nabble.com>> wrote:
>
> > Hi,
> >
> > Ok, I though you were just trying to compile on the command line...
> > Haven't checked this, but something along like this should work:
> >
> > Invocation->setLangDefaults(langOpts,
> >                               clang::IK_CXX,
> >      // change to clang::IK_OpenCL
> >                               clang::LangStandard::lang_opencl);
> >
> > And grab the opencl header files from libclc.llvm.org<
> http://libclc.llvm.org> and add these to
> > your search path:
> > hso->AddPath("/path/to/libclc/headers", clang::frontend::Angled, false,
> > false);
> >
> > and you'll also have to enable the storage classes:
> >
> ci.getPreprocessorOpts().addMacroDef("cl_clang_storage_class_specifiers");
> >
> > good luck,
> > Sam
> >
> > Sam Parker
> > Research Student
> > Electronic Systems Design Group
> > Loughborough University
> > UK
> >
> > ________________________________________
> > From: [hidden email]<
> http://user/SendEmail.jtp?type=node&node=4038933&i=0>[[hidden
> > email] <http://user/SendEmail.jtp?type=node&node=4038933&i=1>] on behalf
> > of Xiuxia [[hidden email]<
> http://user/SendEmail.jtp?type=node&node=4038933&i=2>]
> >
> > Sent: 21 April 2014 17:20
> > To: [hidden email] <http://user/SendEmail.jtp?type=node&node=4038933&i=3
> >
> > Subject: Re: [cfe-dev] OpenCL :  invalid operands to binary expression
> >
> > Hi Sam,
> >        I am using clang3.4 version.
> > My makefile is
> >
> > CXX := clang++
> > LLVMCOMPONENTS := cppbackend
> > RTTIFLAG := -fno-rtti
> > LLVMCONFIG := /sandbox/xiuxia/llvm_build/Debug+Asserts/bin/llvm-config
> >
> > CXXFLAGS := -I$(shell $(LLVMCONFIG) --src-root)/tools/clang/include
> > -I$(shell $(LLVMCONFIG) --obj-root)/tools/clang/include $(shell
> > $(LLVMCONFIG) --cxxflags) $(RTTIFLAG)
> > LLVMLDFLAGS := $(shell $(LLVMCONFIG) --ldflags --libs $(LLVMCOMPONENTS))
> >
> > SOURCES = CI_opencl.cpp
> >
> > OBJECTS = $(SOURCES:.cpp=.o)
> > EXES = $(OBJECTS:.o=)
> > CLANGLIBS = \
> >                 -lclangTooling\
> >                 -lclangFrontendTool\
> >                 -lclangFrontend\
> >                 -lclangDriver\
> >                 -lclangSerialization\
> >                 -lclangCodeGen\
> >                 -lclangParse\
> >                 -lclangSema\
> >                 -lclangStaticAnalyzerFrontend\
> >                 -lclangStaticAnalyzerCheckers\
> >                 -lclangStaticAnalyzerCore\
> >                 -lclangAnalysis\
> >                 -lclangARCMigrate\
> >                 -lclangRewriteFrontend\
> >                 -lclangRewriteCore\
> >                 -lclangEdit\
> >                 -lclangAST\
> >                 -lclangLex\
> >                 -lclangBasic\
> >                 $(shell $(LLVMCONFIG) --libs)\
> >                 -lcurses
> >
> > all: $(OBJECTS) $(EXES)
> >
> > %: %.o
> >     $(CXX) -o $@ $< $(CLANGLIBS) $(LLVMLDFLAGS)
> >
> >
> > Here is my source file : I put it on the attachment. CI_opencl.cpp
> > <http://clang-developers.42468.n3.nabble.com/file/n4038913/CI_opencl.cpp
> >
> >
> >
> >
> >
> >
> > -----
> > Good good study, day day up
> > --
> > View this message in context:
> >
> http://clang-developers.42468.n3.nabble.com/OpenCL-invalid-operands-to-binary-expression-tp4038893p4038913.html
> >
> > Sent from the Clang Developers mailing list archive at Nabble.com.
> > _______________________________________________
> > cfe-dev mailing list
> > [hidden email] <http://user/SendEmail.jtp?type=node&node=4038933&i=4>
> > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
> > _______________________________________________
> > cfe-dev mailing list
> > [hidden email] <http://user/SendEmail.jtp?type=node&node=4038933&i=5>
> > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
> >
> >
> > ------------------------------
> >  If you reply to this email, your message will be added to the discussion
> > below:
> >
> >
> http://clang-developers.42468.n3.nabble.com/OpenCL-invalid-operands-to-binary-expression-tp4038893p4038933.html
> >  To unsubscribe from OpenCL : invalid operands to binary expression,
> click
> > here<
> http://clang-developers.42468.n3.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4038893&code=emhhbmd4aXV4aWExQGdtYWlsLmNvbXw0MDM4ODkzfC0xNzc0MzY4MDE0
> >
> > .
> > NAML<
> http://clang-developers.42468.n3.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml
> >
> >
>
>
>
> --
>
> *Zhang XiuxiaInstitute of Computing Techonology  Chinese Academy of
> Sciences*
>
>
> CI_opencl.cpp (9K) <
> http://clang-developers.42468.n3.nabble.com/attachment/4038936/0/CI_opencl.cpp
> >
> atom_kernel.h (3K) <
> http://clang-developers.42468.n3.nabble.com/attachment/4038936/1/atom_kernel.h
> >
> error.output (2M) <
> http://clang-developers.42468.n3.nabble.com/attachment/4038936/2/error.output
> >
>
>
>
>
> -----
> Good good study, day day up
> --
> View this message in context:
> http://clang-developers.42468.n3.nabble.com/Re-OpenCL-invalid-operands-to-binary-expression-tp4038936.html
> Sent from the Clang Developers mailing list archive at Nabble.com.
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu<mailto:cfe-dev at cs.uiuc.edu>
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
>
>
> --
> Zhang Xiuxia
> Institute of Computing Techonology  Chinese Academy of Sciences
>
>


-- 

*Zhang XiuxiaInstitute of Computing Techonology  Chinese Academy of
Sciences*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140422/287da01b/attachment.html>


More information about the cfe-dev mailing list