llvm-clang

How to Compile and Run llc-3.4 generated C++ code using native compiler(g++)?

妖精的绣舞 提交于 2019-12-11 02:26:55
问题 Note: Goal of this work is to use some of the c++11 features in non c++11 compiler Following steps are done, Generate llvm bit code, clang++ -emit-llvm -c test.cc -o test.o Convert llvm bitcode to c++ code, llc-3.4 test.o -o test.cpp -march=cpp Getting below error while compiling the llvm generated c++ code using GNU g++ arunprasadr@geekvm:~/works/myex/llvm$ g++ test.cpp test.cpp:3:23: fatal error: llvm/Pass.h: No such file or directory compilation terminated. I even tried adding llvm-dev

Fatal Error building the llvm source code in Ubuntu

寵の児 提交于 2019-12-11 01:31:38
问题 I am trying to build LLVM source code on Ubuntu 16.04. I have tried versions 4.0.1, 4.0.0 and 3.9.0 with sources from here. I have also tried using the source from svn as shown in several tutorials. Here is the error I get : [1480/1747] Linking CXX executable bin/clang-3.9 FAILED: : && /usr/bin/c++ -fPIC -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wno-maybe-uninitialized -Wdelete-non-virtual

Adding support for a memory type similar to __shared__ in CUDA using clang-llvm compiler

◇◆丶佛笑我妖孽 提交于 2019-12-11 00:27:33
问题 I am working towards adding a new memory type similar to __shared__ in CUDA called __noc__ which needs to be compiled using clang-llvm. Following are the steps followed to achieve the parsing for the new memory type taking reference from the answer: Step 1 : In the clangs's Attr.td file (clang/include/clang/Basic/Attr.td), the noc keyword was added similar to shared keyword. def CUDAShared : InheritableAttr { let Spellings = [GNU<"shared">]; let Subjects = SubjectList<[Var]>; let LangOpts =

SDL2 sample build error with android ndk r14

北战南征 提交于 2019-12-10 23:16:01
问题 I have tested to build the sample in SDL2 source (2.0.5) on my ubuntu 16.04 machine. According to https://wiki.libsdl.org/Android, I installed android sdk and ndk r14 and setup my environment variables. But I have failed to build with following command in "Simple Build" chapter. cd /usr/src/SDL2/build-scripts/ ./androidbuild.sh org.libsdl.testgles ../test/testgles.c It makes following error. Error: The project either has no target set or the target is invalid. Please provide a --target to the

How to install clang++ on osx?

给你一囗甜甜゛ 提交于 2019-12-10 21:24:33
问题 I've have got a default clang and clang++ in /usr/bin/ directory. Both of them have 3.3 version. Also I've installed clang with help of this specification. After installation I've gotten additional binary utility clang-3.5 . But clang++-3.5 was not installed. How to install it? 回答1: I suspect all you were missing was libstdc++ but trying to figure that out without seeing your build log is impossible. Especially as you say 'after installation...' when there's no installation step in the

Running LLVM file, generated with rustc, with clang

守給你的承諾、 提交于 2019-12-10 16:24:14
问题 I'm trying to run a .ll file with clang and getting linker errors. I have a file test.rs that simply includes a main function with a println! statement. I generate the LLVM IR with the command rustc --emit=llvm-ir --crate-type=bin test.rs . When I try to run the output test.ll file with clang test.ll I get a linker error: Undefined symbols for architecture x86_64: "std::io::stdio::_print::h178318b95760562a", referenced from: rust_test::main::h84a9713c734a1b45 in rust_test-9ea667.o "_main",

How to generate 64 bit Visual Studio project for LLVM using CMake?

余生颓废 提交于 2019-12-10 15:54:13
问题 I have downloaded LLVM source repository form http://releases.llvm.org/download.html. Now when I am running CMAKE in the source directory it is generating 32bit Visual Studio Projects but I want to generate 64 bit visual studio projects. If someone has already tried please help. I have gone through the document https://llvm.org/docs/GettingStartedVS.html and certainly as mentioned -Thost=x64 option is not working. 回答1: You need to choose the Visual Studio 15 2017 Win64 generator using the

Xcode 4 - Linking error when archiving application

十年热恋 提交于 2019-12-10 14:55:26
问题 We have been using Xcode 4 and LLVM 2.0 for a couple of months now and after finishing a huge update to our application we thought we would send it off to Apple. What we couldn't imagine however, was that although the program was able to be built for both the simulator and devices, when it came to archiving, XCode just threw a nasty linking error and left us hanging there. The error is related to the ZipKit library (we previously discussed the issues we had with making it work under XCode 4).

Why doesn't Clang come with standard library headers?

痞子三分冷 提交于 2019-12-10 12:31:12
问题 I downloaded Clang 3.6.2 from this website and am trying to set it up with Code::Blocks under Windows. Unfortunately, it fails to compile a simple "hello world" program on the grounds that it doesn't know where iostream is. Looking through the install folder, it does not appear to include a standard library with it. Why? And how do I get it? 回答1: The standard library is NOT part of the compiler itself. It is part of the runtime environment on a particular platform. Sure, some organisations

what is the right abstraction for compilation unit in LLVM?

橙三吉。 提交于 2019-12-10 06:54:44
问题 in LLVM we have the LLVMContext , which is the unit of storage, and we have the llvm::Module , which is where new symbols (functions and types) are built. my question is; what is the right llvm abstraction to use for compilation units? is the Module ? or is this actually meant for a bigger scope, i.e: a shared library target It seems to me that a compilation unit must satisfy an all-or-nothing result; either it compiles all its content without errors, or either there are errors and it needs