编译器版本在 OpenBSD 6.6 上的 scons 中没有改变

compiler version not change in scons on OpenBSD 6.6

我想在 OpenBSD 6.6

中从源代码编译 mongodb

根据 this link 我们必须更改 scons 参数中的编译器版本,但此参数无效。

安装任何要求后:

buildscripts/scons.py MONGO_VERSION=4.3.5 -j4 --d --cc=egcc --cxx=eg++ --disable-warnings-as-errors --ssl=off mongod mongo

输出

scons version: 3.1.2
python version: 3 7 4 'final' 0
CC is gcc
gcc found in $PATH at /usr/bin/gcc
CXX is g++
g++ found in $PATH at /usr/bin/g++
Checking whether the C compiler works... yes
Checking whether the C++ compiler works... yes
Checking that the C++ compiler can link a C++ program... yes
Checking if C++ compiler "g++" is GCC... yes
Checking if C compiler "gcc" is GCC... yes
Detected a x86_64 processor
Checking if target OS openbsd is supported by the toolchain... yes
Checking if C compiler is GCC 8.2 or newer...no
Checking if C++ compiler is GCC 8.2 or newer...no
ERROR: Refusing to build with compiler that does not meet requirements
See /home/mongo-r4.3.5/build/scons/config.log for details

scons/config.log

file /home/mongo-r4.3.5/SConstruct,line 1300:
    Configure(confdir = build/scons/opt/sconf_temp)
scons: Configure: Checking whether the C compiler works... 
build/scons/opt/sconf_temp/conftest_737c003a897167642b70f8cdde8a0eaf_0.c <-
  |
  |int main(void)
  |{
  |    return 0;
  |}
  |
gcc -o build/scons/opt/sconf_temp/conftest_737c003a897167642b70f8cdde8a0eaf_0_4e018b83dbae4a564d3abaec0d4c8465.o -c build/scons/opt/sconf_temp/conftest_737c003a897167642b70f8cdde8a0eaf_0.c
scons: Configure: yes

scons: Configure: Checking whether the C++ compiler works... 
build/scons/opt/sconf_temp/conftest_737c003a897167642b70f8cdde8a0eaf_1.cpp <-
  |
  |int main(void)
  |{
  |    return 0;
  |}
  |
g++ -o build/scons/opt/sconf_temp/conftest_737c003a897167642b70f8cdde8a0eaf_1_f4c6a764e80b6d2f336f5311c617b0d0.o -c build/scons/opt/sconf_temp/conftest_737c003a897167642b70f8cdde8a0eaf_1.cpp
scons: Configure: yes

scons: Configure: Checking that the C++ compiler can link a C++ program... 
build/scons/opt/sconf_temp/conftest_ac30bfea77045c1c67c4f51773b51414_0.cpp <-
  |
  |#include <iostream>
  |#include <cstdlib>
  |
  |int main() {
  |    std::cout << "Hello, World" << std::endl;
  |    return EXIT_SUCCESS;
  |}
  |
g++ -o build/scons/opt/sconf_temp/conftest_ac30bfea77045c1c67c4f51773b51414_0.o -c build/scons/opt/sconf_temp/conftest_ac30bfea77045c1c67c4f51773b51414_0.cpp
g++ -o build/scons/opt/sconf_temp/conftest_ac30bfea77045c1c67c4f51773b51414_0_fb048025625fc91381d082d9ffbfb5b5 build/scons/opt/sconf_temp/conftest_ac30bfea77045c1c67c4f51773b51414_0.o
scons: Configure: yes

scons: Configure: Checking if C++ compiler "g++" is GCC... 
build/scons/opt/sconf_temp/conftest_4f0e9b4472e273623d18770138ab2253_0.cpp <-
  |
  |#if defined(__GNUC__) && !defined(__clang__)
  |/* we are using toolchain defined(__GNUC__) && !defined(__clang__) */
  |#else
  |#error
  |#endif
  |
g++ -o build/scons/opt/sconf_temp/conftest_4f0e9b4472e273623d18770138ab2253_0_a53f49f0a5b49d3a1930add1c669ff5d.o -c build/scons/opt/sconf_temp/conftest_4f0e9b4472e273623d18770138ab2253_0.cpp
scons: Configure: yes

scons: Configure: Checking if C compiler "gcc" is GCC... 
build/scons/opt/sconf_temp/conftest_4f0e9b4472e273623d18770138ab2253_1.c <-
  |
  |#if defined(__GNUC__) && !defined(__clang__)
  |/* we are using toolchain defined(__GNUC__) && !defined(__clang__) */
  |#else
  |#error
  |#endif
  |
gcc -o build/scons/opt/sconf_temp/conftest_4f0e9b4472e273623d18770138ab2253_1_ea0252cf890ba84f7517f6fab562dbfd.o -c build/scons/opt/sconf_temp/conftest_4f0e9b4472e273623d18770138ab2253_1.c
scons: Configure: yes

build/scons/opt/sconf_temp/conftest_88c70ef45b935cd9e8e481913b1c9792_0.c <-
  |
  |#if defined(__arm__)
  |/* Detected arm */
  |#else
  |#error not arm
  |#endif
  |
gcc -o build/scons/opt/sconf_temp/conftest_88c70ef45b935cd9e8e481913b1c9792_0_56b3766c230d14b22692a2e42ffc5229.o -c build/scons/opt/sconf_temp/conftest_88c70ef45b935cd9e8e481913b1c9792_0.c
build/scons/opt/sconf_temp/conftest_88c70ef45b935cd9e8e481913b1c9792_0.c:5:2: error: #error not arm
build/scons/opt/sconf_temp/conftest_aa9c0ec15eb67315005e48c7142d5763_0.c <-
  |
  |#if defined(__arm64__) || defined(__aarch64__)
  |/* Detected aarch64 */
  |#else
  |#error not aarch64
  |#endif
  |
gcc -o build/scons/opt/sconf_temp/conftest_aa9c0ec15eb67315005e48c7142d5763_0_4907f655c8dbe62d40c4d0e3b5d4b442.o -c build/scons/opt/sconf_temp/conftest_aa9c0ec15eb67315005e48c7142d5763_0.c
build/scons/opt/sconf_temp/conftest_aa9c0ec15eb67315005e48c7142d5763_0.c:5:2: error: #error not aarch64
build/scons/opt/sconf_temp/conftest_067efcd68b39191f21773501607a9c8e_0.c <-
  |
  |#if defined(__i386) || defined(_M_IX86)
  |/* Detected i386 */
  |#else
  |#error not i386
  |#endif
  |
gcc -o build/scons/opt/sconf_temp/conftest_067efcd68b39191f21773501607a9c8e_0_d874f0935a66606de8e5f3cd15acdcd5.o -c build/scons/opt/sconf_temp/conftest_067efcd68b39191f21773501607a9c8e_0.c
build/scons/opt/sconf_temp/conftest_067efcd68b39191f21773501607a9c8e_0.c:5:2: error: #error not i386
build/scons/opt/sconf_temp/conftest_c0b1d7f6a7951557b08b1879d2707012_0.c <-
  |
  |#if defined(__powerpc64__)
  |/* Detected ppc64le */
  |#else
  |#error not ppc64le
  |#endif
  |
gcc -o build/scons/opt/sconf_temp/conftest_c0b1d7f6a7951557b08b1879d2707012_0_b03372b9b60e0f4472112644b94166bc.o -c build/scons/opt/sconf_temp/conftest_c0b1d7f6a7951557b08b1879d2707012_0.c
build/scons/opt/sconf_temp/conftest_c0b1d7f6a7951557b08b1879d2707012_0.c:5:2: error: #error not ppc64le
build/scons/opt/sconf_temp/conftest_6732939b06375ebbd46b5e264f3adb2e_0.c <-
  |
  |#if defined(__x86_64) || defined(_M_AMD64)
  |/* Detected x86_64 */
  |#else
  |#error not x86_64
  |#endif
  |
gcc -o build/scons/opt/sconf_temp/conftest_6732939b06375ebbd46b5e264f3adb2e_0_750e5292f9cc0aa3a08058bf9313e042.o -c build/scons/opt/sconf_temp/conftest_6732939b06375ebbd46b5e264f3adb2e_0.c
scons: Configure: Detected a x86_64 processor

scons: Configure: Checking if target OS openbsd is supported by the toolchain... 
build/scons/opt/sconf_temp/conftest_613421ebbfe8385e1a2f5e967e179457_0.c <-
  |
  |#if defined(__APPLE__)
  |#include <TargetConditionals.h>
  |#endif
  |#if defined(__OpenBSD__)
  |/* detected openbsd */
  |#else
  |#error
  |#endif
  |
gcc -o build/scons/opt/sconf_temp/conftest_613421ebbfe8385e1a2f5e967e179457_0_d1c28ea2c0ebdf26a0347f9a123b4526.o -c build/scons/opt/sconf_temp/conftest_613421ebbfe8385e1a2f5e967e179457_0.c
scons: Configure: yes


file /home/mongo-r4.3.5/SConstruct,line 2228:
    Configure(confdir = build/scons/opt/sconf_temp)
scons: Configure: Checking if C compiler is GCC 8.2 or newer...
build/scons/opt/sconf_temp/conftest_fe605161eb05ed15a28dad50dd5c2d3a_0.c <-
  |
  |#if !defined(__GNUC__) || defined(__clang__)
  |#error
  |#endif
  |
  |#if (__GNUC__ < 8) || (__GNUC__ == 8 && __GNUC_MINOR__ < 2)
  |#error GCC 8.2 or newer is required to build MongoDB
  |#endif
  |
  |int main(int argc, char* argv[]) {
  |    return 0;
  |}
  |
Compiling build/scons/opt/sconf_temp/conftest_fe605161eb05ed15a28dad50dd5c2d3a_0_b43c784ef1c4af62a5fb20c3947ce1d6.o
build/scons/opt/sconf_temp/conftest_fe605161eb05ed15a28dad50dd5c2d3a_0.c:7:2: error: #error GCC 8.2 or newer is required to build MongoDB
scons: Configure: no

scons: Configure: Checking if C++ compiler is GCC 8.2 or newer...
build/scons/opt/sconf_temp/conftest_fe605161eb05ed15a28dad50dd5c2d3a_1.cpp <-
  |
  |#if !defined(__GNUC__) || defined(__clang__)
  |#error
  |#endif
  |
  |#if (__GNUC__ < 8) || (__GNUC__ == 8 && __GNUC_MINOR__ < 2)
  |#error GCC 8.2 or newer is required to build MongoDB
  |#endif
  |
  |int main(int argc, char* argv[]) {
  |    return 0;
  |}
  |
Compiling build/scons/opt/sconf_temp/conftest_fe605161eb05ed15a28dad50dd5c2d3a_1_f4a5f31a5fc1ca8177787fe1e36f2441.o
build/scons/opt/sconf_temp/conftest_fe605161eb05ed15a28dad50dd5c2d3a_1.cpp:7:2: error: #error GCC 8.2 or newer is required to build MongoDB
scons: Configure: no


jira

中提交

你从哪里得到 --cc=egcc --cxx=eg++ 设置编译器的?这意味着 Mongo 构建脚本已设置为接受这两个参数,但快速浏览(只是 SConsctruct)我看不到它。也许试试 CC=egcc?