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

Sam Parker S.Parker3 at lboro.ac.uk
Tue Apr 22 03:36:38 PDT 2014


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 [cfe-dev-bounces at cs.uiuc.edu] on behalf of Xiuxia [zhangxiuxia1 at gmail.com]
Sent: 22 April 2014 00:30
To: 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> 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 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
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev



More information about the cfe-dev mailing list