请记住,在从源代码构建方面我是初学者(尝试了几次,几乎总是失败)。
我正在尝试为运行 Ubuntu 19 的 Raspberry Pi 3b 构建 MySQL 连接器/C++ 8。我按照官方说明安装了所有先决条件(不是 100% 确定是否codecvt_utf8
存在)。
我正在构建没有 JDBC 和 BOOST。我已经从源代码构建了 OpenSSL 1.1.1。
我正在运行的命令(我--target install
直接添加了 - 不确定这是否是一个问题):
cmake .
cmake --build . --target install --config Release
由于以下原因,它失败了 AFAIK:
CMakeFiles/CMakeTmp/CheckIncludeFile.c:1:10:致命错误:sys/endian.h:没有这样的文件或目录
CMakeFiles/CMakeTmp/CheckIncludeFile.c:1:10:致命错误:sys/byteorder.h:没有这样的文件或目录
我查过了/usr/include
,没有目录sys
。endian.h
直接在顶层,根本byteorder.h
不存在。
为什么有些文件不见了?
如前所述,该sys
目录位于 Ubuntu 上的不同位置。所以我运行了这个:
ln -s /usr/include/aarch64-linux-gnu/sys /usr/include/sys
但是丢失的文件实际上也不在该目录中。
跑步
find /usr/include -type f -name endian.h
find /usr/include -type f -name byteorder.h
显示,文件实际上在/usr/include/aarch64-linux-gnu/bits/endian.h
and中/usr/include/aarch64-linux-gnu/asm/byteorder.h
,我应该链接那些吗?似乎是个坏主意。
完整输出(使用缓存进度):
[ 2%] Built target uuid_gen
[ 4%] Building protobuf
[ 27%] Built target protobuf-lite
[ 28%] Building CXX object CMakeFiles/protobuf.dir/protobuf-3.6.1/src/google/protobuf/descriptor.cc.o
c++: fatal error: Killed signal terminated program cc1plus
compilation terminated.
make[5]: *** [CMakeFiles/protobuf.dir/build.make:115: CMakeFiles/protobuf.dir/protobuf-3.6.1/src/google/protobuf/descriptor.cc.o] Error 1
make[4]: *** [CMakeFiles/Makefile2:73: CMakeFiles/protobuf.dir/all] Error 2
make[3]: *** [Makefile:84: all] Error 2
make[2]: *** [cdk/CMakeFiles/build_protobuf.dir/build.make:58: cdk/protobuf/build.stamp] Error 2
make[1]: *** [CMakeFiles/Makefile2:297: cdk/CMakeFiles/build_protobuf.dir/all] Error 2
make: *** [Makefile:130: all] Error 2
完整的错误日志:
Performing C++ SOURCE FILE Test HAVE_IS_SAME failed with the following output:
Change Dir: /home/ubuntu/mysql-connector-c++-8.0.18-src/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make" "cmTC_dadf7/fast"
/usr/bin/make -f CMakeFiles/cmTC_dadf7.dir/build.make CMakeFiles/cmTC_dadf7.dir/build
make[1]: Entering directory '/home/ubuntu/mysql-connector-c++-8.0.18-src/CMakeFiles/CMakeTmp'
Building CXX object CMakeFiles/cmTC_dadf7.dir/src.cxx.o
/usr/bin/c++ -DHAVE_IS_SAME -std=c++11 -o CMakeFiles/cmTC_dadf7.dir/src.cxx.o -c /home/ubuntu/mysql-connector-c++-8.0.18-src/CMakeFiles/CMakeTmp/src.cxx
/home/ubuntu/mysql-connector-c++-8.0.18-src/CMakeFiles/CMakeTmp/src.cxx:1:1: error: ‘::main’ must return ‘int’
1 | void main() { return is_same<bool,char>::value; }
| ^~~~
/home/ubuntu/mysql-connector-c++-8.0.18-src/CMakeFiles/CMakeTmp/src.cxx: In function ‘int main()’:
/home/ubuntu/mysql-connector-c++-8.0.18-src/CMakeFiles/CMakeTmp/src.cxx:1:22: error: ‘is_same’ was not declared in this scope
1 | void main() { return is_same<bool,char>::value; }
| ^~~~~~~
/home/ubuntu/mysql-connector-c++-8.0.18-src/CMakeFiles/CMakeTmp/src.cxx:1:30: error: expected primary-expression before ‘bool’
1 | void main() { return is_same<bool,char>::value; }
| ^~~~
/home/ubuntu/mysql-connector-c++-8.0.18-src/CMakeFiles/CMakeTmp/src.cxx:1:30: error: expected ‘;’ before ‘bool’
1 | void main() { return is_same<bool,char>::value; }
| ^~~~
| ;
/home/ubuntu/mysql-connector-c++-8.0.18-src/CMakeFiles/CMakeTmp/src.cxx:1:34: error: expected unqualified-id before ‘,’ token
1 | void main() { return is_same<bool,char>::value; }
| ^
/home/ubuntu/mysql-connector-c++-8.0.18-src/CMakeFiles/CMakeTmp/src.cxx:1:35: error: expected unqualified-id before ‘char’
1 | void main() { return is_same<bool,char>::value; }
| ^~~~
make[1]: *** [CMakeFiles/cmTC_dadf7.dir/build.make:66: CMakeFiles/cmTC_dadf7.dir/src.cxx.o] Error 1
make[1]: Leaving directory '/home/ubuntu/mysql-connector-c++-8.0.18-src/CMakeFiles/CMakeTmp'
make: *** [Makefile:121: cmTC_dadf7/fast] Error 2
Source file was:
void main() { return is_same<bool,char>::value; }
Determining if the include file sys/endian.h exists failed with the following output:
Change Dir: /home/ubuntu/mysql-connector-c++-8.0.18-src/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make" "cmTC_a570b/fast"
/usr/bin/make -f CMakeFiles/cmTC_a570b.dir/build.make CMakeFiles/cmTC_a570b.dir/build
make[1]: Entering directory '/home/ubuntu/mysql-connector-c++-8.0.18-src/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_a570b.dir/CheckIncludeFile.c.o
/usr/bin/cc -o CMakeFiles/cmTC_a570b.dir/CheckIncludeFile.c.o -c /home/ubuntu/mysql-connector-c++-8.0.18-src/CMakeFiles/CMakeTmp/CheckIncludeFile.c
/home/ubuntu/mysql-connector-c++-8.0.18-src/CMakeFiles/CMakeTmp/CheckIncludeFile.c:1:10: fatal error: sys/endian.h: No such file or directory
1 | #include <sys/endian.h>
| ^~~~~~~~~~~~~~
compilation terminated.
make[1]: *** [CMakeFiles/cmTC_a570b.dir/build.make:66: CMakeFiles/cmTC_a570b.dir/CheckIncludeFile.c.o] Error 1
make[1]: Leaving directory '/home/ubuntu/mysql-connector-c++-8.0.18-src/CMakeFiles/CMakeTmp'
make: *** [Makefile:121: cmTC_a570b/fast] Error 2
Determining if the include file sys/byteorder.h exists failed with the following output:
Change Dir: /home/ubuntu/mysql-connector-c++-8.0.18-src/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make" "cmTC_e560b/fast"
/usr/bin/make -f CMakeFiles/cmTC_e560b.dir/build.make CMakeFiles/cmTC_e560b.dir/build
make[1]: Entering directory '/home/ubuntu/mysql-connector-c++-8.0.18-src/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_e560b.dir/CheckIncludeFile.c.o
/usr/bin/cc -o CMakeFiles/cmTC_e560b.dir/CheckIncludeFile.c.o -c /home/ubuntu/mysql-connector-c++-8.0.18-src/CMakeFiles/CMakeTmp/CheckIncludeFile.c
/home/ubuntu/mysql-connector-c++-8.0.18-src/CMakeFiles/CMakeTmp/CheckIncludeFile.c:1:10: fatal error: sys/byteorder.h: No such file or directory
1 | #include <sys/byteorder.h>
| ^~~~~~~~~~~~~~~~~
compilation terminated.
make[1]: *** [CMakeFiles/cmTC_e560b.dir/build.make:66: CMakeFiles/cmTC_e560b.dir/CheckIncludeFile.c.o] Error 1
make[1]: Leaving directory '/home/ubuntu/mysql-connector-c++-8.0.18-src/CMakeFiles/CMakeTmp'
make: *** [Makefile:121: cmTC_e560b/fast] Error 2
cmake 3.13.4
g++ 9.2.1
openssl 1.1.1d