lldb on Windows, possible? - clang

I just build clang on Windows following this. To make it kind of complete it seems the compiler lldb should be made also.
How do I build lldb with mingw? Or it should be build with clang?

The people who work on the Windows port of lldb use Visual Studio. The instructions for building lldb on Windows are here:
http://lldb.llvm.org/build.html#BuildingLldbOnWindows

Basically follow the build instructions for Linux:
http://lldb.llvm.org/build.html#BuildingLldbOnLinux
I recommend you to use ninja for windows instead of make (it's faster) but that's up to you.
Preferably use a mingw build of python. You find instructions on this here:
Build Python with Mingw and gcc
Alternatively you can use cmake for python build:
https://github.com/python-cmake-buildsystem/python-cmake-buildsystem
In the chapter "Building LLDB" itself use the latest stable source from llvm, cland and lldb and rename the folder as shown in the directory hierarchy image.
If you want to try building llvm and clang with clang, try to put a build of clang + llvm in your path (and avoid VC + gcc). In this case you might need a clang-build of python too. I did not try this out.
If you get build errors try to use the headers from predef.sf.net.

Related

Is it required to build LLVM in order to build hipSYCL?

I'm running Centos 7 and am trying to build hipSYCL (see here)
The issue is that hipSYCL needs to have cmake info from the LLVM build (via the LLVM_DIR cmake variable).
This is problematic for me because building LLVM requires a massive 35Gb for the libraries and exes. I don't have that much memory to spare.
I did find a build of llvm-toolset-8.0 online for Centos 7 and installed it, but to my surprise, that didn't seem to work with LLVM_DIR because there's no cmake files (since I didn't build it locally).
So, my question would be, is there a way to build hipSYCL using pre-built LLVM-clang?
If I'm missing or misunderstanding something, I'd appreciate any help.
LLVM publishes the necessary cmake files, and the binary OS packages I've seen include it, generally in a directory called /usr/lib/llvm*/lib/cmake and in a package called something like llvm-*-dev.

Complete and isolated LLVM/musl toolchain

What I'm trying to achieve is to compile an GNU independent and isolated LLVM toolchain using musl as clib.
Recently LLVM 4.0 has been released with lot's of new cool features, including production ready LLD, so also the linking step could be handled by LLVM.
More or less the stack is:
clang
llvm
lld
compiler-rt
libcxx
libcxxabi
musl
Following this, it is actually possible to do so without much patching or such (apart from compiling musl), but sadly, there is no good documentation about that.
Any suggestions?
There is an example of using Clang + Musl together to compile "Hello World" in C here: https://github.com/njlr/portable-cxx
It only requires wget, tar and make to be installed. Clang and Musl are downloaded as part of the build process.
The key is to disable the usual include paths using -nostdinc and then add the Musl ones using -isystem.
I was solving the same problem with my NGTC (Non-GNU toolchain) project. Please take a look at my build scripts and patches.
I used this toolchain to build a small Linux distro without any code from GNU project: nenuzhnix.

Is it possible to use TensorFlow C++ API on Windows?

I'm interested in incorporating TensorFlow into a C++ server application built in Visual Studio on Windows 10 and I need to know if that's possible.
Google recently announced Windows support for TensorFlow: https://developers.googleblog.com/2016/11/tensorflow-0-12-adds-support-for-windows.html
but from what I can tell this is just a pip install for the more commonly used Python package, and to use the C++ API you need to build the repo from source yourself: How to build and use Google TensorFlow C++ api
I tried building the project myself using bazel, but ran into issues trying to configure the build.
Is there a way to get TensorFlow C++ to work in native Windows (not using Docker or the new Windows 10 Linux subsystem, as I've seen others post about)?
Thanks,
Ian
It is certainly possible to use TensorFlow's C++ API on Windows, but it is not currently very easy. Right now, the easiest way to build against the C++ API on Windows would be to build with CMake, and adapt the CMake rules for the tf_tutorials_example_trainer project (see the source code here). Building with CMake will give you a Visual Studio project in which you can implement your C++ TensorFlow program.
Note that the tf_tutorials_example_trainer project builds a Console Application that statically links all of the TensorFlow runtime into your program. At present we have not written the necessary rules to create a reusable TensorFlow DLL, although this would be technially possible: for example, the Python extension is a DLL that includes the runtime, but does not export the necessary symbols to use TensorFlow's C or C++ APIs directly.
There is a detailed guide by Joe Antognini and a similar TensorFlow ReadMe at GitHub explaining the building of TensorFlow source via CMake. You also need to have SWIG installed on your machine which allows connecting C/C++ source with the Python scripting language. I did use Visual CMAKE (cmake-gui) with the screen capture shown below.
In the CMake configuration, I used Visual Studio 15 2017 compiler. Once this stage successfully completes, you can click on the Generate button to go ahead with the actual build process.
However, on Visual Studio 2015, when I attempted building via the "ALL_BUILD" project, the setup gave me "build tools for v141 cannot be found" error. This did not go away even when I attempted to retarget my solution. Finally, the solution got built successfully with Visual Studio 2017. You also need to manually set the SWIG_EXECUTABLE path in CMake before it successfully configures.
As indicated in the Antognini link, for me the build took about half an hour on a 16GB RAM, Core i7 machine. Once done, you might want to validate your build by attempting to run the tf_tutorials_example_trainer.exe file.
Hope this helps!
For our latest work on building TensorFlow C++ API on Windows, please look at this github page. This works on Windows 10, currently without CUDA support (only CPU).
PS:
Only the bazel build method works, because CMake is not supported and not maintained anymore, resulting in CMake configuration errors.
I had to use a downgraded version of my Visual Studio 2017 (from 15.7.5 to 15.4) by adding "VC++ 2017 version 15.4 v14.11 toolset" through the installer (Individual Components tab).
The cmake command which worked for me was:
cmake .. -A x64 -DCMAKE_BUILD_TYPE=Release ^
-T "v141,version=14.11" ^
-DSWIG_EXECUTABLE="C:/Program Files/swigwin-3.0.12/swig.exe" ^
-DPYTHON_EXECUTABLE="C:/Program Files/Python/python.exe" ^
-DPYTHON_LIBRARIES="C:/Program Files/Python/libs/python27.lib" ^
-Dtensorflow_ENABLE_GPU=ON ^
-DCUDNN_HOME="C:/Program Files/cudnn-9.2-windows10-x64-v7.1/cuda" ^
-DCUDA_TOOLKIT_ROOT_DIR="C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v9.0"
After the build, open tensorflow.sln in Visual Studio and build ALL_BUILD.
If you want to enable GPU computation, do check your Graphics Card here (Compute Capability > 3.5). Do remember to install all the packages (Cuda Toolkit 9.0, cuDNN, Python 3.7, SWIG, Git, CMake...) and add the paths to the environment variable in the beginning.
I made a README detailing how to I built the Tensorflow dll and .lib file for the C++ API on Windows with GPU support building from source with Bazel. Tensorflow version 1.14
The tutorial is step by step and starts at the very beginning, so you may have to scroll down past steps you have already done, like checking your hardware, installing Bazel etc.
Here is the url: https://github.com/sitting-duck/stuff/tree/master/ai/tensorflow/build_tensorflow_1.14_source_for_Windows
Probably you will want to scroll all the way down to this part:
https://github.com/sitting-duck/stuff/tree/master/ai/tensorflow/build_tensorflow_1.14_source_for_Windows#step-7-build-the-dll
It shows how to pass command to create .lib and .dll.
Then to test your .lib you should link it into your c++ project,
Then it will show you how to identify and fix the missing symbols using the TF_EXPORT macro
I am actively working on making this tutorial better so feel free to leave comments on this answer if you are having problems.

Building Clang, libstdc++4.6 to libstdc++4.7

I am trying to build Clang following this: http://clang.llvm.org/get_started.html
At step 6 the command ../llvm/configure runs a series of checks and one tells me:
checking whether Clang will select a modern C++ standard library... no
configure: error:
We detected a missing feature in the standard C++ library that was known to be
missing in libstdc++4.6 and implemented in libstdc++4.7. There are numerous
C++11 problems with 4.6's library, and we don't support GCCs or libstdc++ older
than 4.7. You will need to update your system and ensure Clang uses the newer
standard library.
If this error is incorrect or you need to force things to work, you may pass
'--disable-compiler-version-checks' to configure to bypass this test.
I don't know how to resolve this and google searches for libstdc++4.7 did not produce anything useful to me or something I understand. How do I go about replacing / upgrading this? I am on a Mac (10.7.5)
I ran into the same problem. The easiest way to build Clang is to use libc++ instead of libstdc++. If you don't have libc++, you can obtain it by installing XCode 4.2 (or newer) or you can build it yourself by following the instructions here: http://libcxx.llvm.org/
After you have libc++ installed, you can use the --enable-libcpp=yes flag with the configure command.
Just this week, the LLVM & Clang project upped the minimal compiler version requirement to gcc 4.7, with its libstdc++. You'll need to install or build a newer gcc.
Here's a blog post I wrote earlier today about building gcc 4.8 on Ubuntu 12.04 and using that to compile trunk LLVM & Clang. Hope this helps!
i have the same error on mac 10.8.5 xcode 5.0
configure option --enable-libcpp resolve my problem
../llvm/configure --enable-cxx11 --enable-optimized --enable-libcpp
For me this happened because I had the old clang and clang++ that I'd previously built from source (the one I was attempting to build to replace) coming first in my PATH. These were too old. Removing those two files so that the build process would use the clang and clang++ that comes with XCode's Command Line Tools and then rebuilding worked fine.

cvBlobsLib with mingw

Does anybody know how to build cvBlobsLib using MinGW? On official page http://opencv.willowgarage.com/wiki/cvBlobsLib there is only instruction for VS.
There is also linux version of this lib http://opencv.willowgarage.com/wiki/cvBlobsLib?action=AttachFile&do=view&target=cvblobs8.3_linux.tgz , but its makefile cannot be used in windows as i see.
If you use eclipse then you dont have a lot of work:
Create a new project, using MinGW toolchain.
Go to the project properties, and under C/C++ General >> Paths and Symbols add the openCV library paths.
compile the project and it should be OK.
Use this
http://opencv.willowgarage.com/wiki/cvBlobsLib#Build_intructions
if you have more problems (especially NOTE 3)

Resources