Building z3 on mac os x - build

I'm trying to build Z3 on mac os x.
Following README file, I just executed
autoconf
./configure
make
to get an error "omp.h" file not found.
I copied the omp.h file from /usr/llvm-gcc-4.2/lib/gcc/i686-apple-darwin11/4.2.1/include to lib directory to solve this issue.
Then, I got lib/buffer.h:243:13: error: use of undeclared identifier 'push_back' error in building the code.
What could be the solution? I have gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00) on Mac OS X 10.7.5.

The next release (Z3 v4.3.2) will have better support for OSX, clang, and older versions of gcc.
You should be able to compile the release candidate using the following instructions. rc is the branch that contains the current release candidate.
git clone https://git01.codeplex.com/z3 -b rc
cd z3
python scripts/mk_make.py
cd build
make
BTW, the link http://z3.codeplex.com/releases/view/95640 does not contain the latest release (Z3 v4.3.1). We don't create zip files with source code anymore because codeplex automatically generates them for any version. See this link for additional details.
EDIT
on February 2013, we started to provide nightly builds for all major platforms (including OSX). Here are instruction on how to download these pre-compiled binaries.
END EDIT

Alternatively, you can use Homebrew:
> brew install z3

Related

How to compile and install LLVM 13 from source on windows 10?

I want to install LLVM 13.0.1 in my local windows (64 bit) system to use it for creating a working enviorment for open source project. I downloaded and install from here but I found it is not complete It is missing many library files and cmake files that are required and getting errors while building. so I want now to install LLVM 13.0.1 from source.
I am very early in learning LLVM , Clang so don't have any idea of doing so. Can anyone give me the entire step / commands to do so.

Headers for Clang from VS build tools and LLVM

I was experimenting with different compilers, build managers and IDEs for my new project in C++. I am using VSCode(v1.52) on a windows 10 machine. I installed VS build tools 2019 and also included C++ Clang Compiler for Windows and C++ Clang-cl for v142 build tools (x64/x86). The project uses CMake as build manager and a plug-in CMake tools have been installed as well. Setup works fine as it is now.
However, I just want to know what are the differences to include Clang compiler from VSCode build tools 2019 and from LLVM. Does Clang that comes with VSCode build tools uses its own headers or the headers from VS? I do not want to use if Clang uses headers from VS..!
VSCode build tools (C++ Clang tools for Windows) will link the Clang compiler with Microsoft implementation of the Standard Library
Also, VSCode build tools has a component called: "C++ Clang-cl for v142" that gives you the freedom of using your own Compiler/Settings
Regarding header files, on Windows you should use clang with either GCC (Open Source) or MSVC header files.
I could not find the exact source of the header files in VS Build tools. However, as said above, it will link the compiler with Microsoft STL.
To install Clang with GCC header files (Works on VsCode):
go to https://www.msys2.org/ and install mysys2
then open mysys2 terminal and copy those commands to install Clang:
pacman -S mingw-w64-x86_64-clang
pacman -S mingw-w64-x86_64-clang-tools-extra
dont forget to add \msys64\mingw64\bin to the SYSTEM PATH variable
I have also made a video, with step by step: https://youtu.be/5OSO8IRlyXc

Compiling a Qt5.2 project on OsX 10.9 with gcc4.2?

I have a QT project that works perfectly under my current configuration ( OsX 10.8.5, QT4.8.5 and compiler i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)
The problem is I am switching to a new laptop that has OsX 10.9 installed. As known problem there is only CLang. Using CLang the project gives a lot of compilation errors on some libraries that I cannot change. (errors that are not given under the current configuration ).
Hence I have installed apple-GCC4.2.1 using brew and with gcc --version I get:
i686-apple-darwin11-llvm-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3).
Now I get "no such file or directory" for files <stdarg.h> and <float.h>, under the directory
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1
For what I have understood it is like it is including the basic c++ headers from the Xcode compiler and they do not match with the ones that gcc4.2.1 wants.
Can someone help me? thank you in advance.
All of the C++ code (Qt, your application, any C++ libraries that you use) must be compiled with the same C++ compiler.
I have solved.
I have to say that the following procedure worked for my case, but I cannot be sure that this can work for you and/or if this procedure can be dangerous for your system configuration.
For me, worked this procedure.
Install command_line_tools_os_x_mavericks_for_xcode_late_october_2013
( not sure if it is necessary, but i think so )
Install Qt4.8.5 and set it up on QtCreator
install homebrew
install apple-gcc42 and gdb using brew:
brew tap homebrew/dupes
brew install apple-gcc42
brew install gdb
set up the compiler and GDB on QtCreator and then create your kit.
codesign gdb following this guide (scroll until you find
"Generate Certificate for signing".
have fun.
in my case it was necessary to modify the makefile in order to set for
CFLAGS, CXXFLAGS and LFLAGS the value -mmacosx-version-min=10.6.

Header file not found when compiling Vowpal Wabbit on Mac OS X

I have downloaded Vowpal Wabbit ( Version 7.4 ) on to my Mac ( OS X Mavericks ) with the following version of g++ :
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include- dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1
Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin13.0.0
Thread model: posix
I modified the Makefile that comes with the installation so that it will pick up Boost ( Version 1.55 ) headers and libraries from the correct folders on my Mac ( I checked by writing and compiling a simple program and everything works ). However, when I run make it cannot find a header file, for example:
In file included from library_example.cc:2:
./../vowpalwabbit/parser.h:15:10: fatal error: 'boost/program_options.hpp' file
not found
Grateful for any help in tracking down the problem.
vowpal wabbit has a dependency on the C++ library+headers boost/program_options.
This dependency must be installed before vowpal wabbit can be built from source.
Since other people may have a similar issue, I will try to answer the more general question:
How to build vowpal wabbit from scratch/source, on Mac OS-X?
The following set of instructions assumes you have no development environment at all. If you do, you may skip any steps you deem unnecessary.
Important: credit where credit is due. These instructions are almost 100% written by Aaron Shumacher: I sourced them from his page following a web-search, with relatively minor modifications, additions, and clarifications.
Stage 0, basic prerequisites needed for developing on Mac OS-X:
Install the Xcode command line tools. This will give you an Apple’s development environment (compiler, make, etc.).
Install the Homebrew package manager.
Once you have Homebrew installed, everything else that's missing, is easy to install.
Install needed tools to build from source:
brew install libtool
brew install automake
brew install boost
brew install git
Now, you're ready to download the vowpal wabbit source tree (latest):
Download:
git clone https://github.com/JohnLangford/vowpal_wabbit.git
cd vowpal_wabbit
You’re now ready to go through the standard build (aka make) process.
Build:
[Edit: 2014-07-20]: ./autogen.sh may not work well in some environments. I recommend trying to build using a simple make first. The included Makefile is already pretty robust and should work just fine in most environments. The problem with running autogen/automake is that it may overwrite the (pretty good) original Makefile with a bad one.
# ./autogen.sh # commented out, use only if 'make' alone doesn't work
make
make test
Note: it is important to verify (using make test) that your binary works as expected. If you see any failure, please report it on the mailing list, and proceed with the installation only if the failure is immaterial to you (e.g. only some rarely used options/tests you don't care about fail). See the test/RunTests script for full details on the tests.
Install:
make install
At this point, you should have vowpal wabbit at /usr/local/bin/vw

How to update GCC in MinGW on Windows?

I'm used to manually install GCC from source before on Ubuntu and it was a painful process. So I really don't want to do repeat this process. Currently, I have MinGW and GCC (4.6.2) installed on my machine. So is there an easy way to update GCC without building it entirely from source? Has anyone done it before can share me some tips?
Update using terminal:
Run the command prompt/terminal (cmd or sh).
Update the package list:
mingw-get update
After updating the package list, run:
mingw-get upgrade
When the command finishes running, all of your packages will be upgraded.
Update using the GUI version:
If you aren't used to the terminal, there is also a GUI version of MinGW called "MinGW Installation Manager", which is normally located at:
C:\MinGW\libexec\mingw-get\guimain.exe
When the GUI is open, tap Installation -> Update Catalogue. This will update the package list.
After that, tap Installation -> Mark All Upgrades. This will select all of the packages which can be upgraded.
Finally, tap Installation -> Apply Changes to apply the upgrades.
Snapshots and release builds of the MinGW http://code.google.com/p/mingw-builds/downloads/list
UPDATE: As of Nov-5-2012, MinGW includes 4.7.2 of the GCC compiler, which is the most current version. I personally will use the MinGW package, since it includes MSYS and other tools, and since it is the defacto standard, I hope that it is better supported. The only drawback is the included GDB does not include Python scripting, but I think that can be updated separately.
I don't know if you can update the GCC in MinGW, but there are alternative projects to MinGW with newer versions of GCC.
The MinGW-builds project provides a package similar to MinGW but with an updated GCC (4.7.2). I extracted the files to c:\MinGW (so I could use the same path) after moving my existing MinGW to another folder. Only MinGW has MSYS, so if you need that (I did) copy the msys folder from the original MinGW.
After installing MinGW-builds, the result of g++ --version:
g++ (Built by MinGW-builds project) 4.7.2
The latest GCC that comes with standard MinGW is currently 4.7.0. I compiled a few simple projects in Code::Blocks, and the latest wxWidgets source, and everything seems to work.
It's worth noting that MinGW-builds includes a Python script enabled version of GDB, in case you want STL pretty printer support, or other GDB Python features.
Another good choice is TDM-GCC, which is a project that hosts an impressive installer that includes an updated GCC compiler (4.7.1) and support tools. It is a standalone package. As far as I can tell, Python scripting is not supported in the GDB that comes with this package.
Finally there is the MinGW-w64 project, which is a fork of MinGW. Rubenvb, who posted an answer to this question, has good standalone packages (in the personal builds folder) based on this project which include an updated GCC (4.7.2). The included GDB seems to be Python script enabled.
if you use MSYS2
just open mingw64-console and type in:
# Update the package database and core system packages with:
pacman -Syu
# If needed, close MSYS2, run it again from Start menu. Update the rest with:
pacman -Su
I have built a more up to date GCC 4.7 (it's built within code freeze, so it should be equivalent with the release). Also, this build contains <thread> support.
32-bit
64-bit
The -gcc_linux package is what you want if you want to use it on Linux. Just extract somewhere and add the mingw??/bin directory to PATH.
PS: There's a native Windows compiler and a Windows Clang build. I suggest using Clang only with one of my GCC 4.6 builds, as it has trouble with GCC 4.7's libstd++. Extract the Clang package in the same directory as the GCC package and it will work out of the box.
The MinGW-w64 build from http://winlibs.com/ has the latest GCC version and requires no installation, just unzip the download. To upgrade you can just replace the mingw32 or mingw64 folder with the new version.
To get latest MinGW64 in Windows: https://sourceforge.net/projects/mingw-w64/?source=typ_redirect
For all platforms: https://mingw-w64.org/doku.php/download
You just need to update your g++ compiler if its not.
First problem can be solved through this:
Update using the GUI version:
If you aren't used to the terminal, there is also a GUI version of MinGW called "MinGW Installation Manager", which is normally located at:
C:\MinGW\libexec\mingw-get\guimain.exe
When the GUI is open, tap
Installation -> Update Catalogue
. This will update the package list.
After that, tap
Installation -> Mark All Upgrades
. This will select all of the packages which can be upgraded.
Finally, tap
Installation -> Apply Changes
to apply the upgrades.
2nd Problem could be that if you didn't updated the path of mingw in environment variables.