The Modern C++ Challenge
https://qiita.com/kaizen_nagoya/items/5e390e5a4afc8bb9cb1f
The Modern C++ Challenge
Source code
https://github.com/PacktPublishing/The-Modern-Cpp-Challenge
ソースードをG++, Clang++, Visual C++の3種類でコンパイルしてみる。
最初はg++
$ docker run -it gcc /bin/bash
# gcc --version
gcc (GCC) 8.2.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
g++ first error
console log
error.log
output.log
error調査
console log
1 add_subdirectory given source "libs/PngWriter" which is not an existing directory.
console.log
CMake Error at CMakeLists.txt:23 (add_subdirectory):
add_subdirectory given source "libs/PngWriter" which is not an existing
directory.
ファイルの存在確認
# cd ..
# ls
CMakeLists.txt Chapter02 Chapter04 Chapter06 Chapter08 Chapter10 Chapter12 README.md include
Chapter01 Chapter03 Chapter05 Chapter07 Chapter09 Chapter11 LICENSE build libs
# ls libs
PDF-Writer PNGWriter ZipLib asio cryptopp curl curlcpp date nlohmannjson pugixml sqlite sqlite_modern_cpp stduuid
# cd libs
# ls PNGWriter
CMakeLists.txt pngwriter.cc pngwriter.h
ファイルの大文字、小文字関係が違う。結局、うまくいったのか、うまくいかなかったものがあるのかがわからない。
確認する方法はいくつか
1) もう一度やってみる。
もし、PNGWriterでもよければ次はエラーがでない。
2) PngWriterフォルダを作ってもう一度やってみる。
3) CMakeLists.txtを編集してPgnWriterをPNGWriterでやって見る。
4) PNGWriter, PngWriterを全フォルダ内のファイルの記述を探す。
この方法は、内容を変更しない。まずgrepから。
# grep -r PNGWriter *
# grep -r PngWriter *
CMakeLists.txt:add_subdirectory(libs/PngWriter)
Chapter10/problem_82/CMakeLists.txt:target_link_libraries(problem_82 PngWriter)
Chapter10/problem_84/CMakeLists.txt:target_link_libraries(problem_84 PngWriter)
Chapter10/problem_83/CMakeLists.txt:target_link_libraries(problem_83 PngWriter)
build/CMakeFiles/console.log: add_subdirectory given source "libs/PngWriter" which is not an existing
libs/PNGWriter/CMakeLists.txt:project(PngWriter)
libs/PNGWriter/CMakeLists.txt:add_library (PngWriter STATIC ${headers} ${sources})
libs/PNGWriter/CMakeLists.txt:target_link_libraries(PngWriter LibPng)
libs/PNGWriter/CMakeLists.txt:target_link_libraries(PngWriter FreeType)
libs/PNGWriter/CMakeLists.txt:set_target_properties (PngWriter PROPERTIES FOLDER "00.Libs")
その他の調査は、別の案件と同時に確認。
2 the curl cmake build system is poorly maintained. Be aware
CMake Warning at libs/curl/CMakeLists.txt:50 (message):
the curl cmake build system is poorly maintained. Be aware
よくわからない。apt-get install curlでの挙動を見て見る。
# apt update
Ign:1 http://deb.debian.org/debian stretch InRelease
Get:2 http://security.debian.org/debian-security stretch/updates InRelease [94.3 kB]
Get:3 http://deb.debian.org/debian stretch-updates InRelease [91.0 kB]
Hit:4 http://deb.debian.org/debian stretch Release
Get:5 http://security.debian.org/debian-security stretch/updates/main amd64 Packages [475 kB]
Fetched 660 kB in 1s (559 kB/s)
Reading package lists... Done
# apt install -y curl
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
libcurl3 libcurl4-openssl-dev
Suggested packages:
libcurl4-doc libcurl3-dbg libidn11-dev libldap2-dev librtmp-dev libssh2-1-dev libssl1.0-dev | libssl-dev
The following packages will be upgraded:
curl libcurl3 libcurl4-openssl-dev
3 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.
Need to get 893 kB of archives.
After this operation, 0 B of additional disk space will be used.
Get:1 http://security.debian.org/debian-security stretch/updates/main amd64 libcurl4-openssl-dev amd64 7.52.1-5+deb9u9 [374 kB]
Get:2 http://security.debian.org/debian-security stretch/updates/main amd64 curl amd64 7.52.1-5+deb9u9 [227 kB]
Get:3 http://security.debian.org/debian-security stretch/updates/main amd64 libcurl3 amd64 7.52.1-5+deb9u9 [292 kB]
Fetched 893 kB in 0s (1017 kB/s)
debconf: unable to initialize frontend: Dialog
debconf: (No usable dialog-like program is installed, so the dialog based frontend cannot be used. at /usr/share/perl5/Debconf/FrontEnd/Dialog.pm line 76, <> line 3.)
debconf: falling back to frontend: Readline
(Reading database ... 34225 files and directories currently installed.)
Preparing to unpack .../libcurl4-openssl-dev_7.52.1-5+deb9u9_amd64.deb ...
Unpacking libcurl4-openssl-dev:amd64 (7.52.1-5+deb9u9) over (7.52.1-5+deb9u8) ...
Preparing to unpack .../curl_7.52.1-5+deb9u9_amd64.deb ...
Unpacking curl (7.52.1-5+deb9u9) over (7.52.1-5+deb9u8) ...
Preparing to unpack .../libcurl3_7.52.1-5+deb9u9_amd64.deb ...
Unpacking libcurl3:amd64 (7.52.1-5+deb9u9) over (7.52.1-5+deb9u8) ...
Setting up libcurl3:amd64 (7.52.1-5+deb9u9) ...
Processing triggers for libc-bin (2.24-11+deb9u3) ...
Setting up libcurl4-openssl-dev:amd64 (7.52.1-5+deb9u9) ...
Setting up curl (7.52.1-5+deb9u9) ...
# apt upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages will be upgraded:
libcurl3-gnutls openssh-client
2 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 1069 kB of archives.
After this operation, 1024 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://security.debian.org/debian-security stretch/updates/main amd64 openssh-client amd64 1:7.4p1-10+deb9u5 [779 kB]
Get:2 http://security.debian.org/debian-security stretch/updates/main amd64 libcurl3-gnutls amd64 7.52.1-5+deb9u9 [290 kB]
Fetched 1069 kB in 0s (2593 kB/s)
debconf: unable to initialize frontend: Dialog
debconf: (No usable dialog-like program is installed, so the dialog based frontend cannot be used. at /usr/share/perl5/Debconf/FrontEnd/Dialog.pm line 76, <> line 2.)
debconf: falling back to frontend: Readline
(Reading database ... 34225 files and directories currently installed.)
Preparing to unpack .../openssh-client_1%3a7.4p1-10+deb9u5_amd64.deb ...
Unpacking openssh-client (1:7.4p1-10+deb9u5) over (1:7.4p1-10+deb9u4) ...
Preparing to unpack .../libcurl3-gnutls_7.52.1-5+deb9u9_amd64.deb ...
Unpacking libcurl3-gnutls:amd64 (7.52.1-5+deb9u9) over (7.52.1-5+deb9u8) ...
Setting up libcurl3-gnutls:amd64 (7.52.1-5+deb9u9) ...
Processing triggers for libc-bin (2.24-11+deb9u3) ...
Setting up openssh-client (1:7.4p1-10+deb9u5) ...
3 Found no *nroff program
CMake Warning at libs/curl/CMake/Macros.cmake:122 (message):
Found no *nroff program
Call Stack (most recent call first):
libs/curl/CMakeLists.txt:206 (CURL_NROFF_CHECK)
# apt install -y groff
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
fonts-droid-fallback fonts-noto-mono ghostscript groff-base gsfonts libcupsfilters1 libcupsimage2 libgs9 libgs9-common libijs-0.35 libjbig2dec0
libnetpbm10 libpaper-utils libpaper1 libxaw7 libxmu6 netpbm poppler-data psutils
Suggested packages:
fonts-noto ghostscript-x poppler-utils fonts-japanese-mincho | fonts-ipafont-mincho fonts-japanese-gothic | fonts-ipafont-gothic
fonts-arphic-ukai fonts-arphic-uming fonts-nanum
The following NEW packages will be installed:
fonts-droid-fallback fonts-noto-mono ghostscript groff groff-base gsfonts libcupsfilters1 libcupsimage2 libgs9 libgs9-common libijs-0.35
libjbig2dec0 libnetpbm10 libpaper-utils libpaper1 libxaw7 libxmu6 netpbm poppler-data psutils
0 upgraded, 20 newly installed, 0 to remove and 0 not upgraded.
Need to get 20.0 MB of archives.
After this operation, 68.1 MB of additional disk space will be used.
Get:1 http://security.debian.org/debian-security stretch/updates/main amd64 libgs9-common all 9.26a~dfsg-0+deb9u1 [5140 kB]
Get:2 http://deb.debian.org/debian stretch/main amd64 fonts-droid-fallback all 1:6.0.1r16-1.1 [1807 kB]
Get:3 http://deb.debian.org/debian stretch/main amd64 poppler-data all 0.4.7-8 [1451 kB]
Get:4 http://security.debian.org/debian-security stretch/updates/main amd64 libgs9 amd64 9.26a~dfsg-0+deb9u1 [2211 kB]
Get:5 http://deb.debian.org/debian stretch/main amd64 groff-base amd64 1.22.3-9 [1160 kB]
Get:6 http://security.debian.org/debian-security stretch/updates/main amd64 ghostscript amd64 9.26a~dfsg-0+deb9u1 [98.8 kB]
Get:7 http://deb.debian.org/debian stretch/main amd64 fonts-noto-mono all 20161116-1 [79.2 kB]
Get:8 http://deb.debian.org/debian stretch/main amd64 libcupsimage2 amd64 2.2.1-8+deb9u2 [122 kB]
Get:9 http://deb.debian.org/debian stretch/main amd64 libijs-0.35 amd64 0.35-12 [18.4 kB]
Get:10 http://deb.debian.org/debian stretch/main amd64 libjbig2dec0 amd64 0.13-4.1 [60.1 kB]
Get:11 http://deb.debian.org/debian stretch/main amd64 libpaper1 amd64 1.1.24+nmu5 [21.6 kB]
Get:12 http://deb.debian.org/debian stretch/main amd64 libxmu6 amd64 2:1.1.2-2 [60.3 kB]
Get:13 http://deb.debian.org/debian stretch/main amd64 libxaw7 amd64 2:1.0.13-1+b2 [201 kB]
Get:14 http://deb.debian.org/debian stretch/main amd64 groff amd64 1.22.3-9 [3161 kB]
Get:15 http://deb.debian.org/debian stretch/main amd64 gsfonts all 1:8.11+urwcyr1.0.7~pre44-4.3 [3126 kB]
Get:16 http://deb.debian.org/debian stretch/main amd64 libcupsfilters1 amd64 1.11.6-3 [129 kB]
Get:17 http://deb.debian.org/debian stretch/main amd64 libnetpbm10 amd64 2:10.0-15.3+b2 [86.7 kB]
Get:18 http://deb.debian.org/debian stretch/main amd64 libpaper-utils amd64 1.1.24+nmu5 [17.6 kB]
Get:19 http://deb.debian.org/debian stretch/main amd64 netpbm amd64 2:10.0-15.3+b2 [1029 kB]
Get:20 http://deb.debian.org/debian stretch/main amd64 psutils amd64 1.17.dfsg-4 [59.1 kB]
Fetched 20.0 MB in 5s (3778 kB/s)
debconf: unable to initialize frontend: Dialog
debconf: (No usable dialog-like program is installed, so the dialog based frontend cannot be used. at /usr/share/perl5/Debconf/FrontEnd/Dialog.pm line 76, <> line 20.)
debconf: falling back to frontend: Readline
Preconfiguring packages ...
Selecting previously unselected package fonts-droid-fallback.
(Reading database ... 34225 files and directories currently installed.)
Preparing to unpack .../00-fonts-droid-fallback_1%3a6.0.1r16-1.1_all.deb ...
Unpacking fonts-droid-fallback (1:6.0.1r16-1.1) ...
Selecting previously unselected package poppler-data.
Preparing to unpack .../01-poppler-data_0.4.7-8_all.deb ...
Unpacking poppler-data (0.4.7-8) ...
Selecting previously unselected package groff-base.
Preparing to unpack .../02-groff-base_1.22.3-9_amd64.deb ...
Unpacking groff-base (1.22.3-9) ...
Selecting previously unselected package fonts-noto-mono.
Preparing to unpack .../03-fonts-noto-mono_20161116-1_all.deb ...
Unpacking fonts-noto-mono (20161116-1) ...
Selecting previously unselected package libcupsimage2:amd64.
Preparing to unpack .../04-libcupsimage2_2.2.1-8+deb9u2_amd64.deb ...
Unpacking libcupsimage2:amd64 (2.2.1-8+deb9u2) ...
Selecting previously unselected package libijs-0.35:amd64.
Preparing to unpack .../05-libijs-0.35_0.35-12_amd64.deb ...
Unpacking libijs-0.35:amd64 (0.35-12) ...
Selecting previously unselected package libjbig2dec0:amd64.
Preparing to unpack .../06-libjbig2dec0_0.13-4.1_amd64.deb ...
Unpacking libjbig2dec0:amd64 (0.13-4.1) ...
Selecting previously unselected package libpaper1:amd64.
Preparing to unpack .../07-libpaper1_1.1.24+nmu5_amd64.deb ...
Unpacking libpaper1:amd64 (1.1.24+nmu5) ...
Selecting previously unselected package libgs9-common.
Preparing to unpack .../08-libgs9-common_9.26a~dfsg-0+deb9u1_all.deb ...
Unpacking libgs9-common (9.26a~dfsg-0+deb9u1) ...
Selecting previously unselected package libgs9:amd64.
Preparing to unpack .../09-libgs9_9.26a~dfsg-0+deb9u1_amd64.deb ...
Unpacking libgs9:amd64 (9.26a~dfsg-0+deb9u1) ...
Selecting previously unselected package ghostscript.
Preparing to unpack .../10-ghostscript_9.26a~dfsg-0+deb9u1_amd64.deb ...
Unpacking ghostscript (9.26a~dfsg-0+deb9u1) ...
Selecting previously unselected package libxmu6:amd64.
Preparing to unpack .../11-libxmu6_2%3a1.1.2-2_amd64.deb ...
Unpacking libxmu6:amd64 (2:1.1.2-2) ...
Selecting previously unselected package libxaw7:amd64.
Preparing to unpack .../12-libxaw7_2%3a1.0.13-1+b2_amd64.deb ...
Unpacking libxaw7:amd64 (2:1.0.13-1+b2) ...
Selecting previously unselected package groff.
Preparing to unpack .../13-groff_1.22.3-9_amd64.deb ...
Unpacking groff (1.22.3-9) ...
Selecting previously unselected package gsfonts.
Preparing to unpack .../14-gsfonts_1%3a8.11+urwcyr1.0.7~pre44-4.3_all.deb ...
Unpacking gsfonts (1:8.11+urwcyr1.0.7~pre44-4.3) ...
Selecting previously unselected package libcupsfilters1:amd64.
Preparing to unpack .../15-libcupsfilters1_1.11.6-3_amd64.deb ...
Unpacking libcupsfilters1:amd64 (1.11.6-3) ...
Selecting previously unselected package libnetpbm10.
Preparing to unpack .../16-libnetpbm10_2%3a10.0-15.3+b2_amd64.deb ...
Unpacking libnetpbm10 (2:10.0-15.3+b2) ...
Selecting previously unselected package libpaper-utils.
Preparing to unpack .../17-libpaper-utils_1.1.24+nmu5_amd64.deb ...
Unpacking libpaper-utils (1.1.24+nmu5) ...
Selecting previously unselected package netpbm.
Preparing to unpack .../18-netpbm_2%3a10.0-15.3+b2_amd64.deb ...
Unpacking netpbm (2:10.0-15.3+b2) ...
Selecting previously unselected package psutils.
Preparing to unpack .../19-psutils_1.17.dfsg-4_amd64.deb ...
Unpacking psutils (1.17.dfsg-4) ...
Setting up libgs9-common (9.26a~dfsg-0+deb9u1) ...
Setting up libpaper1:amd64 (1.1.24+nmu5) ...
debconf: unable to initialize frontend: Dialog
debconf: (No usable dialog-like program is installed, so the dialog based frontend cannot be used. at /usr/share/perl5/Debconf/FrontEnd/Dialog.pm line 76.)
debconf: falling back to frontend: Readline
Creating config file /etc/papersize with new version
Setting up fonts-droid-fallback (1:6.0.1r16-1.1) ...
Setting up libpaper-utils (1.1.24+nmu5) ...
Processing triggers for mime-support (3.60) ...
Setting up gsfonts (1:8.11+urwcyr1.0.7~pre44-4.3) ...
Setting up poppler-data (0.4.7-8) ...
Setting up groff-base (1.22.3-9) ...
Setting up libnetpbm10 (2:10.0-15.3+b2) ...
Setting up psutils (1.17.dfsg-4) ...
Setting up libxmu6:amd64 (2:1.1.2-2) ...
Setting up fonts-noto-mono (20161116-1) ...
Setting up libcupsimage2:amd64 (2.2.1-8+deb9u2) ...
Setting up libjbig2dec0:amd64 (0.13-4.1) ...
Processing triggers for libc-bin (2.24-11+deb9u3) ...
Setting up libijs-0.35:amd64 (0.35-12) ...
Setting up netpbm (2:10.0-15.3+b2) ...
Setting up libgs9:amd64 (9.26a~dfsg-0+deb9u1) ...
Processing triggers for fontconfig (2.11.0-6.7+b1) ...
Setting up libxaw7:amd64 (2:1.0.13-1+b2) ...
Setting up ghostscript (9.26a~dfsg-0+deb9u1) ...
Setting up libcupsfilters1:amd64 (1.11.6-3) ...
Setting up groff (1.22.3-9) ...
Processing triggers for libc-bin (2.24-11+deb9u3) ...
4 not found
-- Found Perl: /usr/bin/perl (found version "5.24.1")
-- Looking for pthread_create in pthreads - not found
-- Looking for connect in socket;dl;-lpthread - not found
-- Found OpenSSL: /usr/lib/x86_64-linux-gnu/libssl.so;/usr/lib/x86_64-linux-gnu/libcrypto.so (found version "1.1.0j")
-- Looking for RAND_status - not found
-- Looking for RAND_screen - not found
-- Looking for RAND_egd - not found
-- Looking for ldap_init in ldap;dl;-lpthread;/usr/lib/x86_64-linux-gnu/libssl.so;/usr/lib/x86_64-linux-gnu/libcrypto.so - not found
-- Looking for ber_init in lber;dl;-lpthread;/usr/lib/x86_64-linux-gnu/libssl.so;/usr/lib/x86_64-linux-gnu/libcrypto.so - not found
-- Looking for include file ldap.h - not found
-- Looking for include file lber.h - not found
-- Looking for idn2_lookup_ul in idn2;dl;-lpthread;/usr/lib/x86_64-linux-gnu/libssl.so;/usr/lib/x86_64-linux-gnu/libcrypto.so - not found
-- Found CA bundle: /etc/ssl/certs/ca-certificates.crt
-- Looking for 3 include files stdio.h, ..., sys/filio.h - not found
-- Looking for 9 include files stdio.h, ..., sys/sockio.h - not found
-- Looking for 19 include files stdio.h, ..., crypto.h - not found
-- Looking for 19 include files stdio.h, ..., des.h - not found
-- Looking for 22 include files stdio.h, ..., idn2.h - not found
-- Looking for 23 include files stdio.h, ..., io.h - not found
-- Looking for 23 include files stdio.h, ..., krb.h - not found
-- Looking for 29 include files stdio.h, ..., pem.h - not found
-- Looking for 31 include files stdio.h, ..., rsa.h - not found
-- Looking for 34 include files stdio.h, ..., ssl.h - not found
-- Looking for 46 include files stdio.h, ..., x509.h - not found
-- Looking for 46 include files stdio.h, ..., process.h - not foun
-- Looking for 52 include files stdio.h, ..., sockio.h - not found
docker hub
$ docker pull -it kaizenjapan/mccgcc /bin/bash
参考資料
cmake Cmakelists.txt
https://qiita.com/kaizen_nagoya/items/c109c3a0c7fb18cb9dbd