Makefile error with Objective-C with Cocoa on Linux - objective-c

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

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

Where is __lxstat64 in eglibc?

While I was trying to build Plasma5 on Ubuntu Trusty, I got an issue related to eglibc 2.19.
/usr/lib/x86_64-linux-gnu/libc_nonshared.a(lstat64.oS): In function ``lstat64':
(.text+0xc): undefined reference to ``__lxstat64'
I have no idea how to fix this. Thanks.
Edit
Appended -v to g++ and ld, got:
COLLECT_GCC=/etc/alternatives/g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 5.3.0-3ubuntu1~14.04' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs --enable-languages=c,ada,c++,java,go,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-5 --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=gcc4-compatible --disable-libstdcxx-dual-abi --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 5.3.0 20151204 (Ubuntu 5.3.0-3ubuntu1~14.04)
COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/5/:/usr/lib/gcc/x86_64-linux-gnu/5/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/5/:/usr/lib/gcc/x86_64-linux-gnu/
LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/5/:/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/5/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-v' '-fPIC' '-pipe' '-D' 'QT_STRICT_ITERATORS' '-D' 'QURL_NO_CAST_FROM_STRING' '-D' 'QT_NO_HTTP' '-D' 'QT_NO_FTP' '-Wformat=1' '-Werror=format-security' '-Werror=return-type' '-Wno-variadic-macros' '-Wlogical-op' '-Wmissing-include-dirs' '-std=c++11' '-std=c++11' '-fno-exceptions' '-Wall' '-Wextra' '-Wcast-align' '-Wchar-subscripts' '-Wformat-security' '-Wno-long-long' '-Wpointer-arith' '-Wundef' '-Wnon-virtual-dtor' '-Woverloaded-virtual' '-Werror=return-type' '-Wpedantic' '-g' '-shared' '-o' 'baloosearch.so' '-shared-libgcc' '-mtune=generic' '-march=x86-64'
/usr/lib/gcc/x86_64-linux-gnu/5/collect2 -plugin /usr/lib/gcc/x86_64-linux-gnu/5/liblto_plugin.so -plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper -plugin-opt=-fresolution=/tmp/cc8S8VVK.res -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc_s --sysroot=/ --build-id --eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed -shared -z relro -o baloosearch.so /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/5/crtbeginS.o -L/usr/lib/gcc/x86_64-linux-gnu/5 -L/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/5/../../.. -v --no-undefined --fatal-warnings --enable-new-dtags -soname baloosearch.so CMakeFiles/kio_baloosearch.dir/kio_search.cpp.o CMakeFiles/kio_baloosearch.dir/kio_baloosearch_automoc.cpp.o /opt/kde/install/lib/x86_64-linux-gnu/libKF5KIOCore.so.5.20.0 /opt/kde/install/lib/x86_64-linux-gnu/libKF5I18n.so.5.20.0 ../../lib/libKF5Baloo.so.5.20.0 /opt/kde/install/lib/x86_64-linux-gnu/libKF5Service.so.5.20.0 /opt/kde/install/lib/x86_64-linux-gnu/libKF5FileMetaData.so.5.20.0 /opt/kde/install/lib/x86_64-linux-gnu/libKF5I18n.so.5.20.0 /opt/kde/install/lib/x86_64-linux-gnu/libKF5ConfigCore.so.5.20.0 /opt/kde/install/lib/x86_64-linux-gnu/libKF5CoreAddons.so.5.20.0 /opt/Qt5.5.1/5.5/gcc_64/lib/libQt5Core.so.5.5.1 -rpath /opt/kde/install/lib/x86_64-linux-gnu:/opt/kde/build/baloo/src/lib:/opt/Qt5.5.1/5.5/gcc_64/lib:/opt/kde/build/baloo/src/engine: -rpath-link /opt/Qt5.5.1/5.5/gcc_64/lib:/opt/kde/install/lib/x86_64-linux-gnu:/opt/kde/build/baloo/src/engine -lstdc++ -lm -lgcc_s -lc -lgcc_s /usr/lib/gcc/x86_64-linux-gnu/5/crtendS.o /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crtn.o
collect2 version 5.3.0 20151204
/usr/bin/ld -plugin /usr/lib/gcc/x86_64-linux-gnu/5/liblto_plugin.so -plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper -plugin-opt=-fresolution=/tmp/cc8S8VVK.res -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc_s --sysroot=/ --build-id --eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed -shared -z relro -o baloosearch.so /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/5/crtbeginS.o -L/usr/lib/gcc/x86_64-linux-gnu/5 -L/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/5/../../.. -v --no-undefined --fatal-warnings --enable-new-dtags -soname baloosearch.so CMakeFiles/kio_baloosearch.dir/kio_search.cpp.o CMakeFiles/kio_baloosearch.dir/kio_baloosearch_automoc.cpp.o /opt/kde/install/lib/x86_64-linux-gnu/libKF5KIOCore.so.5.20.0 /opt/kde/install/lib/x86_64-linux-gnu/libKF5I18n.so.5.20.0 ../../lib/libKF5Baloo.so.5.20.0 /opt/kde/install/lib/x86_64-linux-gnu/libKF5Service.so.5.20.0 /opt/kde/install/lib/x86_64-linux-gnu/libKF5FileMetaData.so.5.20.0 /opt/kde/install/lib/x86_64-linux-gnu/libKF5I18n.so.5.20.0 /opt/kde/install/lib/x86_64-linux-gnu/libKF5ConfigCore.so.5.20.0 /opt/kde/install/lib/x86_64-linux-gnu/libKF5CoreAddons.so.5.20.0 /opt/Qt5.5.1/5.5/gcc_64/lib/libQt5Core.so.5.5.1 -rpath /opt/kde/install/lib/x86_64-linux-gnu:/opt/kde/build/baloo/src/lib:/opt/Qt5.5.1/5.5/gcc_64/lib:/opt/kde/build/baloo/src/engine: -rpath-link /opt/Qt5.5.1/5.5/gcc_64/lib:/opt/kde/install/lib/x86_64-linux-gnu:/opt/kde/build/baloo/src/engine -lstdc++ -lm -lgcc_s -lc -lgcc_s /usr/lib/gcc/x86_64-linux-gnu/5/crtendS.o /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crtn.o
GNU ld (GNU Binutils for Ubuntu) 2.24
/usr/lib/x86_64-linux-gnu/libc_nonshared.a(lstat64.oS): In function `lstat64':
(.text+0xc): undefined reference to `__lxstat64'
collect2: error: ld returned 1 exit status
I ran into the exact same problem trying to do the exact same thing. I don't know if this is a good solution, but I found three ways to fix this problem.
run the compile command and add
"/usr/lib/x86_64-linux-gnu/libc_nonshared.a" to it
run the compile command and add "-lc" to it
the best solution if you're using kdesrc-build is to add the option to the baloo module in your .kdesrc-buildrc like this:
options baloo
cmake-options -DCMAKE_CXX_FLAGS="-lc"
end options
After some hoops and hurdles I was able to build and run Plasma 5 on Ubuntu 14.04 and will probably write a guide on how to do it.

ld can't find a library

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?