質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
CMake

CMakeはクロスプラットフォームで作動するオープンソースのビルドシステムです。コマンドライン又は組み込まれた開発環境で使うことができる元のmakefileとプロジェクトファイルを生成します。

Linux

Linuxは、Unixをベースにして開発されたオペレーティングシステムです。日本では「リナックス」と呼ばれています。 主にWebサーバやDNSサーバ、イントラネットなどのサーバ用OSとして利用されています。 上位500のスーパーコンピュータの90%以上はLinuxを使用しています。 携帯端末用のプラットフォームAndroidは、Linuxカーネル上に構築されています。

Q&A

1回答

1336閲覧

あOSRMのビルド作業中のcmakeが実行できない

Clementine

総合スコア157

CMake

CMakeはクロスプラットフォームで作動するオープンソースのビルドシステムです。コマンドライン又は組み込まれた開発環境で使うことができる元のmakefileとプロジェクトファイルを生成します。

Linux

Linuxは、Unixをベースにして開発されたオペレーティングシステムです。日本では「リナックス」と呼ばれています。 主にWebサーバやDNSサーバ、イントラネットなどのサーバ用OSとして利用されています。 上位500のスーパーコンピュータの90%以上はLinuxを使用しています。 携帯端末用のプラットフォームAndroidは、Linuxカーネル上に構築されています。

0グッド

0クリップ

投稿2021/06/12 15:29

編集2021/06/13 09:47

参考URL
https://qiita.com/ma91n/items/e188b0d5d21fe7aa0de7

上記URLを参考に地図経路検索サーバを構築してますが、次の環境でcmakeのコマンドが正しく実行できません。

環境

# cat /etc/redhat-release CentOS Linux release 7.8.2003 (Core) # gcc --version gcc (GCC) 7.3.0 Copyright (C) 2017 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. # cmake --version cmake version 3.20.3 CMake suite maintained and supported by Kitware (kitware.com/cmake).

コマンド実行結果

上記の環境にてコマンドの事項結果が以下の通りになります。

# cmake .. CMake Deprecation Warning at CMakeLists.txt:57 (cmake_policy): The OLD behavior for policy CMP0048 will be removed from a future version of CMake. The cmake-policies(7) manual explains that the OLD behaviors of all policies are deprecated and that a policy should be set to OLD only under specific short-term circumstances. Projects should be ported to the NEW behavior and not rely on setting a policy to OLD. -- Building on a 64 bit system CMake Error at CMakeLists.txt:125 (message): GCC>=5.0 required. In case you are on Ubuntu upgrade via ppa:ubuntu-toolchain-r/test -- Configuring incomplete, errors occurred!

調べた事

GCCのバージョンを5.0以上にアップグレードする旨エラーが出ております。

しかしGCCのバージョンは7.3.0の為、原因が分からない状態です。

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

もしかしてコンパイラがGCC5未満の状態でCMakeを実行したことがあって、その後GCCをアップデートして、またCMakeを実行したのではないですか?

だとしたらbuildディレクトリにCMakeのキャッシュが残っているせいだと思いますので、buildディレクトリの中身を全部削除してからcmake ..を実行してください。


それでもCMakeがコンパイラの検出を誤るようなら...ちゃんとGCC7が検出されるように設定する必要がありますね。この検出の仕組みは定かではありませんが、Unix Makefilesなら多分環境変数PATHの設定だけのような気もするので、見直してください。でもたぶんそれは問題ないのだと思いますが...

コンパイラを環境変数かオプション引数で指定する手段もあります。

How do I use a different compiler?

Your GeneratorのところはUnix Makefilesですね。

もしかしたらCMAKE_CXX_COMPILER_VERSIONCMAKE_CXX_COMPILER_IDも設定する必要があるかもしれません。

投稿2021/06/12 16:04

編集2021/06/12 17:26
itagagaki

総合スコア8402

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

Clementine

2021/06/13 09:47

ありがとうございます。 buildディレクトリ内のファイルを削除して実行しましたが症状変わらず次のコマンドを実行しても変化なしでした。 ``` # CC=gcc-7.3 CXX=/usr/bin/g++-7.3 cmake -G "Unix Makefiles" .. CMake Deprecation Warning at CMakeLists.txt:57 (cmake_policy): The OLD behavior for policy CMP0048 will be removed from a future version of CMake. The cmake-policies(7) manual explains that the OLD behaviors of all policies are deprecated and that a policy should be set to OLD only under specific short-term circumstances. Projects should be ported to the NEW behavior and not rely on setting a policy to OLD. -- Building on a 64 bit system CMake Error at CMakeLists.txt:125 (message): GCC>=5.0 required. In case you are on Ubuntu upgrade via ppa:ubuntu-toolchain-r/test -- Configuring incomplete, errors occurred! See also "/var/www/html/osrm/osrm-backend/build/CMakeFiles/CMakeOutput.log". ``` またログを確認するようにアラートが出たので参考情報として以下に転記します。 ``` cat /var/www/html/osrm/osrm-backend/build/CMakeFiles/CMakeOutput.log The system is: Linux - 3.10.0-1127.19.1.el7.x86_64 - x86_64 Compiling the C compiler identification source file "CMakeCCompilerId.c" succeeded. Compiler: /usr/bin/cc Build flags: Id flags: The output was: 0 Compilation of the C compiler identification source "CMakeCCompilerId.c" produced "a.out" The C compiler identification is GNU, found in "/var/www/html/osrm/osrm-backend/build/CMakeFiles/3.20.3/CompilerIdC/a.out" Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" succeeded. Compiler: /usr/bin/c++ Build flags: Id flags: The output was: 0 Compilation of the CXX compiler identification source "CMakeCXXCompilerId.cpp" produced "a.out" The CXX compiler identification is GNU, found in "/var/www/html/osrm/osrm-backend/build/CMakeFiles/3.20.3/CompilerIdCXX/a.out" Detecting C compiler ABI info compiled with the following output: Change Dir: /var/www/html/osrm/osrm-backend/build/CMakeFiles/CMakeTmp Run Build Command(s):/usr/bin/gmake -f Makefile cmTC_18269/fast && /usr/bin/gmake -f CMakeFiles/cmTC_18269.dir/build.make CMakeFiles/cmTC_18269.dir/build gmake[1]: Entering directory `/var/www/html/osrm/osrm-backend/build/CMakeFiles/CMakeTmp' Building C object CMakeFiles/cmTC_18269.dir/CMakeCCompilerABI.c.o /usr/bin/cc -v -o CMakeFiles/cmTC_18269.dir/CMakeCCompilerABI.c.o -c /opt/cmake-3.20.3-linux-x86_64/share/cmake-3.20/Modules/CMakeCCompilerABI.c Using built-in specs. COLLECT_GCC=/usr/bin/cc Target: x86_64-redhat-linux Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin --enable-initfini-array --disable-libgcj --with-isl=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/isl-install --with-cloog=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/cloog-install --enable-gnu-indirect-function --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux Thread model: posix gcc version 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC) COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_18269.dir/CMakeCCompilerABI.c.o' '-c' '-mtune=generic' '-march=x86-64' /usr/libexec/gcc/x86_64-redhat-linux/4.8.5/cc1 -quiet -v /opt/cmake-3.20.3-linux-x86_64/share/cmake-3.20/Modules/CMakeCCompilerABI.c -quiet -dumpbase CMakeCCompilerABI.c -mtune=generic -march=x86-64 -auxbase-strip CMakeFiles/cmTC_18269.dir/CMakeCCompilerABI.c.o -version -o /tmp/cciCkcOk.s GNU C (GCC) version 4.8.5 20150623 (Red Hat 4.8.5-44) (x86_64-redhat-linux) compiled by GNU C version 4.8.5 20150623 (Red Hat 4.8.5-44), GMP version 6.0.0, MPFR version 3.1.1, MPC version 1.0.1 GGC heuristics: --param ggc-min-expand=97 --param ggc-min-heapsize=126830 ignoring nonexistent directory "/usr/lib/gcc/x86_64-redhat-linux/4.8.5/include-fixed" ignoring nonexistent directory "/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../x86_64-redhat-linux/include" #include "..." search starts here: #include <...> search starts here: /usr/lib/gcc/x86_64-redhat-linux/4.8.5/include /usr/local/include /usr/include End of search list. // 省略 Detecting CXX [-std=c++1y] compiler features compiled with the following output: Change Dir: /var/www/html/osrm/osrm-backend/build/CMakeFiles/CMakeTmp Run Build Command(s):/usr/bin/gmake -f Makefile cmTC_70cc8/fast && /usr/bin/gmake -f CMakeFiles/cmTC_70cc8.dir/build.make CMakeFiles/cmTC_70cc8.dir/build gmake[1]: Entering directory `/var/www/html/osrm/osrm-backend/build/CMakeFiles/CMakeTmp' Building CXX object CMakeFiles/cmTC_70cc8.dir/feature_tests.cxx.o /usr/bin/c++ -std=c++1y -o CMakeFiles/cmTC_70cc8.dir/feature_tests.cxx.o -c /var/www/html/osrm/osrm-backend/build/CMakeFiles/feature_tests.cxx Linking CXX executable cmTC_70cc8 /opt/cmake-3.20.3-linux-x86_64/bin/cmake -E cmake_link_script CMakeFiles/cmTC_70cc8.dir/link.txt --verbose=1 /usr/bin/c++ -rdynamic CMakeFiles/cmTC_70cc8.dir/feature_tests.cxx.o -o cmTC_70cc8 gmake[1]: Leaving directory `/var/www/html/osrm/osrm-backend/build/CMakeFiles/CMakeTmp' Feature record: CXX_FEATURE:1cxx_template_template_parameters Feature record: CXX_FEATURE:1cxx_alias_templates Feature record: CXX_FEATURE:1cxx_alignas Feature record: CXX_FEATURE:1cxx_alignof Feature record: CXX_FEATURE:1cxx_attributes Feature record: CXX_FEATURE:1cxx_auto_type Feature record: CXX_FEATURE:1cxx_constexpr Feature record: CXX_FEATURE:1cxx_decltype Feature record: CXX_FEATURE:1cxx_decltype_incomplete_return_types Feature record: CXX_FEATURE:1cxx_default_function_template_args Feature record: CXX_FEATURE:1cxx_defaulted_functions Feature record: CXX_FEATURE:1cxx_defaulted_move_initializers Feature record: CXX_FEATURE:1cxx_delegating_constructors Feature record: CXX_FEATURE:1cxx_deleted_functions Feature record: CXX_FEATURE:1cxx_enum_forward_declarations Feature record: CXX_FEATURE:1cxx_explicit_conversions Feature record: CXX_FEATURE:1cxx_extended_friend_declarations Feature record: CXX_FEATURE:1cxx_extern_templates Feature record: CXX_FEATURE:1cxx_final Feature record: CXX_FEATURE:1cxx_func_identifier Feature record: CXX_FEATURE:1cxx_generalized_initializers Feature record: CXX_FEATURE:1cxx_inheriting_constructors Feature record: CXX_FEATURE:1cxx_inline_namespaces Feature record: CXX_FEATURE:1cxx_lambdas Feature record: CXX_FEATURE:1cxx_local_type_template_args Feature record: CXX_FEATURE:1cxx_long_long_type Feature record: CXX_FEATURE:1cxx_noexcept Feature record: CXX_FEATURE:1cxx_nonstatic_member_init Feature record: CXX_FEATURE:1cxx_nullptr Feature record: CXX_FEATURE:1cxx_override Feature record: CXX_FEATURE:1cxx_range_for Feature record: CXX_FEATURE:1cxx_raw_string_literals Feature record: CXX_FEATURE:1cxx_reference_qualified_functions Feature record: CXX_FEATURE:1cxx_right_angle_brackets Feature record: CXX_FEATURE:1cxx_rvalue_references Feature record: CXX_FEATURE:1cxx_sizeof_member Feature record: CXX_FEATURE:1cxx_static_assert Feature record: CXX_FEATURE:1cxx_strong_enums Feature record: CXX_FEATURE:1cxx_thread_local Feature record: CXX_FEATURE:1cxx_trailing_return_types Feature record: CXX_FEATURE:1cxx_unicode_literals Feature record: CXX_FEATURE:1cxx_uniform_initialization Feature record: CXX_FEATURE:1cxx_unrestricted_unions Feature record: CXX_FEATURE:1cxx_user_literals Feature record: CXX_FEATURE:1cxx_variadic_macros Feature record: CXX_FEATURE:1cxx_variadic_templates Feature record: CXX_FEATURE:0cxx_aggregate_default_initializers Feature record: CXX_FEATURE:0cxx_attribute_deprecated Feature record: CXX_FEATURE:0cxx_binary_literals Feature record: CXX_FEATURE:0cxx_contextual_conversions Feature record: CXX_FEATURE:0cxx_decltype_auto Feature record: CXX_FEATURE:0cxx_digit_separators Feature record: CXX_FEATURE:0cxx_generic_lambdas Feature record: CXX_FEATURE:0cxx_lambda_init_captures Feature record: CXX_FEATURE:0cxx_relaxed_constexpr Feature record: CXX_FEATURE:0cxx_return_type_deduction Feature record: CXX_FEATURE:0cxx_variable_templates ``` ログより何処が原因なのか未だわかりませんが。教えて頂いたCMAKE_CXX_COMPILER_VERSIONの変数によりCMakeLists.txtを確認したところ、 ``` if(CMAKE_CXX_COMPILER_ID MATCHES "GNU") if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0) message(FATAL_ERROR "GCC>=5.0 required. In case you are on Ubuntu upgrade via ppa:ubuntu-toolchain-r/test") endif() elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang") if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.4) message(FATAL_ERROR "Clang>=3.4 required. In case you are on Ubuntu upgrade via http://apt.llvm.org") endif() endif() ``` のコードより ``` GCC>=5.0 required. In case you are on Ubuntu upgrade via ppa:ubuntu-toolchain-r/test ``` のエラーが原因で止まっているように見えないように感じます。 私の認識が間違っているのでしょうか?
itagagaki

2021/06/13 10:00

ログに gcc version 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC) って表示されてますね... ls -l /usr/bin/cc /usr/bin/cc --version してみてください。
Clementine

2021/06/13 11:00

ありがとうございます。 # ls -l /usr/bin/cc lrwxrwxrwx 1 root root 3 Jun 12 22:22 /usr/bin/cc -> gcc # /usr/bin/cc --version cc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44) Copyright (C) 2015 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. 教えて頂いたコマンドを実行した結果5.0以下のバージョンが表示されたので原因に近づいてるような気がします。 しかし、 gcc --version gcc (GCC) 7.3.0 Copyright (C) 2017 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. なのに何故違うバージョンで認識されるのか、また7.3.0をどうすれば認識されるのかその方法を調べますが、今回の「/usr/bin/cc --version」での確認に行き着けなかった事を含め、対応策についてご教授いただけますでしょうか?
itagagaki

2021/06/13 11:19

type gcc して、そのgcc 7.3.0のパスを確認してください。/usr/local/bin/gcc と仮定すれば、 cmake -D CMAKE_C_COMPILER=/usr/local/bin/gcc -D CMAKE_CXX_COMPILER=/usr/local/bin/g++ .. で行けるかと。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだベストアンサーが選ばれていません

会員登録して回答してみよう

アカウントをお持ちの方は

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問