ld can't find a library - g++

Here is a Makefile:
all: main
bar.cxx:
echo "void bar(){}" > bar.cxx
foo.cxx:
echo "void bar();" > foo.cxx
echo "void foo(){ bar(); }" >> foo.cxx
main.cxx:
echo "void foo();" > main.cxx
echo "int main(){ foo(); }" >> main.cxx
%.o: %.cxx
g++ -c -fPIC $<
libbar.so: bar.o
g++ -shared -o libbar.so bar.o
libfoo.so: foo.o libbar.so
g++ -shared -o libfoo.so foo.o -L. -Wl,-rpath,\$$ORIGIN/. -lbar
main: main.o libfoo.so
g++ -o $# main.o -L. $(PWD)/libfoo.so
clean:
rm -rf *.so *.o *.cxx main
which fails like this on Ubuntu 14.04:
$ make
echo "void foo();" > main.cxx
echo "int main(){ foo(); }" >> main.cxx
g++ -c -fPIC main.cxx
echo "void bar();" > foo.cxx
echo "void foo(){ bar(); }" >> foo.cxx
g++ -c -fPIC foo.cxx
echo "void bar(){}" > bar.cxx
g++ -c -fPIC bar.cxx
g++ -shared -o libbar.so bar.o
g++ -shared -o libfoo.so foo.o -L. -Wl,-rpath,\$ORIGIN/. -lbar
g++ -o main main.o -L. /media/david/data/tmp/origin/libfoo.so
/usr/bin/ld: warning: libbar.so, needed by /media/david/data/tmp/origin/libfoo.so, not found (try using -rpath or -rpath-link)
/media/david/data/tmp/origin/libfoo.so: undefined reference to `bar()'
collect2: error: ld returned 1 exit status
make: *** [main] Error 1
RPATH is set relative:
$ objdump -p libfoo.so | grep RPATH
RPATH $ORIGIN/.
ldd print the correct path to libbar.so:
ldd libfoo.so
linux-vdso.so.1 => (0x00007ffe3f1c8000)
libbar.so => /media/david/data/tmp/origin/././libbar.so (0x00007f83c29ff000)
I have some questions, maybe in wrong order or redundant:
0) Why ld can't find libbar.so?
1) Why do I need to add -Wl,rpath,$(PWD) like below, while libfoo.so already contains the rpath?
main: main.o libfoo.so
g++ -o $# main.o -L. -Wl,-rpath,$(PWD) $(PWD)/libfoo.so
2) LD_LIBRARY_PATH=. make solve the problem, but why? I was thinking the LD_LIBRARY_PATH was used only at execution.
3) Why does -L. has no effect?

Related

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 ..

Linking step fails with g++, but works with libtool

this is an issue during the linking of a program that includes the gnu plotutils package, specifally the libplotter library.
The "program":
#include <plotter.h>
int main() {
return 0;
}
complication commands and errors:
g++ -c test.cpp -g -O0 -std=c++17
g++ -o test test.o -L/usr/lib64 -lplotter -lxmi
/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib64/libplotter.so: undefined reference to `miDeletePaintedSet(lib_miPaintedSet*)'
/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib64/libplotter.so: undefined reference to `miSetGCPixels(lib_miGC*, int, miPixel const*)'
/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib64/libplotter.so: undefined reference to `miSetGCMiterLimit(lib_miGC*, double)'
/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib64/libplotter.so: undefined reference to `miClearPaintedSet(lib_miPaintedSet*)'
/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib64/libplotter.so: undefined reference to `miCopyPaintedSetToCanvas(lib_miPaintedSet const*, miCanvas*, miPoint)'
/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib64/libplotter.so: undefined reference to `miSetGCAttrib(lib_miGC*, miGCAttribute, int)'
/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib64/libplotter.so: undefined reference to `miNewGC(int, miPixel const*)'
/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib64/libplotter.so: undefined reference to `miNewCanvas(unsigned int, unsigned int, miPixel)'
/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib64/libplotter.so: undefined reference to `miNewPaintedSet()'
/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib64/libplotter.so: undefined reference to `miSetGCAttribs(lib_miGC*, int, miGCAttribute const*, int const*)'
/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib64/libplotter.so: undefined reference to `miDeleteGC(lib_miGC*)'
/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib64/libplotter.so: undefined reference to `miDeleteCanvas(miCanvas*)'
/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib64/libplotter.so: undefined reference to `miSetGCDashes(lib_miGC*, int, unsigned int const*, int)'
collect2: error: ld returned 1 exit status
The missing functions are defined int the libxmi header
$ grep miCopyPaintedSetToCanvas /usr/include/ -Rl
/usr/include/xmi.h
Both libraries exist in /usr/lib64 (both installed via gentoo linux package manager)
$ ls /usr/lib64 | grep -e libplot -e libxmi
libplot.la
libplot.so
libplot.so.2
libplot.so.2.2.4
libplotter.la
libplotter.so
libplotter.so.2
libplotter.so.2.2.4
libxmi.so
libxmi.so.0
libxmi.so.0.1.3
The linking works when using libtool though
g++ -c test.cpp -g -O0 -std=c++17
libtool --tag=CXX --mode=link x86_64-pc-linux-gnu-g++ -march=haswell -O2 -pipe -Wl,-O1 -Wl,--as-needed test.o -lXaw -lXmu -lXt -lSM -lICE -lXext -lX11 -lpng -lz -lxmi -lm -o test
libtool: link: x86_64-pc-linux-gnu-g++ -march=haswell -O2 -pipe -Wl,-O1 -Wl,--as-needed test.o -o test -lXaw -lXmu -lXt -lSM -lICE -lXext -lX11 -lpng -lz -lxmi -lm
Or in verbose
libtool: link: x86_64-pc-linux-gnu-g++ -march=haswell -O2 -pipe -Wl,-O0 -Wl,--as-needed test.o -o test --verbose -lXaw -lXmu -lXt -lSM -lICE -lXext -lX11 -lpng -lz -lxmi -lm
Using built-in specs.
COLLECT_GCC=x86_64-pc-linux-gnu-g++
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/10.2.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /var/tmp/portage/sys-devel/gcc-10.2.0-r5/work/gcc-10.2.0/configure --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/10.2.0 --includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/include --datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/10.2.0 --mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/10.2.0/man --infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/10.2.0/info --with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/include/g++-v10 --with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/10.2.0/python --enable-languages=c,c++,fortran --enable-obsolete --enable-secureplt --disable-werror --with-system-zlib --enable-nls --without-included-gettext --enable-checking=release --with-bugurl=https://bugs.gentoo.org/ --with-pkgversion='Gentoo 10.2.0-r5 p6' --disable-esp --enable-libstdcxx-time --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --enable-multilib --with-multilib-list=m32,m64 --disable-fixed-point --enable-targets=all --enable-libgomp --disable-libssp --disable-libada --disable-systemtap --disable-vtable-verify --disable-libvtv --without-zstd --enable-lto --without-isl --enable-default-pie --enable-default-ssp
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 10.2.0 (Gentoo 10.2.0-r5 p6)
COMPILER_PATH=/usr/libexec/gcc/x86_64-pc-linux-gnu/10.2.0/:/usr/libexec/gcc/x86_64-pc-linux-gnu/10.2.0/:/usr/libexec/gcc/x86_64-pc-linux-gnu/:/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/:/usr/lib/gcc/x86_64-pc-linux-gnu/:/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../x86_64-pc-linux-gnu/bin/
LIBRARY_PATH=/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/:/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../x86_64-pc-linux-gnu/lib/:/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-march=haswell' '-O2' '-pipe' '-o' 'test' '-v' '-shared-libgcc'
/usr/libexec/gcc/x86_64-pc-linux-gnu/10.2.0/collect2 -plugin /usr/libexec/gcc/x86_64-pc-linux-gnu/10.2.0/liblto_plugin.so -plugin-opt=/usr/libexec/gcc/x86_64-pc-linux-gnu/10.2.0/lto-wrapper -plugin-opt=-fresolution=/tmp/ccxStaDw.res -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -pie -o test /usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../lib64/Scrt1.o /usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../lib64/crti.o /usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/crtbeginS.o -L/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0 -L/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../x86_64-pc-linux-gnu/lib -L/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../.. -O0 --as-needed test.o -lXaw -lXmu -lXt -lSM -lICE -lXext -lX11 -lpng -lz -lxmi -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/crtendS.o /usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../lib64/crtn.o
COLLECT_GCC_OPTIONS='-march=haswell' '-O2' '-pipe' '-o' 'test' '-v' '-shared-libgcc'
I already tested most of the libtool library options in the g++ linking command but this wouldn't fix the g++ linking problem.
Anyway, after the successful linking with libtool, the libplotter library is not listed by ldd:
ldd test
linux-vdso.so.1 (0x00007ffffbda4000)
libstdc++.so.6 => /usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/libstdc++.so.6 (0x00007f8c8df0a000)
libc.so.6 => /lib64/libc.so.6 (0x00007f8c8dd50000)
libm.so.6 => /lib64/libm.so.6 (0x00007f8c8dc1b000)
/lib64/ld-linux-x86-64.so.2 (0x00007f8c8e118000)
libgcc_s.so.1 => /usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/libgcc_s.so.1 (0x00007f8c8dc01000)
Can someone explain what is wrong with the g++ linking command as compared to the working one with libtool?
Thank you
I am new to stack overflow so hope this helps! I ran into the same problem and all I had to was to reinstall ld via this command:
sudo apt reinstall binutils
If that doesn't work try reinstalling g++ via this command:
sudo apt reinstall g++

Compiling cpputest with mingw-w64

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

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