Compiling cpputest with mingw-w64 - cmake

I'm trying to compile cpputest with mingw-w64 but can't make it work and I can't find any resources on how to do that. So hopefully this question will help others in the future.
I would like to compile cpputest using mingw-w64, preferably without installing MSYS2 or other packages.
I have mingw-w64 i686-8.1.0-posix-dwarf-rt_v6-rev0 installed. I've cloned cpputest from here.
I tried following Compiling Google test with Mingw-w64 and Compiling and using CppUTest 3.8 under MSYS2/MinGW32 by calling CMake with:
cmake ^
-G "MinGW Makefiles" ^
-D CMAKE_C_COMPILER=gcc.exe ^
-D CMAKE_CXX_COMPILER=g++.exe ^
-D CMAKE_MAKE_PROGRAM=mingw32-make.exe ^
-D C++11=ON ^
.
Which yields:
-------------------------------------------------------
CppUTest Version 3.8
Current compiler options:
CC: C:/mingw-w64/i686-8.1.0-posix-dwarf-rt_v6-rev0/mingw32/bin/gcc.exe
CXX: C:/mingw-w64/i686-8.1.0-posix-dwarf-rt_v6-rev0/mingw32/bin/g++.exe
CppUTest CFLAGS: -include "C:/git/tdd/cpputest/include/CppUTest/MemoryLeakDetectorMallocMacros.h" -Wall -Wextra -pedantic -Wshadow -Wswitch-default -Wswitch-enum -Wconversion -Wsign-conversion -Wno-padded -Wno-long-long -Wstrict-prototypes
CppUTest CXXFLAGS: -include "C:/git/tdd/cpputest/include/CppUTest/MemoryLeakDetectorNewMacros.h" -include "C:/git/tdd/cpputest/include/CppUTest/MemoryLeakDetectorMallocMacros.h" -Wall -Wextra -pedantic -Wshadow -Wswitch-default -Wswitch-enum -Wconversion -Wsign-conversion -Wno-padded -Wno-long-long -Woverloaded-virtual -Wno-old-style-cast -Wno-c++14-compat
CppUTest LDFLAGS:
Features configured in CppUTest:
Memory Leak Detection: ON
Compiling Extensions: ON
Support Long Long: OFF
Use CppUTest flags: ON
Using Standard C library: ON
Using Standard C++ library: ON
Using C++11 library: ON
Generating map file: OFF
Compiling with coverage: OFF
Compile and run self-tests ON
Run self-tests separately OFF
-------------------------------------------------------
Running make fails with:
>mingw32-make.exe
Scanning dependencies of target CppUTest
[ 1%] Building CXX object src/CppUTest/CMakeFiles/CppUTest.dir/CommandLineArguments.cpp.obj
In file included from C:/git/tdd/cpputest/include/CppUTest/Utest.h:34,
from C:/git/tdd/cpputest/include/CppUTest/TestHarness.h:39,
from C:\git\tdd\cpputest\src\CppUTest\CommandLineArguments.cpp:29:
C:/git/tdd/cpputest/include/CppUTest/SimpleString.h:183:31: error: 'nullptr_t' does not name a type
SimpleString StringFrom(const nullptr_t value);
^~~~~~~~~
C:/git/tdd/cpputest/include/CppUTest/SimpleString.h:183:31: note: 'nullptr_t' is defined in header '<cstddef>'; did you forget to '#include <cstddef>'?
C:/git/tdd/cpputest/include/CppUTest/SimpleString.h:42:1:
+#include <cstddef>
C:/git/tdd/cpputest/include/CppUTest/SimpleString.h:183:31:
SimpleString StringFrom(const nullptr_t value);
^~~~~~~~~
mingw32-make.exe[2]: *** [src\CppUTest\CMakeFiles\CppUTest.dir\build.make:63: src/CppUTest/CMakeFiles/CppUTest.dir/CommandLineArguments.cpp.obj] Error 1
mingw32-make.exe[1]: *** [CMakeFiles\Makefile2:886: src/CppUTest/CMakeFiles/CppUTest.dir/all] Error 2
mingw32-make.exe: *** [Makefile:140: all] Error 2
I tried the obvious solution of adding cstddef to SimpleString.h:
--- a/include/CppUTest/SimpleString.h
+++ b/include/CppUTest/SimpleString.h
## -180,6 +180,9 ## SimpleString BracketsFormattedHexString(SimpleString hexString);
* Specifically nullptr_t is not officially supported
*/
#if __cplusplus > 199711L && !defined __arm__
+
+#include <cstddef>
+
SimpleString StringFrom(const nullptr_t value);
#endif
But that still fails with the same error.
So I tried following Build error with CMake and MSYS2 mingw-w64 by installing MSYS2 and then mingw-w64, CMake and Ninja. That gives:
-------------------------------------------------------
CppUTest Version 3.8
Current compiler options:
CC: C:/msys64/mingw64/bin/cc.exe
CXX: C:/msys64/mingw64/bin/c++.exe
CppUTest CFLAGS: -include "C:/git/tdd/cpputest/include/CppUTest/MemoryLeakDetectorMallocMacros.h" -Wall -Wextra -pedantic -Wshadow -Wswitch-default -Wswitch-enum -Wconversion -Wsign-conversion -Wno-padded -Wno-long-long -Wstrict-prototypes
CppUTest CXXFLAGS: -include "C:/git/tdd/cpputest/include/CppUTest/MemoryLeakDetectorNewMacros.h" -include "C:/git/tdd/cpputest/include/CppUTest/MemoryLeakDetectorMallocMacros.h" -Wall -Wextra -pedantic -Wshadow -Wswitch-default -Wswitch-enum -Wconversion -Wsign-conversion -Wno-padded -Wno-long-long -Woverloaded-virtual -Wno-old-style-cast
CppUTest LDFLAGS:
Features configured in CppUTest:
Memory Leak Detection: ON
Compiling Extensions: ON
Support Long Long: OFF
Use CppUTest flags: ON
Using Standard C library: ON
Using Standard C++ library: ON
Using C++11 library: OFF
Generating map file: OFF
Compiling with coverage: OFF
Compile and run self-tests ON
Run self-tests separately OFF
-------------------------------------------------------
Compiling with cmake -G Ninja . && ninja fails with:
include/CppUTest/SimpleString.h:183:31:
SimpleString StringFrom(const nullptr_t value);
^~~~~~~~~
[10/98] Building CXX object src/CppUTest/CMakeFiles/CppUTest.dir/TestMemoryAllocator.cpp.obj
FAILED: src/CppUTest/CMakeFiles/CppUTest.dir/TestMemoryAllocator.cpp.obj
C:\msys64\mingw64\bin\c++.exe -DCPPUTEST_HAVE_STRDUP=1 -DHAVE_CONFIG_H -D_TIMESPEC_DEFINED=1 -I. -Iinclude -Isrc/CppUTest/../../include -include "C:/git/tdd/cpputest/include/CppUTest/MemoryLeakDetectorNewMacros.h" -include "C:/git/tdd/cpputest/include/CppUTest/MemoryLeakDetectorMallocMacros.h" -Wall -Wextra -pedantic -Wshadow -Wswitch-default -Wswitch-enum -Wconversion -Wsign-conversion -Wno-padded -Wno-long-long -Woverloaded-virtual -Wno-old-style-cast -O2 -g -DNDEBUG -MD -MT src/CppUTest/CMakeFiles/CppUTest.dir/TestMemoryAllocator.cpp.obj -MF src\CppUTest\CMakeFiles\CppUTest.dir\TestMemoryAllocator.cpp.obj.d -o src/CppUTest/CMakeFiles/CppUTest.dir/TestMemoryAllocator.cpp.obj -c src/CppUTest/TestMemoryAllocator.cpp
In file included from include/CppUTest/Utest.h:34,
from include/CppUTest/TestHarness.h:39,
from src/CppUTest/TestMemoryAllocator.cpp:28:
include/CppUTest/SimpleString.h:183:31: error: 'nullptr_t' does not name a type
SimpleString StringFrom(const nullptr_t value);
^~~~~~~~~
include/CppUTest/SimpleString.h:183:31: note: 'nullptr_t' is defined in header '<cstddef>'; did you forget to '#include <cstddef>'?
include/CppUTest/SimpleString.h:42:1:
+#include <cstddef>
include/CppUTest/SimpleString.h:183:31:
SimpleString StringFrom(const nullptr_t value);
^~~~~~~~~
ninja: build stopped: subcommand failed.
Thanks!!

Turns out this was a bug in CppUtest.
## -562,7 +562,7 ## SimpleString BracketsFormattedHexString(SimpleString hexString)
* Specifically nullptr_t is not officially supported
*/
#if __cplusplus > 199711L && !defined __arm__
- SimpleString StringFrom(const nullptr_t value)
+ SimpleString StringFrom(const std::nullptr_t value)
{
(void) value;
return "(null)";
It's fixed since Dec. 5th, 2019.
https://github.com/leonardopsantos/cpputest/commit/cb8c457dda6741ede7009103db99967b5f27c969

Related

How CMake automatically detects header dependencies

I wonder how CMake automatically detects that main.cpp depends on header.h
// header.h
int f() {
return 0;
}
// main.cpp
#include "header.h"
int main() {
return f();
}
# CMakeLists.txt
cmake_minimum_required(VERSION 3.16)
project(Cppref)
add_executable(main main.cpp)
When I run cmake . -B build it creates the following make target in ./build/CMakeFiles/main.dir/build.make
CMakeFiles/main.dir/main.cpp.o: CMakeFiles/main.dir/compiler_depend.ts
#$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green --progress-dir=/home/nikolay/Cpp/Train/Cppref/build/CMakeFiles --progress-num=$(CMAKE_PROGRESS_1) "Building CXX object CMakeFiles/main.dir/main.cpp.o"
/usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -MD -MT CMakeFiles/main.dir/main.cpp.o -MF CMakeFiles/main.dir/main.cpp.o.d -o CMakeFiles/main.dir/main.cpp.o -c /home/nikolay/Cpp/Train/Cppref/main.cpp
Pay attention to the -MD compiler option, as
it is used to dump dependencies visible to the preprocessor.
So after the first build it will create ./build/CMakeFiles/main.dir/main.cpp.o.d with the following content
CMakeFiles/main.dir/main.cpp.o: /home/nikolay/Cpp/Train/Cppref/main.cpp \
/home/nikolay/Cpp/Train/Cppref/header.h
So whenever you change header.h, the target main.o will be rebuilt.

Errors while building vlc-qt from source with QT 5.12.3

i am trying to build vlc-qt from source with the QT5.12.3 (need this specific version)
I tried to use with ninja and mingw makefiles and i get those error and i tried with more then 10 other vlc sdk versions
Source:
vlc-qt 1.1.1 and 1.2.0 - https://github.com/bibiparrot/vlc-qt
vlc 3.0.16 - http://download.videolan.org/pub/videolan/vlc/last/win64/
qt 5.12.3 - https://download.qt.io/official_releases/qt/5.12/5.12.3/
Errors with MinGW: full log (https://pastebin.com/raw/9U9Z9BTt)
C:\vlc-qt\build>cmake .. -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Debug ^ -DCMAKE_INSTALL_PREFIX="C:\vlc-qt\build" ^ -DQt5Core_DIR="C:\Qt\Qt5.12.3\5.12.3\msvc2017_64\lib\cmake\Qt5Core" -DQt5Quick_DIR="C:\Qt\Qt5.12.3\5.12.3\msvc2017_64\lib\cmake\Qt5Quick" -DQt5Widgets_DIR="C:\Qt\Qt5.12.3\5.12.3\msvc2017_64\lib\cmake\Qt5Widgets" -DQt5QuickTest_DIR="C:\Qt\Qt5.12.3\5.12.3\msvc2017_64\lib\cmake\Qt5QuickTest" -DQt5Test_DIR="C:\Qt\Qt5.12.3\lib\cmake\Qt5Test" -DLIBVLC_LIBRARY="C:\vlc-3.0.16\sdk\lib\libvlc.lib" ^ -DLIBVLCCORE_LIBRARY="C:\vlc-3.0.16\sdk\lib\libvlccore.lib" ^ -DLIBVLC_INCLUDE_DIR="C:\vlc-3.0.16\sdk\include"
-- Building VLC-Qt 1.2.0
-- Git revision: 7616e81
-- The C compiler identification is GNU 8.3.0
-- The CXX compiler identification is GNU 8.3.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Strawberry/c/bin/gcc.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Strawberry/c/bin/g++.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Build statically: OFF
-- Using Qt 5.12.3
-- Installing to system QML import path: OFF
-- Found LibVLC include-dir path: C:/vlc-3.0.16/sdk/include
-- Found LibVLC library path:C:/vlc-3.0.16/sdk/lib/libvlc.lib
-- Found LibVLCcore library path:C:/vlc-3.0.16/sdk/lib/libvlccore.lib
-- Configuring done
-- Generating done
-- Build files have been written to: C:/vlc-qt/build
C:\vlc-qt\build>mingw32-make
"C:\Program Files\CMake\bin\cmake.exe" -SC:\vlc-qt -BC:\vlc-qt\build --check-build-system CMakeFiles\Makefile.cmake 0
"C:\Program Files\CMake\bin\cmake.exe" -E cmake_progress_start C:\vlc-qt\build\CMakeFiles C:\vlc-qt\build\\CMakeFiles\progress.marks
mingw32-make -f CMakeFiles\Makefile2 all
mingw32-make[1]: Entering directory 'C:/vlc-qt/build'
mingw32-make -f src\core\CMakeFiles\Core_autogen.dir\build.make src/core/CMakeFiles/Core_autogen.dir/depend
mingw32-make[2]: Entering directory 'C:/vlc-qt/build'
"C:\Program Files\CMake\bin\cmake.exe" -E cmake_depends "MinGW Makefiles" C:\vlc-qt C:\vlc-qt\src\core C:\vlc-qt\build C:\vlc-qt\build\src\core C:\vlc-qt\build\src\core\CMakeFiles\Core_autogen.dir\DependInfo.cmake --color=
Scanning dependencies of target Core_autogen
mingw32-make[2]: Leaving directory 'C:/vlc-qt/build'
mingw32-make -f src\core\CMakeFiles\Core_autogen.dir\build.make src/core/CMakeFiles/Core_autogen.dir/build
mingw32-make[2]: Entering directory 'C:/vlc-qt/build'
[ 1%] Automatic MOC and UIC for target Core
cd /d C:\vlc-qt\build\src\core && "C:\Program Files\CMake\bin\cmake.exe" -E cmake_autogen C:/vlc-qt/build/src/core/CMakeFiles/Core_autogen.dir/AutogenInfo.json Debug
mingw32-make[2]: Leaving directory 'C:/vlc-qt/build'
[ 1%] Built target Core_autogen
mingw32-make -f src\core\CMakeFiles\Core.dir\build.make src/core/CMakeFiles/Core.dir/depend
mingw32-make[2]: Entering directory 'C:/vlc-qt/build'
[ 2%] Generating VLCQtCore.obj
cd /d C:\vlc-qt\src\core && C:\Strawberry\c\bin\windres.exe -i C:/vlc-qt/build/src/core/VLCQtCore.rc -o C:/vlc-qt/build/src/core/VLCQtCore.obj
"C:\Program Files\CMake\bin\cmake.exe" -E cmake_depends "MinGW Makefiles" C:\vlc-qt C:\vlc-qt\src\core C:\vlc-qt\build C:\vlc-qt\build\src\core C:\vlc-qt\build\src\core\CMakeFiles\Core.dir\DependInfo.cmake --color=
Scanning dependencies of target Core
mingw32-make[2]: Leaving directory 'C:/vlc-qt/build'
mingw32-make -f src\core\CMakeFiles\Core.dir\build.make src/core/CMakeFiles/Core.dir/build
mingw32-make[2]: Entering directory 'C:/vlc-qt/build'
[ 3%] Building CXX object src/core/CMakeFiles/Core.dir/Core_autogen/mocs_compilation.cpp.obj
cd /d C:\vlc-qt\build\src\core && C:\Strawberry\c\bin\g++.exe -DCore_EXPORTS -DQT_CORE_LIB -DQT_SHARED -DVLCQT_CORE_LIBRARY -D_REENTRANT #CMakeFiles/Core.dir/includes_CXX.rsp -g -Wall -Wextra -std=gnu++11 -o CMakeFiles\Core.dir\Core_autogen\mocs_compilation.cpp.obj -c C:\vlc-qt\build\src\core\Core_autogen\mocs_compilation.cpp
[ 4%] Building CXX object src/core/CMakeFiles/Core.dir/AbstractVideoFrame.cpp.obj
cd /d C:\vlc-qt\build\src\core && C:\Strawberry\c\bin\g++.exe -DCore_EXPORTS -DQT_CORE_LIB -DQT_SHARED -DVLCQT_CORE_LIBRARY -D_REENTRANT #CMakeFiles/Core.dir/includes_CXX.rsp -g -Wall -Wextra -std=gnu++11 -o CMakeFiles\Core.dir\AbstractVideoFrame.cpp.obj -c C:\vlc-qt\src\core\AbstractVideoFrame.cpp
[ 5%] Building CXX object src/core/CMakeFiles/Core.dir/AbstractVideoStream.cpp.obj
cd /d C:\vlc-qt\build\src\core && C:\Strawberry\c\bin\g++.exe -DCore_EXPORTS -DQT_CORE_LIB -DQT_SHARED -DVLCQT_CORE_LIBRARY -D_REENTRANT #CMakeFiles/Core.dir/includes_CXX.rsp -g -Wall -Wextra -std=gnu++11 -o CMakeFiles\Core.dir\AbstractVideoStream.cpp.obj -c C:\vlc-qt\src\core\AbstractVideoStream.cpp
[ 6%] Building CXX object src/core/CMakeFiles/Core.dir/Audio.cpp.obj
cd /d C:\vlc-qt\build\src\core && C:\Strawberry\c\bin\g++.exe -DCore_EXPORTS -DQT_CORE_LIB -DQT_SHARED -DVLCQT_CORE_LIBRARY -D_REENTRANT #CMakeFiles/Core.dir/includes_CXX.rsp -g -Wall -Wextra -std=gnu++11 -o CMakeFiles\Core.dir\Audio.cpp.obj -c C:\vlc-qt\src\core\Audio.cpp
[ 7%] Building CXX object src/core/CMakeFiles/Core.dir/Common.cpp.obj
cd /d C:\vlc-qt\build\src\core && C:\Strawberry\c\bin\g++.exe -DCore_EXPORTS -DQT_CORE_LIB -DQT_SHARED -DVLCQT_CORE_LIBRARY -D_REENTRANT #CMakeFiles/Core.dir/includes_CXX.rsp -g -Wall -Wextra -std=gnu++11 -o CMakeFiles\Core.dir\Common.cpp.obj -c C:\vlc-qt\src\core\Common.cpp
[ 9%] Building CXX object src/core/CMakeFiles/Core.dir/Enums.cpp.obj
cd /d C:\vlc-qt\build\src\core && C:\Strawberry\c\bin\g++.exe -DCore_EXPORTS -DQT_CORE_LIB -DQT_SHARED -DVLCQT_CORE_LIBRARY -D_REENTRANT #CMakeFiles/Core.dir/includes_CXX.rsp -g -Wall -Wextra -std=gnu++11 -o CMakeFiles\Core.dir\Enums.cpp.obj -c C:\vlc-qt\src\core\Enums.cpp
[ 10%] Building CXX object src/core/CMakeFiles/Core.dir/Error.cpp.obj
cd /d C:\vlc-qt\build\src\core && C:\Strawberry\c\bin\g++.exe -DCore_EXPORTS -DQT_CORE_LIB -DQT_SHARED -DVLCQT_CORE_LIBRARY -D_REENTRANT #CMakeFiles/Core.dir/includes_CXX.rsp -g -Wall -Wextra -std=gnu++11 -o CMakeFiles\Core.dir\Error.cpp.obj -c C:\vlc-qt\src\core\Error.cpp
[ 11%] Building CXX object src/core/CMakeFiles/Core.dir/Instance.cpp.obj
cd /d C:\vlc-qt\build\src\core && C:\Strawberry\c\bin\g++.exe -DCore_EXPORTS -DQT_CORE_LIB -DQT_SHARED -DVLCQT_CORE_LIBRARY -D_REENTRANT #CMakeFiles/Core.dir/includes_CXX.rsp -g -Wall -Wextra -std=gnu++11 -o CMakeFiles\Core.dir\Instance.cpp.obj -c C:\vlc-qt\src\core\Instance.cpp
[ 12%] Building CXX object src/core/CMakeFiles/Core.dir/Media.cpp.obj
cd /d C:\vlc-qt\build\src\core && C:\Strawberry\c\bin\g++.exe -DCore_EXPORTS -DQT_CORE_LIB -DQT_SHARED -DVLCQT_CORE_LIBRARY -D_REENTRANT #CMakeFiles/Core.dir/includes_CXX.rsp -g -Wall -Wextra -std=gnu++11 -o CMakeFiles\Core.dir\Media.cpp.obj -c C:\vlc-qt\src\core\Media.cpp
C:\vlc-qt\src\core\Media.cpp: In static member function 'static void VlcMedia::libvlc_callback(const libvlc_event_t*, void*)':
C:\vlc-qt\src\core\Media.cpp:363:74: warning: 'void VlcMedia::parsedChanged(int)' is deprecated [-Wdeprecated-declarations]
emit core->parsedChanged(event->u.media_parsed_changed.new_status);
^
In file included from C:\vlc-qt\src\core\Media.cpp:26:
C:/vlc-qt/src/core/Media.h:321:28: note: declared here
Q_DECL_DEPRECATED void parsedChanged(int status);
^~~~~~~~~~~~~
[ 13%] Building CXX object src/core/CMakeFiles/Core.dir/MediaList.cpp.obj
cd /d C:\vlc-qt\build\src\core && C:\Strawberry\c\bin\g++.exe -DCore_EXPORTS -DQT_CORE_LIB -DQT_SHARED -DVLCQT_CORE_LIBRARY -D_REENTRANT #CMakeFiles/Core.dir/includes_CXX.rsp -g -Wall -Wextra -std=gnu++11 -o CMakeFiles\Core.dir\MediaList.cpp.obj -c C:\vlc-qt\src\core\MediaList.cpp
[ 14%] Building CXX object src/core/CMakeFiles/Core.dir/MediaListPlayer.cpp.obj
cd /d C:\vlc-qt\build\src\core && C:\Strawberry\c\bin\g++.exe -DCore_EXPORTS -DQT_CORE_LIB -DQT_SHARED -DVLCQT_CORE_LIBRARY -D_REENTRANT #CMakeFiles/Core.dir/includes_CXX.rsp -g -Wall -Wextra -std=gnu++11 -o CMakeFiles\Core.dir\MediaListPlayer.cpp.obj -c C:\vlc-qt\src\core\MediaListPlayer.cpp
[ 15%] Building CXX object src/core/CMakeFiles/Core.dir/MediaPlayer.cpp.obj
cd /d C:\vlc-qt\build\src\core && C:\Strawberry\c\bin\g++.exe -DCore_EXPORTS -DQT_CORE_LIB -DQT_SHARED -DVLCQT_CORE_LIBRARY -D_REENTRANT #CMakeFiles/Core.dir/includes_CXX.rsp -g -Wall -Wextra -std=gnu++11 -o CMakeFiles\Core.dir\MediaPlayer.cpp.obj -c C:\vlc-qt\src\core\MediaPlayer.cpp
[ 17%] Building CXX object src/core/CMakeFiles/Core.dir/MetaManager.cpp.obj
cd /d C:\vlc-qt\build\src\core && C:\Strawberry\c\bin\g++.exe -DCore_EXPORTS -DQT_CORE_LIB -DQT_SHARED -DVLCQT_CORE_LIBRARY -D_REENTRANT #CMakeFiles/Core.dir/includes_CXX.rsp -g -Wall -Wextra -std=gnu++11 -o CMakeFiles\Core.dir\MetaManager.cpp.obj -c C:\vlc-qt\src\core\MetaManager.cpp
[ 18%] Building CXX object src/core/CMakeFiles/Core.dir/ModuleDescription.cpp.obj
cd /d C:\vlc-qt\build\src\core && C:\Strawberry\c\bin\g++.exe -DCore_EXPORTS -DQT_CORE_LIB -DQT_SHARED -DVLCQT_CORE_LIBRARY -D_REENTRANT #CMakeFiles/Core.dir/includes_CXX.rsp -g -Wall -Wextra -std=gnu++11 -o CMakeFiles\Core.dir\ModuleDescription.cpp.obj -c C:\vlc-qt\src\core\ModuleDescription.cpp
[ 19%] Building CXX object src/core/CMakeFiles/Core.dir/TrackModel.cpp.obj
cd /d C:\vlc-qt\build\src\core && C:\Strawberry\c\bin\g++.exe -DCore_EXPORTS -DQT_CORE_LIB -DQT_SHARED -DVLCQT_CORE_LIBRARY -D_REENTRANT #CMakeFiles/Core.dir/includes_CXX.rsp -g -Wall -Wextra -std=gnu++11 -o CMakeFiles\Core.dir\TrackModel.cpp.obj -c C:\vlc-qt\src\core\TrackModel.cpp
C:\vlc-qt\src\core\TrackModel.cpp: In copy constructor 'VlcTrackModel::VlcTrackModel(const VlcTrackModel&)':
C:\vlc-qt\src\core\TrackModel.cpp:29:1: warning: base class 'class QAbstractListModel' should be explicitly initialized in the copy constructor [-Wextra]
VlcTrackModel::VlcTrackModel(const VlcTrackModel &other)
^~~~~~~~~~~~~
[ 20%] Building CXX object src/core/CMakeFiles/Core.dir/Video.cpp.obj
cd /d C:\vlc-qt\build\src\core && C:\Strawberry\c\bin\g++.exe -DCore_EXPORTS -DQT_CORE_LIB -DQT_SHARED -DVLCQT_CORE_LIBRARY -D_REENTRANT #CMakeFiles/Core.dir/includes_CXX.rsp -g -Wall -Wextra -std=gnu++11 -o CMakeFiles\Core.dir\Video.cpp.obj -c C:\vlc-qt\src\core\Video.cpp
[ 21%] Building CXX object src/core/CMakeFiles/Core.dir/VideoStream.cpp.obj
cd /d C:\vlc-qt\build\src\core && C:\Strawberry\c\bin\g++.exe -DCore_EXPORTS -DQT_CORE_LIB -DQT_SHARED -DVLCQT_CORE_LIBRARY -D_REENTRANT #CMakeFiles/Core.dir/includes_CXX.rsp -g -Wall -Wextra -std=gnu++11 -o CMakeFiles\Core.dir\VideoStream.cpp.obj -c C:\vlc-qt\src\core\VideoStream.cpp
[ 22%] Building CXX object src/core/CMakeFiles/Core.dir/YUVVideoFrame.cpp.obj
cd /d C:\vlc-qt\build\src\core && C:\Strawberry\c\bin\g++.exe -DCore_EXPORTS -DQT_CORE_LIB -DQT_SHARED -DVLCQT_CORE_LIBRARY -D_REENTRANT #CMakeFiles/Core.dir/includes_CXX.rsp -g -Wall -Wextra -std=gnu++11 -o CMakeFiles\Core.dir\YUVVideoFrame.cpp.obj -c C:\vlc-qt\src\core\YUVVideoFrame.cpp
[ 23%] Building CXX object src/core/CMakeFiles/Core.dir/VideoFrame.cpp.obj
cd /d C:\vlc-qt\build\src\core && C:\Strawberry\c\bin\g++.exe -DCore_EXPORTS -DQT_CORE_LIB -DQT_SHARED -DVLCQT_CORE_LIBRARY -D_REENTRANT #CMakeFiles/Core.dir/includes_CXX.rsp -g -Wall -Wextra -std=gnu++11 -Wno-deprecated -o CMakeFiles\Core.dir\VideoFrame.cpp.obj -c C:\vlc-qt\src\core\VideoFrame.cpp
[ 25%] Building CXX object src/core/CMakeFiles/Core.dir/VideoMemoryStream.cpp.obj
cd /d C:\vlc-qt\build\src\core && C:\Strawberry\c\bin\g++.exe -DCore_EXPORTS -DQT_CORE_LIB -DQT_SHARED -DVLCQT_CORE_LIBRARY -D_REENTRANT #CMakeFiles/Core.dir/includes_CXX.rsp -g -Wall -Wextra -std=gnu++11 -Wno-deprecated -o CMakeFiles\Core.dir\VideoMemoryStream.cpp.obj -c C:\vlc-qt\src\core\VideoMemoryStream.cpp
C:\vlc-qt\src\core\VideoMemoryStream.cpp:27:56: warning: 'VlcVideoMemoryStream' is deprecated [-Wdeprecated-declaration
]
static inline VlcVideoMemoryStream *p_this(void *opaque) { return static_cast<VlcVideoMemoryStream *>(opaque); }
^
In file included from C:\vlc-qt\src\core\VideoMemoryStream.cpp:25:
C:/vlc-qt/src/core/VideoMemoryStream.h:55:43: note: declared here
class Q_DECL_DEPRECATED VLCQT_CORE_EXPORT VlcVideoMemoryStream
^~~~~~~~~~~~~~~~~~~~
C:\vlc-qt\src\core\VideoMemoryStream.cpp: In function 'VlcVideoMemoryStream* p_this(void*)':
C:\vlc-qt\src\core\VideoMemoryStream.cpp:27:100: warning: 'VlcVideoMemoryStream' is deprecated [-Wdeprecated-declarations]
static inline VlcVideoMemoryStream *p_this(void *opaque) { return static_cast<VlcVideoMemoryStream *>(opaque); }
^
In file included from C:\vlc-qt\src\core\VideoMemoryStream.cpp:25:
C:/vlc-qt/src/core/VideoMemoryStream.h:55:43: note: declared here
class Q_DECL_DEPRECATED VLCQT_CORE_EXPORT VlcVideoMemoryStream
^~~~~~~~~~~~~~~~~~~~
C:\vlc-qt\src\core\VideoMemoryStream.cpp: At global scope:
C:\vlc-qt\src\core\VideoMemoryStream.cpp:28:57: warning: 'VlcVideoMemoryStream' is deprecated [-Wdeprecated-declaration
]
static inline VlcVideoMemoryStream *p_this(void **opaque) { return static_cast<VlcVideoMemoryStream *>(*opaque); }
^
In file included from C:\vlc-qt\src\core\VideoMemoryStream.cpp:25:
C:/vlc-qt/src/core/VideoMemoryStream.h:55:43: note: declared here
class Q_DECL_DEPRECATED VLCQT_CORE_EXPORT VlcVideoMemoryStream
^~~~~~~~~~~~~~~~~~~~
C:\vlc-qt\src\core\VideoMemoryStream.cpp: In function 'VlcVideoMemoryStream* p_this(void**)':
C:\vlc-qt\src\core\VideoMemoryStream.cpp:28:101: warning: 'VlcVideoMemoryStream' is deprecated [-Wdeprecated-declarations]
static inline VlcVideoMemoryStream *p_this(void **opaque) { return static_cast<VlcVideoMemoryStream *>(*opaque); }
^
In file included from C:\vlc-qt\src\core\VideoMemoryStream.cpp:25:
C:/vlc-qt/src/core/VideoMemoryStream.h:55:43: note: declared here
class Q_DECL_DEPRECATED VLCQT_CORE_EXPORT VlcVideoMemoryStream
^~~~~~~~~~~~~~~~~~~~
[ 26%] Building CXX object src/core/CMakeFiles/Core.dir/Equalizer.cpp.obj
cd /d C:\vlc-qt\build\src\core && C:\Strawberry\c\bin\g++.exe -DCore_EXPORTS -DQT_CORE_LIB -DQT_SHARED -DVLCQT_CORE_LIBRARY -D_REENTRANT #CMakeFiles/Core.dir/includes_CXX.rsp -g -Wall -Wextra -std=gnu++11 -o CMakeFiles\Core.dir\Equalizer.cpp.obj -c C:\vlc-qt\src\core\Equalizer.cpp
[ 27%] Building C object src/core/CMakeFiles/Core.dir/compat/asprintf.c.obj
cd /d C:\vlc-qt\build\src\core && C:\Strawberry\c\bin\gcc.exe -DCore_EXPORTS -DQT_CORE_LIB -DQT_SHARED -DVLCQT_CORE_LIBRARY -D_REENTRANT #CMakeFiles/Core.dir/includes_C.rsp -g -Wall -Wextra -o CMakeFiles\Core.dir\compat\asprintf.c.obj -c C:\vlc-qt\src\core\compat\asprintf.c
[ 28%] Building C object src/core/CMakeFiles/Core.dir/compat/vasprintf.c.obj
cd /d C:\vlc-qt\build\src\core && C:\Strawberry\c\bin\gcc.exe -DCore_EXPORTS -DQT_CORE_LIB -DQT_SHARED -DVLCQT_CORE_LIBRARY -D_REENTRANT #CMakeFiles/Core.dir/includes_C.rsp -g -Wall -Wextra -o CMakeFiles\Core.dir\compat\vasprintf.c.obj -c C:\vlc-qt\src\core\compat\vasprintf.c
[ 29%] Linking CXX shared library libVLCQtCored.dll
cd /d C:\vlc-qt\build\src\core && "C:\Program Files\CMake\bin\cmake.exe" -E cmake_link_script CMakeFiles\Core.dir\link.txt --verbose=1
"C:\Program Files\CMake\bin\cmake.exe" -E rm -f CMakeFiles\Core.dir/objects.a
Errors with ninja: full log (https://pastebin.com/raw/Fxidf7hi)
C:\vlc-qt\build>cmake .. -GNinja -DCMAKE_BUILD_TYPE=Debug ^ -DCMAKE_INSTALL_PREFIX="C:\vlc-qt\build" ^ -DQt5Core_DIR="C:\Qt\Qt5.12.3\5.12.3\msvc2017_64\lib\cmake\Qt5Core" -DQt5Quick_DIR="C:\Qt\Qt5.12.3\5.12.3\msvc2017_64\lib\cmake\Qt5Quick" -DQt5Widgets_DIR="C:\Qt\Qt5.12.3\5.12.3\msvc2017_64\lib\cmake\Qt5Widgets" -DQt5QuickTest_DIR="C:\Qt\Qt5.12.3\5.12.3\msvc2017_64\lib\cmake\Qt5QuickTest" -DQt5Test_DIR="C:\Qt\Qt5.12.3\lib\cmake\Qt5Test" -DLIBVLC_LIBRARY="C:\vlc-3.0.16\sdk\lib\libvlc.lib" ^ -DLIBVLCCORE_LIBRARY="C:\vlc-3.0.16\sdk\lib\libvlccore.lib" ^ -DLIBVLC_INCLUDE_DIR="C:\vlc-3.0.16\sdk\include"
-- Building VLC-Qt 1.2.0
-- Git revision: 7616e81
-- The C compiler identification is GNU 8.3.0
-- The CXX compiler identification is GNU 8.3.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Strawberry/c/bin/gcc.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Strawberry/c/bin/c++.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Build statically: OFF
-- Using Qt 5.12.3
-- Installing to system QML import path: OFF
-- Found LibVLC include-dir path: C:/vlc-3.0.16/sdk/include
-- Found LibVLC library path:C:/vlc-3.0.16/sdk/lib/libvlc.lib
-- Found LibVLCcore library path:C:/vlc-3.0.16/sdk/lib/libvlccore.lib
-- Configuring done
-- Generating done
-- Build files have been written to: C:/vlc-qt/build
C:\vlc-qt\build>ninja
[10/88] Building CXX object src/core/CMakeFiles/Core.dir/TrackModel.cpp.obj
../src/core/TrackModel.cpp: In copy constructor 'VlcTrackModel::VlcTrackModel(const VlcTrackModel&)':
../src/core/TrackModel.cpp:29:1: warning: base class 'class QAbstractListModel' should be explicitly initialized in the copy constructor [-Wextra]
VlcTrackModel::VlcTrackModel(const VlcTrackModel &other)
^~~~~~~~~~~~~
[17/88] Building CXX object src/core/CMakeFiles/Core.dir/Media.cpp.obj
../src/core/Media.cpp: In static member function 'static void VlcMedia::libvlc_callback(const libvlc_event_t*, void*)':
../src/core/Media.cpp:363:74: warning: 'void VlcMedia::parsedChanged(int)' is deprecated [-Wdeprecated-declarations]
emit core->parsedChanged(event->u.media_parsed_changed.new_status);
^
In file included from ../src/core/Media.cpp:26:
../src/core/Media.h:321:28: note: declared here
Q_DECL_DEPRECATED void parsedChanged(int status);
^~~~~~~~~~~~~
[25/88] Building CXX object src/core/CMakeFiles/Core.dir/VideoMemoryStream.cpp.obj
../src/core/VideoMemoryStream.cpp:27:56: warning: 'VlcVideoMemoryStream' is deprecated [-Wdeprecated-declarations]
static inline VlcVideoMemoryStream *p_this(void *opaque) { return static_cast<VlcVideoMemoryStream *>(opaque); }
^
In file included from ../src/core/VideoMemoryStream.cpp:25:
../src/core/VideoMemoryStream.h:55:43: note: declared here
class Q_DECL_DEPRECATED VLCQT_CORE_EXPORT VlcVideoMemoryStream
^~~~~~~~~~~~~~~~~~~~
../src/core/VideoMemoryStream.cpp: In function 'VlcVideoMemoryStream* p_this(void*)':
../src/core/VideoMemoryStream.cpp:27:100: warning: 'VlcVideoMemoryStream' is deprecated [-Wdeprecated-declarations]
static inline VlcVideoMemoryStream *p_this(void *opaque) { return static_cast<VlcVideoMemoryStream *>(opaque); }
^
In file included from ../src/core/VideoMemoryStream.cpp:25:
../src/core/VideoMemoryStream.h:55:43: note: declared here
class Q_DECL_DEPRECATED VLCQT_CORE_EXPORT VlcVideoMemoryStream
^~~~~~~~~~~~~~~~~~~~
../src/core/VideoMemoryStream.cpp: At global scope:
../src/core/VideoMemoryStream.cpp:28:57: warning: 'VlcVideoMemoryStream' is deprecated [-Wdeprecated-declarations]
static inline VlcVideoMemoryStream *p_this(void **opaque) { return static_cast<VlcVideoMemoryStream *>(*opaque); }
^
In file included from ../src/core/VideoMemoryStream.cpp:25:
../src/core/VideoMemoryStream.h:55:43: note: declared here
class Q_DECL_DEPRECATED VLCQT_CORE_EXPORT VlcVideoMemoryStream
^~~~~~~~~~~~~~~~~~~~
../src/core/VideoMemoryStream.cpp: In function 'VlcVideoMemoryStream* p_this(void**)':
../src/core/VideoMemoryStream.cpp:28:101: warning: 'VlcVideoMemoryStream' is deprecated [-Wdeprecated-declarations]
static inline VlcVideoMemoryStream *p_this(void **opaque) { return static_cast<VlcVideoMemoryStream *>(*opaque); }
^
In file included from ../src/core/VideoMemoryStream.cpp:25:
../src/core/VideoMemoryStream.h:55:43: note: declared here
class Q_DECL_DEPRECATED VLCQT_CORE_EXPORT VlcVideoMemoryStream
^~~~~~~~~~~~~~~~~~~~
[26/88] Linking CXX shared library src\core\libVLCQtCored.dll
FAILED: src/core/libVLCQtCored.dll src/core/libVLCQtCored.dll.a
cmd.exe /C "cd . && C:\Strawberry\c\bin\c++.exe -g -Wall -Wextra -static-libgcc -static-libstdc++ -shared -o src\core\libVLCQtCored.dll -Wl,--out-implib,src\core\libVLCQtCored.dll.a -Wl,--major-image-version,1,--minor-image-version,2 src/core/VLCQtCore.obj src/core/CMakeFiles/Core.dir/Core_autogen/mocs_compilation.cpp.obj src/core/CMakeFiles/Core.dir/AbstractVideoFrame.cpp.obj src/core/CMakeFiles/Core.dir/AbstractVideoStream.cpp.obj src/core/CMakeFiles/Core.dir/Audio.cpp.obj src/core/CMakeFiles/Core.dir/Common.cpp.obj src/core/CMakeFiles/Core.dir/Enums.cpp.obj src/core/CMakeFiles/Core.dir/Error.cpp.obj src/core/CMakeFiles/Core.dir/Instance.cpp.obj src/core/CMakeFiles/Core.dir/Media.cpp.obj src/core/CMakeFiles/Core.dir/MediaList.cpp.obj src/core/CMakeFiles/Core.dir/MediaListPlayer.cpp.obj src/core/CMakeFiles/Core.dir/MediaPlayer.cpp.obj src/core/CMakeFiles/Core.dir/MetaManager.cpp.obj src/core/CMakeFiles/Core.dir/ModuleDescription.cpp.obj src/core/CMakeFiles/Core.dir/TrackModel.cpp.obj src/core/CMakeFiles/Core.dir/Video.cpp.obj src/core/CMakeFiles/Core.dir/VideoStream.cpp.obj src/core/CMakeFiles/Core.dir/YUVVideoFrame.cpp.obj src/core/CMakeFiles/Core.dir/VideoFrame.cpp.obj src/core/CMakeFiles/Core.dir/VideoMemoryStream.cpp.obj src/core/CMakeFiles/Core.dir/Equalizer.cpp.obj src/core/CMakeFiles/Core.dir/compat/asprintf.c.obj src/core/CMakeFiles/Core.dir/compat/vasprintf.c.obj C:/Qt/Qt5.12.3/5.12.3/msvc2017_64/lib/Qt5Cored.lib C:/vlc-3.0.16/sdk/lib/libvlc.lib C:/vlc-3.0.16/sdk/lib/libvlccore.lib -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 && cd ."
C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: src/core/CMakeFiles/Core.dir/Core_autogen/mocs_compilation.cpp.obj: in function `VlcAudio::metaObject() const':
C:\vlc-qt\build/src/core/Core_autogen/EWIEGA46WW/moc_Audio.cpp:153: undefined reference to `__imp__ZNK11QObjectData17dynamicMetaObjectEv'
C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: src/core/CMakeFiles/Core.dir/Core_autogen/mocs_compilation.cpp.obj: in function `VlcAudio::qt_metacast(char const*)':
C:\vlc-qt\build/src/core/Core_autogen/EWIEGA46WW/moc_Audio.cpp:161: undefined reference to `__imp__ZN7QObject11qt_metacastEPKc'
C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: src/core/CMakeFiles/Core.dir/Core_autogen/mocs_compilation.cpp.obj: in function `VlcAudio::qt_metacall(QMetaObject::Call, int, void**)':
C:\vlc-qt\build/src/core/Core_autogen/EWIEGA46WW/moc_Audio.cpp:166: undefined reference to `__imp__ZN7QObject11qt_metacallEN11QMetaObject4CallEiPPv'
Ok, thanks to #vre i figure it out.
The solution :
Download vlc-qt and vlc 3.0.16 and extract.
Open cmake-gui choose your visual studio and check "Specify native compilers".
Set compilers to the correct MSVC like in the image
Add entries.. or just click "Configure" and fill it like in the image
After you fill all the entries and there no errors click "Generate"
Click "Open Project" to open it via Visual Studio and Build ..

external/local_config_mlir/include/mlir/IR/Attributes.h:783:20: internal compiler error: in assign_temp, at function.c:968

I am trying to build Tensorflow 2.0 on Ubuntu 16.04LTS
I get the error with gcc 4.8, gcc 5, gcc 9.2, etc.
Here are the version of bazel and gcc:
ai) ubuntu#ip-10-0-1-71:~/tensorflow$ bazel --version
bazel 0.27.1
(ai) ubuntu#ip-10-0-1-71:~/tensorflow$ gcc --version
gcc (Ubuntu 9.2.1-17ubuntu1~16.04) 9.2.1 20191102
Here's the error message from gcc from bazel:
ERROR: /home/ubuntu/tensorflow/tensorflow/compiler/mlir/xla/BUILD:247:1: C++ compilation of rule '//tensorflow/compiler/mlir/xla:hlo' failed (Exit 1)
tensorflow/compiler/mlir/xla/ir/hlo_ops.cc: In function 'mlir::Type {anonymous}::GetBroadcastType(mlir::Builder*, mlir::Type, mlir::Type, mlir::Type, mlir::DenseIntElementsAttr)':
tensorflow/compiler/mlir/xla/ir/hlo_ops.cc:730:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (int i = 0; i < shape_x.size(); i++) {
~~^~~~~~~~~~~~~~~~
In file included from tensorflow/compiler/mlir/xla/ir/hlo_ops.cc:113:0:
bazel-out/host/bin/tensorflow/compiler/mlir/xla/transforms/generated_canonicalize.inc: At global scope:
bazel-out/host/bin/tensorflow/compiler/mlir/xla/transforms/generated_canonicalize.inc:68:6: warning: 'void {anonymous}::populateWithGenerated(mlir::MLIRContext*, mlir::OwningRewritePatternList*)' defined but not used [-Wunused-function]
void populateWithGenerated(MLIRContext *context, OwningRewritePatternList *patterns) {
^~~~~~~~~~~~~~~~~~~~~
In file included from ./tensorflow/compiler/mlir/xla/ir/hlo_ops.h:22:0,
from tensorflow/compiler/mlir/xla/ir/hlo_ops.cc:18:
external/local_config_mlir/include/mlir/IR/Attributes.h: In member function 'T mlir::DenseElementsAttr::getValue(llvm::ArrayRef<long unsigned int>) const [with T = mlir::IntegerAttr]':
external/local_config_mlir/include/mlir/IR/Attributes.h:783:20: internal compiler error: in assign_temp, at function.c:968
auto castFn = [](Attribute attr) { return attr.template cast<T>(); };
^
I created an issue on github Tensoflow, but they haven't responded ...
https://github.com/tensorflow/tensorflow/issues/33431#issuecomment-543659836
with --verbose_failures:
ERROR: /home/ubuntu/tensorflow/tensorflow/compiler/mlir/xla/BUILD:247:1: C++ compilation of rule '//tensorflow/compiler/mlir/xla:hlo' failed (Exit 1): x86_64-conda_cos6-linux-gnu-cc failed: error executing command (cd /home/ubuntu/.cache/bazel/_bazel_ubuntu/ad1e09741bb4109fbc70ef8216b59ee2/execroot/org_tensorflow && \
exec env - \
LD_LIBRARY_PATH=/usr/local/cuda/lib64 \
PATH=/home/ubuntu/anaconda2/envs/ai/bin:/home/ubuntu/apps/maven/apache-maven-3.3.x-SNAPSHOT/bin:/home/ubuntu/anaconda2/bin:/usr/local/cuda-7.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/ubuntu/caffe/build/tools:/home/ubuntu/gnulib:.:.:/usr/lib/jvm/java-8-oracle/bin:/usr/local/hadoop/bin:/usr/local/hadoop/sbin \
PWD=/proc/self/cwd \
PYTHONPATH=:/home/ubuntu/anaconda2/envs/ai/lib/python3.6/site-packages:/home/ubuntu/opencog/opencog/python/:/home/ubuntu/opencog/build/opencog/cython:/home/ubuntu/deepdist:/home/ubuntu/anaconda2/envs/ai/lib/python3.6/site-packages:/home/ubuntu/opencog/opencog/python/:/home/ubuntu/opencog/build/opencog/cython:/home/ubuntu/deepdist \
PYTHON_BIN_PATH=/home/ubuntu/anaconda2/envs/ai/bin/python \
PYTHON_LIB_PATH=/home/ubuntu/anaconda2/envs/ai/lib/python3.6/site-packages \
TF2_BEHAVIOR=1 \
TF_CONFIGURE_IOS=0 \
/home/ubuntu/anaconda2/envs/ai/bin/x86_64-conda_cos6-linux-gnu-cc -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -g0 -O2 '-D_FORTIFY_SOURCE=1' -DNDEBUG -ffunction-sections -fdata-sections '-std=c++0x' -MD -MF bazel-out/k8-py2-opt/bin/tensorflow/compiler/mlir/xla/_objs/hlo/hlo_ops.pic.d '-frandom-seed=bazel-out/k8-py2-opt/bin/tensorflow/compiler/mlir/xla/_objs/hlo/hlo_ops.pic.o' -fPIC -DLLVM_ENABLE_STATS -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -DLLVM_BUILD_GLOBAL_ISEL -iquote . -iquote bazel-out/k8-py2-opt/bin -iquote external/local_config_mlir -iquote bazel-out/k8-py2-opt/bin/external/local_config_mlir -iquote external/llvm -iquote bazel-out/k8-py2-opt/bin/external/llvm -iquote external/zlib_archive -iquote bazel-out/k8-py2-opt/bin/external/zlib_archive -Ibazel-out/k8-py2-opt/bin/external/local_config_mlir/_virtual_includes/CallOpInterfacesIncGen -Ibazel-out/k8-py2-opt/bin/external/local_config_mlir/_virtual_includes/DialectSymbolRegistry -Ibazel-out/k8-py2-opt/bin/external/local_config_mlir/_virtual_includes/InferTypeOpInterfaceIncGen -Ibazel-out/k8-py2-opt/bin/external/local_config_mlir/_virtual_includes/AffineOpsIncGen -Ibazel-out/k8-py2-opt/bin/external/local_config_mlir/_virtual_includes/LoopLikeOpInterfaceIncGen -Ibazel-out/k8-py2-opt/bin/external/local_config_mlir/_virtual_includes/StandardOpsIncGen -Ibazel-out/k8-py2-opt/bin/external/local_config_mlir/_virtual_includes/LoopOpsIncGen -Ibazel-out/k8-py2-opt/bin/external/local_config_mlir/_virtual_includes/VectorOpsIncGen -isystem tensorflow/compiler/mlir/xla/include -isystem bazel-out/k8-py2-opt/bin/tensorflow/compiler/mlir/xla/include -isystem external/local_config_mlir/include -isystem bazel-out/k8-py2-opt/bin/external/local_config_mlir/include -isystem external/llvm/include -isystem bazel-out/k8-py2-opt/bin/external/llvm/include -isystem external/zlib_archive -isystem bazel-out/k8-py2-opt/bin/external/zlib_archive '-march=native' -Wno-sign-compare '-std=c++14' -fno-canonical-system-headers -Wno-builtin-macro-redefined '-D__DATE__="redacted"' '-D__TIMESTAMP__="redacted"' '-D__TIME__="redacted"' -c tensorflow/compiler/mlir/xla/ir/hlo_ops.cc -o bazel-out/k8-py2-opt/bin/tensorflow/compiler/mlir/xla/_objs/hlo/hlo_ops.pic.o)
Execution platform: #bazel_tools//platforms:host_platform
[4,817 / 5,026] 3 actions running
In file included from tensorflow/compiler/mlir/xla/ir/hlo_ops.cc:113:0:
bazel-out/k8-py2-opt/bin/tensorflow/compiler/mlir/xla/transforms/generated_canonicalize.inc:68:6: warning: 'void {anonymous}::populateWithGenerated(mlir::MLIRContext*, mlir::OwningRewritePatternList*)' defined but not used [-Wunused-function]
void populateWithGenerated(MLIRContext *context, OwningRewritePatternList *patterns) {
^~~~~~~~~~~~~~~~~~~~~
In file included from ./tensorflow/compiler/mlir/xla/ir/hlo_ops.h:22:0,
from tensorflow/compiler/mlir/xla/ir/hlo_ops.cc:18:
external/local_config_mlir/include/mlir/IR/Attributes.h: In member function 'T mlir::DenseElementsAttr::getValue(llvm::ArrayRef<long unsigned int>) const [with T = mlir::IntegerAttr]':
external/local_config_mlir/include/mlir/IR/Attributes.h:783:20: internal compiler error: in assign_temp, at function.c:968
auto castFn = [](Attribute attr) { return attr.template cast<T>(); };
^
It appears to be using an Anaconda gcc:
ai) ubuntu#ip-10-0-1-71:~/tensorflow$ /home/ubuntu/anaconda2/envs/ai/bin/x86_64-conda_cos6-linux-gnu-cc --version
x86_64-conda_cos6-linux-gnu-cc (crosstool-NG 1.23.0.452-d158) 7.3.0
'bazel' is picking up 'gcc' from the GCC environment variable:
$ !env
env | grep GCC
GCC_NM=/usr/bin/nm
GCC_HOST_COMPILER_PREFIX=/usr/bin
GCC_RANLIB=/usr/bin/ranlib
GCC_HOST_COMPILER_PATH=/usr/bin/gcc
GCC=/usr/bin/gcc
GCC_AR=/usr/bin/ar
When I tried setting CC environment variable to:
GCC=/usr/bin/gcc
CC=/usr/bin/g++
I got the following errors:
/usr/bin/g++ -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -g0 -O2 '-D_FORTIFY_SOURCE=1' -DNDEBUG -ffunction-sections -fdata-sections -MD -MF bazel-out/host/bin/external/zlib_archive/_objs/zlib/adler32.d '-frandom-seed=bazel-out/host/bin/external/zlib_archive/_objs/zlib/adler32.o' -iquote external/zlib_archive -iquote bazel-out/host/bin/external/zlib_archive -isystem external/zlib_archive -isystem bazel-out/host/bin/external/zlib_archive -g0 '-march=native' -Wno-shift-negative-value -DZ_HAVE_UNISTD_H -fno-canonical-system-headers -Wno-builtin-macro-redefined '-D__DATE__="redacted"' '-D__TIMESTAMP__="redacted"' '-D__TIME__="redacted"' -c external/zlib_archive/adler32.c -o bazel-out/host/bin/external/zlib_archive/_objs/zlib/adler32.o)
Execution platform: #bazel_tools//platforms:host_platform
external/zlib_archive/adler32.c:63:25: error: 'uLong adler32_z' redeclared as different kind of symbol
uLong ZEXPORT adler32_z(adler, buf, len)
^~~~~
In file included from external/zlib_archive/zutil.h:22:0,
from external/zlib_archive/adler32.c:8:
external/zlib_archive/zlib.h:1707:23: note: previous declaration 'uLong adler32_z(uLong, const Bytef*, z_size_t)'
ZEXTERN uLong ZEXPORT adler32_z OF((uLong adler, const Bytef *buf,
^~~~~~~~~
external/zlib_archive/adler32.c:63:25: error: 'adler' was not declared in this scope
uLong ZEXPORT adler32_z(adler, buf, len)
^~~~~
external/zlib_archive/adler32.c:63:32: error: 'buf' was not declared in this scope
uLong ZEXPORT adler32_z(adler, buf, len)
^~~
external/zlib_archive/adler32.c:63:37: error: 'len' was not declared in this scope
uLong ZEXPORT adler32_z(adler, buf, len)
^~~
external/zlib_archive/adler32.c:67:1: error: expected unqualified-id before '{' token
{
^
external/zlib_archive/adler32.c:10:13: warning: 'uLong adler32_combine_(uLong, uLong, off64_t)' declared 'static' but never defined [-Wunused-function]
local uLong adler32_combine_ OF((uLong adler1, uLong adler2, z_off64_t len2));
^~~~~~~~~~~~~~~~
Any ideas?
This might happen if you have your config set such that warnings are errors.
Looking at the above it would appear that a compiler warning that is treated as a warning in TF OSS builds, your build is treating as an error.

Makefile error with Objective-C with Cocoa on Linux

I'm trying to write a makefile to compile Objective-C with Cocoa on Linux.
I have installed the following packages:
sudo apt-get install gnustep gnustep-devel
I started with a minimal makefile, which compiles successfully:
FLAGS = $(shell gnustep-config --objc-flags)
LIBS = $(shell gnustep-config --base-libs)
all:
gcc $(FLAGS) HelloWorld.m $(LIBS) -o a.out
Here is the sole source file:
#include <Foundation/Foundation.h>
int main(int argc, const char* argv[])
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSLog(#"Hello, World!");
[pool drain];
return 0;
}
Now I'm trying to write a more elaborate makefile but I haven't been able to get it working yet:
CC = gcc
SOURCES=HelloWorld.m
OBJECTS=$(SOURCES:.m=.o)
CFLAGS=-c $(shell gnustep-config --objc-flags)
LIBRARIES = $(shell gnustep-config --base-libs)
FRAMEWORKS:= -framework Foundation -framework Cocoa -framework AppKit
LDFLAGS=$(LIBRARIES) $(FRAMEWORKS)
EXECUTABLE=a.out
all: $(SOURCES) $(EXECUTABLE)
$(EXECUTABLE): $(OBJECTS)
$(CC) $(LDFLAGS) $(OBJECTS) -o $#
.m.o:
$(CC) $(CFLAGS) $(LIBRARIES) $< -o $#
Output:
$ make
gcc -rdynamic -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -shared-libgcc -shared-libgcc -pthread -fexceptions -fgnu-runtime -L/home/brett/GNUstep/Library/Libraries -L/usr/local/lib -L/usr/lib -lgnustep-base -lobjc -lm -framework Foundation -framework Cocoa -framework AppKit HelloWorld.o -o a.out
gcc: error: Foundation: No such file or directory
gcc: error: Cocoa: No such file or directory
gcc: error: AppKit: No such file or directory
gcc: error: unrecognized command line option ‘-framework’
gcc: error: unrecognized command line option ‘-framework’
gcc: error: unrecognized command line option ‘-framework’
Makefile:14: recipe for target 'a.out' failed
make: *** [a.out] Error 1
Gcc version:
gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/7/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 7.2.0-8ubuntu3' --with-bugurl=file:///usr/share/doc/gcc-7/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-7 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 7.2.0 (Ubuntu 7.2.0-8ubuntu3) gnustep-config --base-libs
$ gnustep-config --objc-flags
-MMD -MP -Wdate-time -D_FORTIFY_SOURCE=2 -DGNUSTEP -DGNUSTEP_BASE_LIBRARY=1 -DGNU_GUI_LIBRARY=1 -DGNU_RUNTIME=1 -DGNUSTEP_BASE_LIBRARY=1 -fno-strict-aliasing -fexceptions -fobjc-exceptions -D_NATIVE_OBJC_EXCEPTIONS -pthread -fPIC -Wall -DGSWARN -DGSDIAGNOSE -Wno-import -g -O2 -fdebug-prefix-map=/build/gnustep-make-1owDvd/gnustep-make-2.6.8=. -fstack-protector-strong -Wformat -Werror=format-security -g -O2 -fdebug-prefix-map=/build/gnustep-make-1owDvd/gnustep-make-2.6.8=. -fstack-protector-strong -Wformat -Werror=format-security -fgnu-runtime -fconstant-string-class=NSConstantString -I. -I/home/brett/GNUstep/Library/Headers -I/usr/local/include/GNUstep -I/usr/include/GNUstep
$ gnustep-config --base-libs
-rdynamic -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -shared-libgcc -shared-libgcc -pthread -fexceptions -fgnu-runtime -L/home/brett/GNUstep/Library/Libraries -L/usr/local/lib -L/usr/lib -lgnustep-base -lobjc -lm
brett#brett-desktop:~/Git/Mandelbrot/Mandelbrot2$ gnustep-config --base-libsgnustep-config --base-libs
Actually I think I see the problem, my gnustep-config --base-libs outputs -L/home/brett/GNUstep/Library/Libraries which does not exist in my environment. I will update if I figure out how to properly install the libraries.
It appears as if the gnustep-devel package only installed the docs:
$ dpkg-query -L gnustep-devel
/.
/usr
/usr/share
/usr/share/doc
/usr/share/doc/gnustep-devel
/usr/share/doc/gnustep-devel/copyright
/usr/share/doc/gnustep-devel/changelog.gz
I found some files under /usr/share/GNUstep but no Foundation.h:
$ find . -name *.h
./Makefiles/TestFramework/ObjectTesting.h
./Makefiles/TestFramework/Testing.h
You may want to try this :
CC = gcc
SOURCES=HelloWorld.m
OBJECTS=$(SOURCES:.m=.o)
CCFLAGS=`gnustep-config --objc-flags` -c
OBJCLIBS=`gnustep-config --objc-libs` -lgnustep-base
EXECUTABLE=a.out
all: $(SOURCES) $(EXECUTABLE)
$(EXECUTABLE): $(OBJECTS)
$(CC) $(LDFLAGS) -o $# $^ $(OBJCLIBS)
%.o : %.m
$(CC) $(CCFLAGS) -o $# -c $<
I did not check in detail but with your makefile all "-I" directives are missing like this :
-I/usr/local/include/GNUstep -I/usr/include/GNUstep

including itensor library in my cmake project in clion

so I am very new to CLion and CMake, so sorry in advance for wrong usage of terminology. I am suffering the following problem:
In my project I want to include the ITensor library which is essentially a non-CMake project. I cloned the git to my computer and build the ITensor project. Next I wanted to use it in another project linking against it with CMake:
My Code in main.cpp:
#include <iostream>
#include "itensor.h"
int main() {
std::string some_string = "Hello world";
return 0;
}
and my CMakeLists.txt looks like:
cmake_minimum_required(VERSION 3.6)
project(tutorial)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(ITENSOR_DIR PATH/TO/ITENSOR)
include_directories(ITENSOR_DIR/itensor)
set(SOURCE_FILES
main.cpp
${ITENSOR_DIR}/itensor/itensor.h
${ITENSOR_DIR}/itensor/itensor.cc)
add_executable(tutorial ${SOURCE_FILES})
Unfortunately, the project 'tutorial' does not build in CLion. Likewise, CLion cannot resolve the dependency itensor.h.
Anybody an Idea for why this is, respectively how to fix it?
After trying Thomas5631's solution the compilation ran into linking issues with lapack. I solved this by adding some flags, though I'm not sure if all of them are required.
My CMakeLists.txt:
cmake_minimum_required(VERSION 3.6)
project(my_project)
#Bring the headers into the project (full or relative path)
include_directories(itensor)
#Link the Itensor library
add_library(itensor STATIC IMPORTED)
set_property(TARGET itensor PROPERTY IMPORTED_LOCATION /home/david/my_project/itensor/lib/libitensor.a)
#Set a variable with all the new flags
set(ITENSOR_FLAGS "-DPLATFORM_lapack -D__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES=0")
set(ITENSOR_LINK_FLAGS "-DPLATFORM_lapack -L/home/david/my_project/itensor/lib -litensor -lpthread -L/usr/lib -lblas -llapack")
#Append the new flags
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 ${ITENSOR_FLAGS}")
add_executable(my_project main.cpp)
target_link_libraries(my_project itensor "${ITENSOR_LINK_FLAGS}")
Motivation: In the folder itensor/project_template there is a sample program which is simple enough to compile with make (from the terminal). The output of the compilation reveals the flags:
g++ -m64 -std=c++11 -c -I. -I/home/david/my_project/itensor -I/usr/include -O3 -DNDEBUG -Wall -DPLATFORM_lapack -D__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES=0 -Wno-unused-variable -o myappname.o myappname.cc
[... some warnings ...]
g++ -m64 -std=c++11 -c -I. -I/home/david/my_project/itensor -I/usr/include -O3 -DNDEBUG -Wall -DPLATFORM_lapack -D__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES=0 -Wno-unused-variable -o myclass.o myclass.cc
g++ -m64 -std=c++11 -I. -I/home/david/my_project/itensor -I/usr/include -O3 -DNDEBUG -Wall -DPLATFORM_lapack -D__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES=0 -Wno-unused-variable myappname.o myclass.o -o myappname -L/home/david/my_project/itensor/lib -litensor -lpthread -L/usr/lib -lblas -llapack
I got around the issue with the following main.cpp:
#include <iostream>
#include "itensor/itensor.h"
int main() {
std::string some_string = "Hello world";
return 0;
}
And the following CMakeLists.txt:
project(tutorial)
cmake_minimum_required(VERSION 3.6)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
#Bring the headers into the project
include_directories(/home/tom/Documents/workspace/ITensor/)
#Link the library
add_library(itensor STATIC IMPORTED)
set_property(TARGET itensor PROPERTY IMPORTED_LOCATION /home/tom/Documents/workspace/ITensor/lib/libitensor.a)
set(SOURCE_FILES main.cpp)
add_executable(tutorial ${SOURCE_FILES})
Where the path to ITensor can be either relative (using the ${PROJECT_SOURCE_DIR} variable) or absolute as I have shown.