How to compile zlib with clang and cmake - windows

I tried to build zlib with cmake and clang (8.0) on Windows 64. I did these steps:
mkdir build.clang
cd build.clang
call "c:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" x64
cmake -E env LDFLAGS="-fuse-ld=lld" cmake -H. -G Ninja ^
-DCMAKE_C_COMPILER:PATH="C:\Program Files\LLVM\bin\clang-cl.exe" ^
-DCMAKE_C_COMPILER_ID="Clang" ^
-DCMAKE_AR="c:\Program Files\LLVM\bin\llvm-ar.exe" ^
-DCMAKE_SYSTEM_NAME="Generic" ..
Configuration run fine (excluding claiming it is not possible to build share libs, but that is not the issue at the moment):
-- The C compiler identification is Clang
-- Check for working C compiler: C:/Program Files/LLVM/bin/clang-cl.exe
-- Check for working C compiler: C:/Program Files/LLVM/bin/clang-cl.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Detecting C compile features
-- Detecting C compile features - done CMake Warning (dev) at CMakeLists.txt:186 (add_library): ADD_LIBRARY called with SHARED option but the target platform does not support dynamic linking. Building a STATIC library instead. This may lead to problems. This warning is for project developers. Use -Wno-dev to suppress it.
-- Configuring done
-- Generating done
-- Build files have been written to: F:/Project-tests/clang_lept/zlib-1.2.11/build.clang
However build failed:
cmake --build . --config Release
[1/36] Building C object CMakeFiles/zlib.dir/crc32.obj
FAILED: CMakeFiles/zlib.dir/crc32.obj
C:\PROGRA~1\LLVM\bin\clang-cl.exe -DNO_FSEEKO -I. -I../ -MD -MT CMakeFiles/zlib.dir/crc32.obj -MF CMakeFiles\zlib.dir\crc32.obj.d -o CMakeFiles/zlib.dir/crc32.obj -c ../crc32.c
clang-cl: warning: unknown argument ignored in clang-cl: '-MF' [-Wunknown-argument]
clang-cl: error: no such file or directory: 'CMakeFiles/zlib.dir/crc32.obj'
clang-cl: error: no such file or directory: 'CMakeFiles\zlib.dir\crc32.obj.d'
[2/36] Building C object CMakeFiles/zlib.dir/gzread.obj
FAILED: CMakeFiles/zlib.dir/gzread.obj
C:\PROGRA~1\LLVM\bin\clang-cl.exe -DNO_FSEEKO -I. -I../ -MD -MT CMakeFiles/zlib.dir/gzread.obj -MF CMakeFiles\zlib.dir\gzread.obj.d -o CMakeFiles/zlib.dir/gzread.obj -c ../gzread.c
clang-cl: warning: unknown argument ignored in clang-cl: '-MF' [-Wunknown-argument]
clang-cl: error: no such file or directory: 'CMakeFiles/zlib.dir/gzread.obj'
clang-cl: error: no such file or directory: 'CMakeFiles\zlib.dir\gzread.obj.d'
[3/36] Building C object CMakeFiles/zlib.dir/compress.obj
FAILED: CMakeFiles/zlib.dir/compress.obj
C:\PROGRA~1\LLVM\bin\clang-cl.exe -DNO_FSEEKO -I. -I../ -MD -MT CMakeFiles/zlib.dir/compress.obj -MF CMakeFiles\zlib.dir\compress.obj.d -o CMakeFiles/zlib.dir/compress.obj -c ../compress.c
clang-cl: warning: unknown argument ignored in clang-cl: '-MF' [-Wunknown-argument]
clang-cl: error: no such file or directory: 'CMakeFiles/zlib.dir/compress.obj'
clang-cl: error: no such file or directory: 'CMakeFiles\zlib.dir\compress.obj.d'
[4/36] Building C object CMakeFiles/zlib.dir/adler32.obj
FAILED: CMakeFiles/zlib.dir/adler32.obj
C:\PROGRA~1\LLVM\bin\clang-cl.exe -DNO_FSEEKO -I. -I../ -MD -MT CMakeFiles/zlib.dir/adler32.obj -MF CMakeFiles\zlib.dir\adler32.obj.d -o CMakeFiles/zlib.dir/adler32.obj -c ../adler32.c
clang-cl: warning: unknown argument ignored in clang-cl: '-MF' [-Wunknown-argument]
clang-cl: error: no such file or directory: 'CMakeFiles/zlib.dir/adler32.obj'
clang-cl: error: no such file or directory: 'CMakeFiles\zlib.dir\adler32.obj.d'
[5/36] Building C object CMakeFiles/zlib.dir/gzclose.obj
FAILED: CMakeFiles/zlib.dir/gzclose.obj
C:\PROGRA~1\LLVM\bin\clang-cl.exe -DNO_FSEEKO -I. -I../ -MD -MT CMakeFiles/zlib.dir/gzclose.obj -MF CMakeFiles\zlib.dir\gzclose.obj.d -o CMakeFiles/zlib.dir/gzclose.obj -c ../gzclose.c
clang-cl: warning: unknown argument ignored in clang-cl: '-MF' [-Wunknown-argument]
clang-cl: error: no such file or directory: 'CMakeFiles/zlib.dir/gzclose.obj'
clang-cl: error: no such file or directory: 'CMakeFiles\zlib.dir\gzclose.obj.d'
[6/36] Building C object CMakeFiles/zlib.dir/gzlib.obj
FAILED: CMakeFiles/zlib.dir/gzlib.obj
C:\PROGRA~1\LLVM\bin\clang-cl.exe -DNO_FSEEKO -I. -I../ -MD -MT CMakeFiles/zlib.dir/gzlib.obj -MF CMakeFiles\zlib.dir\gzlib.obj.d -o CMakeFiles/zlib.dir/gzlib.obj -c ../gzlib.c
clang-cl: warning: unknown argument ignored in clang-cl: '-MF' [-Wunknown-argument]
clang-cl: error: no such file or directory: 'CMakeFiles/zlib.dir/gzlib.obj'
clang-cl: error: no such file or directory: 'CMakeFiles\zlib.dir\gzlib.obj.d'
ninja: build stopped: subcommand failed.
When I tried to use GCC compatibility of clang - build failed too, but during linking process...
PS: build with VS 2017 (cmake .. -G "Visual Studio 15 2017 Win64") works without problem...

You need to set a few more environment variables.
set CC=clang-cl
set CXX=clang-cl
set CFLAGS=-m64 -fmsc-version=<your vs version>
set CXXFLAGS=-m64 -fmsc-version=<your vs version>
or pass them in your cmake call.

So it looks like "less is more" ;-) . Here are steps to build zlib with ninja, clang and cmake (must be run as admin for installation):
set CC=clang-cl
set CFLAGS=-m64 -fmsc-version=1915
call "c:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" x64
cmake .. -G Ninja -DCMAKE_INSTALL_PREFIX="C:\Program Files\zlib"
cmake --build . --config Release --target install
cmake --build . --config Debug --target install
I need to specify CMAKE_INSTALL_PREFIX, otherwise cmake will install 64bit zlib to "C:/Program Files (x86)"

Related

Clang is not able to find Input Files

I am getting this error while creating executable file:
[1/2] clang++ -shared -o ./SampleDll_check.dll #SampleDll_check.dll.rsp
FAILED: SampleDll_check.dll SampleDll_check.lib
clang++ -shared -o ./SampleDll_check.dll #SampleDll_check.dll.rsp
clang++: error: no input files
ninja: build stopped: subcommand failed.
Please provide any hint what is wrong?

Clickhouse 'ninja' build error with "timestamp"

Please help figure out what the problem when I tried build "ninja" for "ClickHouse"
https://clickhouse.yandex/docs/ru/development/build_osx/
SDKs/MacOSX10.15.sdk -D OS_DARWIN -nostdinc++ -MD -MT dbms/CMakeFiles/dbms.dir/src/Storages/LiveView/StorageLiveView.cpp.o -MF dbms/CMakeFiles/dbms.dir/src/Storages/LiveView/StorageLiveView.cpp.o.d -o dbms/CMakeFiles/dbms.dir/src/Storages/LiveView/StorageLiveView.cpp.o -c ../dbms/src/Storages/LiveView/StorageLiveView.cpp
In file included from ../dbms/src/Storages/LiveView/StorageLiveView.cpp:31:
../dbms/src/Storages/LiveView/LiveViewBlockInputStream.h:188:57: error: use of undeclared identifier 'timestamp'
last_event_timestamp_usec = static_cast<UInt64>(timestamp.epochMicroseconds());
^
1 error generated.
[3313/4079] Building CXX object dbms/CMakeFiles/dbms.dir/src/Client/ConnectionPoolWithFailover.cpp.o
ninja: build stopped: subcommand failed.
Also, I created a request here:
https://github.com/ClickHouse/ClickHouse/issues/8638

How to read stracktrace with CMake and Gfortran error

I'm required to install the Dune library for my "Partial Differential Equation" lecture and am stuck. I'm on a MacBook and we received an installation script (for Linux), but I always get an error that my Gfortran and g++ compiler is not compatible.
I've researched similar errors and some could be fixed by deleting the CMake cache, but I'm not sure and don't want to screw up the folder structure.
The error code looks like this:
matthias#MacBookPro ~/Documents/studium_matthias/semester_7/num_2/dune$ ./buildmodules.sh
build common
----- using default flags $CMAKE_FLAGS from /Users/matthias/Documents/studium_matthias/semester_7/num_2/dune/release.opts -----
--- going to build dune-common ---
--- calling all for dune-common ---
--- calling vcsetup for dune-common ---
--- calling configure for dune-common ---
cmake -DDUNE_BUILD_DIRECTORY_ROOT_PATH='/Users/matthias/Documents/studium_matthias/semester_7/num_2/dune/release-build' -DCMAKE_C_COMPILER='/usr/bin/gcc' -DCMAKE_CXX_COMPILER='/usr/bin/g++' -DCMAKE_Fortran_COMPILER='/usr/local/bin/gfortran' -DCMAKE_CXX_FLAGS_RELEASE='-O3 -DNDEBUG -g0 -funroll-loops -ftemplate-depth=5120 -march=native -Wa,-q' -DHDF5_ROOT=/Users/matthias/Documents/studium_matthias/semester_7/num_2/dune/external/hdf5 -DFFTW3_ROOT_DIR=/Users/matthias/Documents/studium_matthias/semester_7/num_2/dune/external/fftw3 -DCMAKE_BUILD_TYPE=Release -DDUNE_SYMLINK_TO_SOURCE_TREE=1 "/Users/matthias/Documents/studium_matthias/semester_7/num_2/dune/dune-common"
CMake Error at /usr/local/Cellar/cmake/3.15.5/share/cmake/Modules/FortranCInterface.cmake:383 (message):
The Fortran compiler:
/usr/local/bin/gfortran
and the CXX compiler:
/usr/bin/g++
failed to compile a simple test project using both languages. The output
was:
Change Dir: /Users/matthias/Documents/studium_matthias/semester_7/num_2/dune/release-build/dune-common/CMakeFiles/FortranCInterface/VerifyCXX
Run Build Command(s):/usr/bin/make VerifyFortranC && /usr/local/Cellar/cmake/3.15.5/bin/cmake -S/usr/local/Cellar/cmake/3.15.5/share/cmake/Modules/FortranCInterface/Verify -B/Users/matthias/Documents/studium_matthias/semester_7/num_2/dune/release-build/dune-common/CMakeFiles/FortranCInterface/VerifyCXX --check-build-system CMakeFiles/Makefile.cmake 0
/Library/Developer/CommandLineTools/usr/bin/make -f CMakeFiles/Makefile2 VerifyFortranC
/usr/local/Cellar/cmake/3.15.5/bin/cmake -S/usr/local/Cellar/cmake/3.15.5/share/cmake/Modules/FortranCInterface/Verify -B/Users/matthias/Documents/studium_matthias/semester_7/num_2/dune/release-build/dune-common/CMakeFiles/FortranCInterface/VerifyCXX --check-build-system CMakeFiles/Makefile.cmake 0
/usr/local/Cellar/cmake/3.15.5/bin/cmake -E cmake_progress_start /Users/matthias/Documents/studium_matthias/semester_7/num_2/dune/release-build/dune-common/CMakeFiles/FortranCInterface/VerifyCXX/CMakeFiles 6
/Library/Developer/CommandLineTools/usr/bin/make -f CMakeFiles/Makefile2 CMakeFiles/VerifyFortranC.dir/all
/Library/Developer/CommandLineTools/usr/bin/make -f CMakeFiles/VerifyFortran.dir/build.make CMakeFiles/VerifyFortran.dir/depend
cd /Users/matthias/Documents/studium_matthias/semester_7/num_2/dune/release-build/dune-common/CMakeFiles/FortranCInterface/VerifyCXX && /usr/local/Cellar/cmake/3.15.5/bin/cmake -E cmake_depends "Unix Makefiles" /usr/local/Cellar/cmake/3.15.5/share/cmake/Modules/FortranCInterface/Verify /usr/local/Cellar/cmake/3.15.5/share/cmake/Modules/FortranCInterface/Verify /Users/matthias/Documents/studium_matthias/semester_7/num_2/dune/release-build/dune-common/CMakeFiles/FortranCInterface/VerifyCXX /Users/matthias/Documents/studium_matthias/semester_7/num_2/dune/release-build/dune-common/CMakeFiles/FortranCInterface/VerifyCXX /Users/matthias/Documents/studium_matthias/semester_7/num_2/dune/release-build/dune-common/CMakeFiles/FortranCInterface/VerifyCXX/CMakeFiles/VerifyFortran.dir/DependInfo.cmake
Scanning dependencies of target VerifyFortran
/Library/Developer/CommandLineTools/usr/bin/make -f CMakeFiles/VerifyFortran.dir/build.make CMakeFiles/VerifyFortran.dir/build
[ 16%] Building Fortran object CMakeFiles/VerifyFortran.dir/VerifyFortran.f.o
/usr/local/bin/gfortran -DVERIFY_CXX -I/Users/matthias/Documents/studium_matthias/semester_7/num_2/dune/release-build/dune-common/CMakeFiles/FortranCInterface/VerifyCXX -O3 -DNDEBUG -O3 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -c /usr/local/Cellar/cmake/3.15.5/share/cmake/Modules/FortranCInterface/Verify/VerifyFortran.f -o CMakeFiles/VerifyFortran.dir/VerifyFortran.f.o
[ 33%] Linking Fortran static library libVerifyFortran.a
/usr/local/Cellar/cmake/3.15.5/bin/cmake -P CMakeFiles/VerifyFortran.dir/cmake_clean_target.cmake
/usr/local/Cellar/cmake/3.15.5/bin/cmake -E cmake_link_script CMakeFiles/VerifyFortran.dir/link.txt --verbose=1
/usr/bin/ar qc libVerifyFortran.a CMakeFiles/VerifyFortran.dir/VerifyFortran.f.o
/usr/bin/ranlib libVerifyFortran.a
[ 33%] Built target VerifyFortran
/Library/Developer/CommandLineTools/usr/bin/make -f CMakeFiles/VerifyFortranC.dir/build.make CMakeFiles/VerifyFortranC.dir/depend
cd /Users/matthias/Documents/studium_matthias/semester_7/num_2/dune/release-build/dune-common/CMakeFiles/FortranCInterface/VerifyCXX && /usr/local/Cellar/cmake/3.15.5/bin/cmake -E cmake_depends "Unix Makefiles" /usr/local/Cellar/cmake/3.15.5/share/cmake/Modules/FortranCInterface/Verify /usr/local/Cellar/cmake/3.15.5/share/cmake/Modules/FortranCInterface/Verify /Users/matthias/Documents/studium_matthias/semester_7/num_2/dune/release-build/dune-common/CMakeFiles/FortranCInterface/VerifyCXX /Users/matthias/Documents/studium_matthias/semester_7/num_2/dune/release-build/dune-common/CMakeFiles/FortranCInterface/VerifyCXX /Users/matthias/Documents/studium_matthias/semester_7/num_2/dune/release-build/dune-common/CMakeFiles/FortranCInterface/VerifyCXX/CMakeFiles/VerifyFortranC.dir/DependInfo.cmake
Scanning dependencies of target VerifyFortranC
/Library/Developer/CommandLineTools/usr/bin/make -f CMakeFiles/VerifyFortranC.dir/build.make CMakeFiles/VerifyFortranC.dir/build
[ 50%] Building C object CMakeFiles/VerifyFortranC.dir/main.c.o
/usr/bin/gcc -DVERIFY_CXX -I/Users/matthias/Documents/studium_matthias/semester_7/num_2/dune/release-build/dune-common/CMakeFiles/FortranCInterface/VerifyCXX -O3 -DNDEBUG -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -o CMakeFiles/VerifyFortranC.dir/main.c.o -c /usr/local/Cellar/cmake/3.15.5/share/cmake/Modules/FortranCInterface/Verify/main.c
[ 66%] Building C object CMakeFiles/VerifyFortranC.dir/VerifyC.c.o
/usr/bin/gcc -DVERIFY_CXX -I/Users/matthias/Documents/studium_matthias/semester_7/num_2/dune/release-build/dune-common/CMakeFiles/FortranCInterface/VerifyCXX -O3 -DNDEBUG -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -o CMakeFiles/VerifyFortranC.dir/VerifyC.c.o -c /usr/local/Cellar/cmake/3.15.5/share/cmake/Modules/FortranCInterface/Verify/VerifyC.c
[ 83%] Building CXX object CMakeFiles/VerifyFortranC.dir/VerifyCXX.cxx.o
/usr/bin/g++ -DVERIFY_CXX -I/Users/matthias/Documents/studium_matthias/semester_7/num_2/dune/release-build/dune-common/CMakeFiles/FortranCInterface/VerifyCXX -std=c++17 -O3 -DNDEBUG -g0 -funroll-loops -ftemplate-depth=5120 -march=native -Wa,-q -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -o CMakeFiles/VerifyFortranC.dir/VerifyCXX.cxx.o -c /usr/local/Cellar/cmake/3.15.5/share/cmake/Modules/FortranCInterface/Verify/VerifyCXX.cxx
clang: error: unsupported argument '-q' to option 'Wa,'
make[3]: *** [CMakeFiles/VerifyFortranC.dir/VerifyCXX.cxx.o] Error 1
make[2]: *** [CMakeFiles/VerifyFortranC.dir/all] Error 2
make[1]: *** [CMakeFiles/VerifyFortranC.dir/rule] Error 2
make: *** [VerifyFortranC] Error 2
Call Stack (most recent call first):
cmake/modules/DuneMacros.cmake:710 (FortranCInterface_VERIFY)
CMakeLists.txt:17 (dune_project)
-- Configuring incomplete, errors occurred!
See also "/Users/matthias/Documents/studium_matthias/semester_7/num_2/dune/release-build/dune-common/CMakeFiles/CMakeOutput.log".
See also "/Users/matthias/Documents/studium_matthias/semester_7/num_2/dune/release-build/dune-common/CMakeFiles/CMakeError.log".
--- Failed to build dune-common ---
Terminating dunecontrol due to previous errors!
How can I approach this?
As #squareskittles pointed out in the comments, the error arised from the unsupported argument -q to Wa,. This tells the compiler (gcc!) to pass the option -q to the assembler.
This option is not supported by clang. which gcc told me gcc was installed and located at /usr/bin/gcc but further inspection showed that it was just a symlink to clang - even though I had gcc installed via homebrew (located at /usr/local/bin/gcc-9).
In the installation file I was able to change the path of used compiler to the gcc installation (g++ was linked to clang, and I replaced it as well). From that point on the -q argument to Wa was valid the installation process went without further errors.
it will fine install dune core modules using homebrew package manager for your system. From now is available 2.7.1. https://github.com/dune-copasi/homebrew-tap

luabind compiling error occurs

I am trying to compile luabind which I got from this link. After I do
mkdir build
cmake ..
make VERBOSE=1
"cmake .." produces these lines,
-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/g++-4.7
-- Check for working CXX compiler: /usr/bin/g++-4.7 -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Boost version: 1.53.0
-- Found Lua52: /usr/lib/i386-linux-gnu/liblua5.2.so;/usr/lib/i386-linux-gnu/libm.so
-- Configuring done
-- Generating done
-- Build files have been written to: /home/mwh/Desktop/Downloads/luabind-master/build
"make VERBOSE=1" produces following errors.
/usr/bin/cmake -H/home/mwh/Desktop/Downloads/luabind-master -B/home/mwh/Desktop/Downloads/luabind-master/build --check-build-system CMakeFiles/Makefile.cmake 0
/usr/bin/cmake -E cmake_progress_start /home/mwh/Desktop/Downloads/luabind-master/build/CMakeFiles /home/mwh/Desktop/Downloads/luabind-master/build/CMakeFiles/progress.marks
make -f CMakeFiles/Makefile2 all
make[1]: Entering directory `/home/mwh/Desktop/Downloads/luabind-master/build'
make -f src/CMakeFiles/luabind.dir/build.make src/CMakeFiles/luabind.dir/depend
make[2]: Entering directory `/home/mwh/Desktop/Downloads/luabind-master/build'
cd /home/mwh/Desktop/Downloads/luabind-master/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/mwh/Desktop/Downloads/luabind-master /home/mwh/Desktop/Downloads/luabind-master/src /home/mwh/Desktop/Downloads/luabind-master/build /home/mwh/Desktop/Downloads/luabind-master/build/src /home/mwh/Desktop/Downloads/luabind-master/build/src/CMakeFiles/luabind.dir/DependInfo.cmake --color=
make[2]: Leaving directory `/home/mwh/Desktop/Downloads/luabind-master/build'
make -f src/CMakeFiles/luabind.dir/build.make src/CMakeFiles/luabind.dir/build
make[2]: Entering directory `/home/mwh/Desktop/Downloads/luabind-master/build'
/usr/bin/cmake -E cmake_progress_report /home/mwh/Desktop/Downloads/luabind-master/build/CMakeFiles 2
[ 1%] Building CXX object src/CMakeFiles/luabind.dir/class.cpp.o
cd /home/mwh/Desktop/Downloads/luabind-master/build/src && /usr/bin/g++-4.7 -I/usr/local/include -I/usr/include/lua5.2 -I/home/mwh/Desktop/Downloads/luabind-master -o CMakeFiles/luabind.dir/class.cpp.o -c /home/mwh/Desktop/Downloads/luabind-master/src/class.cpp
In file included from /home/mwh/Desktop/Downloads/luabind-master/luabind/object.hpp:38:0,
from /home/mwh/Desktop/Downloads/luabind-master/luabind/scope.hpp:28,
from /home/mwh/Desktop/Downloads/luabind-master/luabind/class.hpp:92,
from /home/mwh/Desktop/Downloads/luabind-master/src/class.cpp:30:
/home/mwh/Desktop/Downloads/luabind-master/luabind/detail/policy.hpp: In member function ‘T luabind::detail::enum_converter::apply(lua_State*, luabind::detail::by_value<T>, int)’:
/home/mwh/Desktop/Downloads/luabind-master/luabind/detail/policy.hpp:498:21: error: ‘underlying_type’ in namespace ‘std’ does not name a type
/home/mwh/Desktop/Downloads/luabind-master/luabind/detail/policy.hpp:499:47: error: expected type-specifier before ‘integral_t’
/home/mwh/Desktop/Downloads/luabind-master/luabind/detail/policy.hpp:499:47: error: expected ‘>’ before ‘integral_t’
/home/mwh/Desktop/Downloads/luabind-master/luabind/detail/policy.hpp:499:47: error: expected ‘(’ before ‘integral_t’
/home/mwh/Desktop/Downloads/luabind-master/luabind/detail/policy.hpp:499:47: error: ‘integral_t’ was not declared in this scope
/home/mwh/Desktop/Downloads/luabind-master/luabind/detail/policy.hpp:499:83: error: expected ‘)’ before ‘;’ token
make[2]: *** [src/CMakeFiles/luabind.dir/class.cpp.o] Error 1
make[2]: Leaving directory `/home/mwh/Desktop/Downloads/luabind-master/build'
make[1]: *** [src/CMakeFiles/luabind.dir/all] Error 2
make[1]: Leaving directory `/home/mwh/Desktop/Downloads/luabind-master/build'
make: *** [all] Error 2
What shall I do to correct this problem? I am using gcc 4.7.3, boost 1.53, Lua 5.2 in Ubuntu 12.04. Please help.
I just checked out the project at revision 05c84a034e and built it on Mac OS X. Here's what CMake told me at configure time:
-- The CXX compiler identification is GNU 4.7.3
-- Checking whether CXX compiler has -isysroot - yes
-- Checking whether CXX compiler supports OSX deployment target flag - yes
-- Check for working CXX compiler: /opt/local/bin/g++ -- works
-- Detecting CXX compiler ABI info - done
-- Boost version: 1.53.0
-- Found Lua52: /opt/local/lib/liblua.dylib;
So I have GCC 4.7.3, Boost 1.53, and Lua 5.2. I see you have GCC 4.7.3 also, but what about Boost and Lua?
Edit: Here's my compilation line from make VERBOSE=1 for the first file:
g++ -Wall -std=c++11 -pedantic -Wall -Wextra -Wcast-align -Wcast-qual -Wctor-dtor-privacy -Wdisabled-optimization -Wformat=2 -Winit-self -Wlogical-op -Wmissing-declarations -Wmissing-include-dirs -Wnoexcept -Wold-style-cast -Woverloaded-virtual -Wredundant-decls -Wshadow -Wsign-conversion -Wsign-promo -Wstrict-null-sentinel -Wstrict-overflow=5 -Wno-deprecated-declarations -o CMakeFiles/luabind.dir/class.cpp.o -c class.cpp
You on the other hand show this:
g++-4.7 -o CMakeFiles/luabind.dir/class.cpp.o -c class.cpp
So the question is, where did all your compiler flags go? The top-level CMakeLists.txt should contain this:
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++11")
And a bunch more. Since you aren't getting those flags set, you need to figure out why. You might try adding some message("I am here") debug statements in your CMakeLists.txt and running cmake again from scratch to see if the expected parts of the configuration are being executed at all. The key thing here is that your compilation line lacks -std=c++11--that's why you get the error you have.

Having difficulty to install git using Homebrew

I am watching this video to install git using Homebrew. I already got Homebrew installed. The problem i have is installing git using Homebrew. I typed brew install git and have certain error message.
Error msg:
./generate-cmdlist.sh > common-cmds.h+ && mv common-cmds.h+ common-cmds.h
/usr/bin/xcrun clang -o hex.o -c -MF ./.depend/hex.o.d -MMD -MP -Os -w -pipe -march=native -Qunused-arguments -I. -DUSE_ST_TIMESPEC -DNO_GETTEXT -DHAVE_DEV_TTY -DSHA1_HEADER='<openssl/sha.h>' -DNO_MEMMEM hex.c
/usr/bin/xcrun clang -o ident.o -c -MF ./.depend/ident.o.d -MMD -MP -Os -w -pipe -march=native -Qunused-arguments -I. -DUSE_ST_TIMESPEC -DNO_GETTEXT -DHAVE_DEV_TTY -DSHA1_HEADER='<openssl/sha.h>' -DNO_MEMMEM ident.c
/usr/bin/xcrun clang -o kwset.o -c -MF ./.depend/kwset.o.d -MMD -MP -Os -w -pipe -march=native -Qunused-arguments -I. -DUSE_ST_TIMESPEC -DNO_GETTEXT -DHAVE_DEV_TTY -DSHA1_HEADER='<openssl/sha.h>' -DNO_MEMMEM kwset.c
In file included from ident.c:8:
In file included from ./cache.h:4:
./git-compat-util.h:93:10: fatal error: 'unistd.h' file not found
#include <unistd.h>
^
In file included from hex.c:1:
In file included from ./cache.h:4:
./git-compat-util.h:93:10: fatal error: 'unistd.h' file not found
#include <unistd.h>
^
In file included from kwset.c:37:
In file included from ./cache.h:4:
./git-compat-util.h:93:10: fatal error: 'unistd.h' file not found
#include <unistd.h>
^
1 error generated.
make: *** [hex.o] Error 1
1 error generated.
make: *** Waiting for unfinished jobs....
make: *** [ident.o] Error 1
1 error generated.
make: *** [kwset.o] Error 1
==> Build Environment
CPU: quad-core 64-bit sandybridge
MacOS: 10.7.4-x86_64
Xcode: 4.3.2
CC: /usr/bin/xcrun clang => /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
CXX: /usr/bin/xcrun clang++ => /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++
LD: /usr/bin/xcrun clang => /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
CFLAGS: -Os -w -pipe -march=native -Qunused-arguments
CXXFLAGS: -Os -w -pipe -march=native -Qunused-arguments
MAKEFLAGS: -j4
Error: Failed executing: make prefix=/usr/local/Cellar/git/1.7.10.3 CC=/usr/bin/xcrun\ clang CFLAGS=-Os\ -w\ -pipe\ -march=native\ -Qunused-arguments LDFLAGS= install (git.rb:49)
These existing issues may help you:
https://github.com/mxcl/homebrew/issues/8643
https://github.com/mxcl/homebrew/issues/9023
https://github.com/mxcl/homebrew/issues/9618
https://github.com/mxcl/homebrew/issues/10544
https://github.com/mxcl/homebrew/issues/11481
https://github.com/mxcl/homebrew/issues/12325
https://github.com/mxcl/homebrew/issues/12344
https://github.com/mxcl/homebrew/issues/12400
https://github.com/mxcl/homebrew/issues/12478
Otherwise, please report the bug:
https://github.com/mxcl/homebrew/wiki/reporting-bugs
How do i solve this error? Need some help
You must install the command-line tools through Xcode to get the needed headers.
I suggest you to download it. Also, if you use github, I suggest you to just read this page. One year ago I started in this way.

Resources