SergiusTheBest / plog

Portable, simple and extensible C++ logging library
MIT License
2.21k stars 391 forks source link

building on macOS (11.6) fails: "ar: no archive members specified" #216

Closed pptz closed 2 years ago

pptz commented 2 years ago

At the cmake --build ./make stage:

[1%] Linking CXX static library libplog-headers.a
ar: no archive members specified
...
make[2]: *** [libplog-headers.a] Error 1
make[1]: *** [CMakeFiles/plog-headers.dir/all] Error 2
make: *** [all] Error 2

Similar issues with building on macOS are googleable, but I didn't find a solution yet.

SergiusTheBest commented 2 years ago

What is the compiler version?

pptz commented 2 years ago

Apple clang version 13.0.0 (clang-1300.0.29.30)

SergiusTheBest commented 2 years ago

I pushed the fix to the develop branch. Please, try it.

pptz commented 2 years ago

Compilation proceeds further, but fails with:

[  9%] Linking CXX executable ChainedApp
ld: can't write output file to 'ChainedApp' because that path is a directory
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [samples/Chained/ChainedApp] Error 1
make[1]: *** [samples/Chained/CMakeFiles/ChainedApp.dir/all] Error 2
make: *** [all] Error 2
SergiusTheBest commented 2 years ago

Ok. Thanks. I'll check that too.

SergiusTheBest commented 2 years ago

@pptz Try to remove build directory and run cmake again. I can't reproduce the second problem, the build went fine:

$ cmake -H. -Bbuild -DCMAKE_BUILD_TYPE=Release
-- The CXX compiler identification is AppleClang 13.0.0.13000029
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Applications/Xcode-13.1.Release.Candidate.app/Contents/Developer/usr/bin/g++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- The C compiler identification is AppleClang 13.0.0.13000029
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Applications/Xcode-13.1.Release.Candidate.app/Contents/Developer/usr/bin/gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- ObjectiveC++ support is detected
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/travis/build/SergiusTheBest/plog/build
$ cd build
$ make
[  1%] Building CXX object samples/AscDump/CMakeFiles/AscDump.dir/Main.cpp.o
[  3%] Linking CXX executable AscDump
[  3%] Built target AscDump
[  5%] Building CXX object samples/Chained/CMakeFiles/ChainedLib.dir/ChainedLib/Main.cpp.o
[  7%] Linking CXX shared library libChainedLib.dylib
[  7%] Built target ChainedLib
[  9%] Building CXX object samples/Chained/CMakeFiles/ChainedApp.dir/ChainedApp/Main.cpp.o
[ 11%] Linking CXX executable ChainedApp
[ 11%] Built target ChainedApp
[ 13%] Building CXX object samples/ColorConsole/CMakeFiles/ColorConsole.dir/Main.cpp.o
[ 15%] Linking CXX executable ColorConsole
[ 15%] Built target ColorConsole
[ 17%] Building CXX object samples/CustomAppender/CMakeFiles/CustomAppender.dir/Main.cpp.o
[ 19%] Linking CXX executable CustomAppender
[ 19%] Built target CustomAppender
[ 21%] Building CXX object samples/CustomConverter/CMakeFiles/CustomConverter.dir/Main.cpp.o
[ 23%] Linking CXX executable CustomConverter
[ 23%] Built target CustomConverter
[ 25%] Building CXX object samples/CustomFormatter/CMakeFiles/CustomFormatter.dir/Main.cpp.o
[ 26%] Linking CXX executable CustomFormatter
[ 26%] Built target CustomFormatter
[ 28%] Building CXX object samples/CustomType/CMakeFiles/CustomType.dir/Main.cpp.o
[ 30%] Linking CXX executable CustomType
[ 30%] Built target CustomType
[ 32%] Building CXX object samples/Demo/CMakeFiles/Demo.dir/Main.cpp.o
[ 34%] Building CXX object samples/Demo/CMakeFiles/Demo.dir/MyClass.cpp.o
[ 36%] Linking CXX executable Demo
[ 36%] Built target Demo
[ 38%] Building CXX object samples/Demo/CMakeFiles/DemoWchar.dir/Main.cpp.o
[ 40%] Building CXX object samples/Demo/CMakeFiles/DemoWchar.dir/MyClass.cpp.o
[ 42%] Linking CXX executable DemoWchar
[ 42%] Built target DemoWchar
[ 44%] Building CXX object samples/DisableLogging/CMakeFiles/DisableLogging.dir/Main.cpp.o
[ 46%] Linking CXX executable DisableLogging
[ 46%] Built target DisableLogging
[ 48%] Building CXX object samples/Facilities/CMakeFiles/Facilities.dir/Main.cpp.o
[ 50%] Linking CXX executable Facilities
[ 50%] Built target Facilities
[ 51%] Building CXX object samples/Hello/CMakeFiles/Hello.dir/Main.cpp.o
[ 53%] Linking CXX executable Hello
[ 53%] Built target Hello
[ 55%] Building CXX object samples/HexDump/CMakeFiles/HexDump.dir/Main.cpp.o
[ 57%] Linking CXX executable HexDump
[ 57%] Built target HexDump
[ 59%] Building CXX object samples/Library/CMakeFiles/LibraryLib.dir/LibraryLib/Lib.cpp.o
[ 61%] Linking CXX static library libLibraryLib.a
[ 61%] Built target LibraryLib
[ 63%] Building CXX object samples/Library/CMakeFiles/LibraryApp.dir/LibraryApp/Main.cpp.o
[ 65%] Linking CXX executable LibraryApp
[ 65%] Built target LibraryApp
[ 67%] Building CXX object samples/MultiAppender/CMakeFiles/MultiAppender.dir/Main.cpp.o
[ 69%] Linking CXX executable MultiAppender
[ 69%] Built target MultiAppender
[ 71%] Building CXX object samples/MultiInstance/CMakeFiles/MultiInstance.dir/Main.cpp.o
[ 73%] Linking CXX executable MultiInstance
[ 73%] Built target MultiInstance
[ 75%] Building CXX object samples/Performance/CMakeFiles/Performance.dir/Main.cpp.o
[ 76%] Linking CXX executable Performance
[ 76%] Built target Performance
[ 78%] Building CXX object samples/PrintVar/CMakeFiles/PrintVar.dir/Main.cpp.o
[ 80%] Linking CXX executable PrintVar
[ 80%] Built target PrintVar
[ 82%] Building CXX object samples/SetFileName/CMakeFiles/SetFileName.dir/Main.cpp.o
[ 84%] Linking CXX executable SetFileName
[ 84%] Built target SetFileName
[ 86%] Building CXX object samples/Shared/CMakeFiles/SharedLib.dir/SharedLib/Main.cpp.o
[ 88%] Linking CXX shared library libSharedLib.dylib
[ 88%] Built target SharedLib
[ 90%] Building CXX object samples/Shared/CMakeFiles/SharedApp.dir/SharedApp/Main.cpp.o
[ 92%] Linking CXX executable SharedApp
[ 92%] Built target SharedApp
[ 94%] Building CXX object samples/SkipNativeEOL/CMakeFiles/SkipNativeEOL.dir/Main.cpp.o
[ 96%] Linking CXX executable SkipNativeEOL
[ 96%] Built target SkipNativeEOL
[ 98%] Building CXX object samples/UtcTime/CMakeFiles/UtcTime.dir/Main.cpp.o
[100%] Linking CXX executable UtcTime
[100%] Built target UtcTime
pptz commented 2 years ago

Confirm, building from scratch works. Thanks!

SergiusTheBest commented 2 years ago

I'm glad to hear that!