flomesh-io / pipy

Pipy is a programmable proxy for the cloud, edge and IoT.
https://flomesh.io/pipy
Other
775 stars 73 forks source link

run `./build.sh` get `make: *** [Makefile:136:all] 错误 2` #136

Closed luojiyin1987 closed 1 year ago

luojiyin1987 commented 1 year ago

Bug Report

Make sure to review these points before submitting issues - thank you!

node v16.18.1

g++ --version g++ (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0 Copyright (C) 2021 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.

clang --version Ubuntu clang version 14.0.0-1ubuntu1 Target: x86_64-pc-linux-gnu Thread model: posix InstalledDir: /usr/bin

cmake --version cmake version 3.22.1

CMake suite maintained and supported by Kitware (kitware.com/cmake).

openssl version OpenSSL 1.1.1q 5 Jul 2022

lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 22.04.1 LTS Release: 22.04 Codename: jammy

cat /proc/version Linux version 5.15.0-56-generic (buildd@lcy02-amd64-004) (gcc (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0, GNU ld (GNU Binutils for Ubuntu) 2.38) #62-Ubuntu SMP Tue Nov 22 19:54:14 UTC 2022

err info

-- The C compiler identification is Clang 14.0.0
-- The CXX compiler identification is Clang 14.0.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/clang - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/clang++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Deprecation Warning at deps/yajl-2.1.0/CMakeLists.txt:15 (CMAKE_MINIMUM_REQUIRED):
  Compatibility with CMake < 2.8.12 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.

running /usr/bin/cmake -E copy_if_different /home/luo/devops/pipy/deps/yajl-2.1.0/src/api/yajl_parse.h /home/luo/devops/pipy/build/deps/yajl-2.1.0/src/../yajl-2.1.0/include/yajl  2>&1
running /usr/bin/cmake -E copy_if_different /home/luo/devops/pipy/deps/yajl-2.1.0/src/api/yajl_gen.h /home/luo/devops/pipy/build/deps/yajl-2.1.0/src/../yajl-2.1.0/include/yajl  2>&1
running /usr/bin/cmake -E copy_if_different /home/luo/devops/pipy/deps/yajl-2.1.0/src/api/yajl_common.h /home/luo/devops/pipy/build/deps/yajl-2.1.0/src/../yajl-2.1.0/include/yajl  2>&1
running /usr/bin/cmake -E copy_if_different /home/luo/devops/pipy/deps/yajl-2.1.0/src/api/yajl_tree.h /home/luo/devops/pipy/build/deps/yajl-2.1.0/src/../yajl-2.1.0/include/yajl  2>&1
CMake Warning (dev) at deps/yajl-2.1.0/reformatter/CMakeLists.txt:38 (GET_TARGET_PROPERTY):
  Policy CMP0026 is not set: Disallow use of the LOCATION target property.
  Run "cmake --help-policy CMP0026" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.

  The LOCATION property should not be read from target "json_reformat".  Use
  the target name directly with add_custom_command, or use the generator
  expression $<TARGET_FILE>, as appropriate.

This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at deps/yajl-2.1.0/verify/CMakeLists.txt:32 (GET_TARGET_PROPERTY):
  Policy CMP0026 is not set: Disallow use of the LOCATION target property.
  Run "cmake --help-policy CMP0026" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.

  The LOCATION property should not be read from target "json_verify".  Use
  the target name directly with add_custom_command, or use the generator
  expression $<TARGET_FILE>, as appropriate.

This warning is for project developers.  Use -Wno-dev to suppress it.

!! doxygen not found, not generating documentation
CMake Deprecation Warning at deps/libexpat-R_2_2_6/expat/CMakeLists.txt:6 (cmake_minimum_required):
  Compatibility with CMake < 2.8.12 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.

-- Looking for dlfcn.h
-- Looking for dlfcn.h - found
-- Looking for fcntl.h
-- Looking for fcntl.h - found
-- Looking for inttypes.h
-- Looking for inttypes.h - found
-- Looking for memory.h
-- Looking for memory.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stdlib.h
-- Looking for stdlib.h - found
-- Looking for strings.h
-- Looking for strings.h - found
-- Looking for string.h
-- Looking for string.h - found
-- Looking for sys/stat.h
-- Looking for sys/stat.h - found
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for unistd.h
-- Looking for unistd.h - found
-- Looking for getpagesize
-- Looking for getpagesize - found
-- Looking for bcopy
-- Looking for bcopy - found
-- Looking for memmove
-- Looking for memmove - found
-- Looking for mmap
-- Looking for mmap - found
-- Looking for getrandom
-- Looking for getrandom - found
-- Looking for arc4random_buf
-- Looking for arc4random_buf - not found
-- Looking for arc4random
-- Looking for arc4random - not found
-- Looking for 4 include files stdlib.h, ..., float.h
-- Looking for 4 include files stdlib.h, ..., float.h - found
-- Looking for off_t
-- Looking for off_t - not found
-- Looking for size_t
-- Looking for size_t - not found
-- Performing Test HAVE_SYSCALL_GETRANDOM
-- Performing Test HAVE_SYSCALL_GETRANDOM - Success
-- Performing Test FLAG_NO_STRICT_ALIASING
-- Performing Test FLAG_NO_STRICT_ALIASING - Success
-- Looking for crc32c_value in crc32c
-- Looking for crc32c_value in crc32c - not found
-- Looking for snappy_compress in snappy
-- Looking for snappy_compress in snappy - not found
-- Looking for malloc in tcmalloc
-- Looking for malloc in tcmalloc - not found
-- Looking for fdatasync
-- Looking for fdatasync - found
-- Looking for F_FULLFSYNC
-- Looking for F_FULLFSYNC - not found
-- Looking for O_CLOEXEC
-- Looking for O_CLOEXEC - found
-- Performing Test HAVE_CLANG_THREAD_SAFETY
-- Performing Test HAVE_CLANG_THREAD_SAFETY - Success
-- Performing Test LEVELDB_HAVE_NO_MISSING_FIELD_INITIALIZERS
-- Performing Test LEVELDB_HAVE_NO_MISSING_FIELD_INITIALIZERS - Success
-- Performing Test HAVE_CXX17_HAS_INCLUDE
-- Performing Test HAVE_CXX17_HAS_INCLUDE - Failed
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
Enabling LTO
CMake Deprecation Warning at deps/zlib-1.2.11/CMakeLists.txt:1 (cmake_minimum_required):
  Compatibility with CMake < 2.8.12 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.

-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of off64_t
-- Check size of off64_t - done
-- Looking for fseeko
-- Looking for fseeko - found
-- Looking for unistd.h
-- Looking for unistd.h - found
CMake Deprecation Warning at deps/brotli-1.0.9/CMakeLists.txt:5 (cmake_minimum_required):
  Compatibility with CMake < 2.8.12 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.

-- Build type is 'Release'
-- Performing Test BROTLI_EMSCRIPTEN
-- Performing Test BROTLI_EMSCRIPTEN - Failed
-- Compiler is not EMSCRIPTEN
-- Looking for log2
-- Looking for log2 - not found
-- Looking for log2
-- Looking for log2 - found
-- Configuring done
CMake Warning (dev) at deps/zlib-1.2.11/CMakeLists.txt:189 (add_library):
  Policy CMP0069 is not set: INTERPROCEDURAL_OPTIMIZATION is enforced when
  enabled.  Run "cmake --help-policy CMP0069" for policy details.  Use the
  cmake_policy command to set the policy and suppress this warning.

  INTERPROCEDURAL_OPTIMIZATION property will be ignored for target
  'zlibstatic'.
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at deps/zlib-1.2.11/CMakeLists.txt:188 (add_library):
  Policy CMP0069 is not set: INTERPROCEDURAL_OPTIMIZATION is enforced when
  enabled.  Run "cmake --help-policy CMP0069" for policy details.  Use the
  cmake_policy command to set the policy and suppress this warning.

  INTERPROCEDURAL_OPTIMIZATION property will be ignored for target 'zlib'.
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at deps/brotli-1.0.9/CMakeLists.txt:173 (add_library):
  Policy CMP0069 is not set: INTERPROCEDURAL_OPTIMIZATION is enforced when
  enabled.  Run "cmake --help-policy CMP0069" for policy details.  Use the
  cmake_policy command to set the policy and suppress this warning.

  INTERPROCEDURAL_OPTIMIZATION property will be ignored for target
  'brotlicommon-static'.
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at deps/brotli-1.0.9/CMakeLists.txt:174 (add_library):
  Policy CMP0069 is not set: INTERPROCEDURAL_OPTIMIZATION is enforced when
  enabled.  Run "cmake --help-policy CMP0069" for policy details.  Use the
  cmake_policy command to set the policy and suppress this warning.

  INTERPROCEDURAL_OPTIMIZATION property will be ignored for target
  'brotlidec-static'.
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at deps/brotli-1.0.9/CMakeLists.txt:167 (add_library):
  Policy CMP0069 is not set: INTERPROCEDURAL_OPTIMIZATION is enforced when
  enabled.  Run "cmake --help-policy CMP0069" for policy details.  Use the
  cmake_policy command to set the policy and suppress this warning.

  INTERPROCEDURAL_OPTIMIZATION property will be ignored for target
  'brotlicommon'.
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at deps/brotli-1.0.9/CMakeLists.txt:168 (add_library):
  Policy CMP0069 is not set: INTERPROCEDURAL_OPTIMIZATION is enforced when
  enabled.  Run "cmake --help-policy CMP0069" for policy details.  Use the
  cmake_policy command to set the policy and suppress this warning.

  INTERPROCEDURAL_OPTIMIZATION property will be ignored for target
  'brotlidec'.
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at deps/brotli-1.0.9/CMakeLists.txt:169 (add_library):
  Policy CMP0069 is not set: INTERPROCEDURAL_OPTIMIZATION is enforced when
  enabled.  Run "cmake --help-policy CMP0069" for policy details.  Use the
  cmake_policy command to set the policy and suppress this warning.

  INTERPROCEDURAL_OPTIMIZATION property will be ignored for target
  'brotlienc'.
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at deps/brotli-1.0.9/CMakeLists.txt:175 (add_library):
  Policy CMP0069 is not set: INTERPROCEDURAL_OPTIMIZATION is enforced when
  enabled.  Run "cmake --help-policy CMP0069" for policy details.  Use the
  cmake_policy command to set the policy and suppress this warning.

  INTERPROCEDURAL_OPTIMIZATION property will be ignored for target
  'brotlienc-static'.
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at deps/brotli-1.0.9/CMakeLists.txt:218 (add_executable):
  Policy CMP0069 is not set: INTERPROCEDURAL_OPTIMIZATION is enforced when
  enabled.  Run "cmake --help-policy CMP0069" for policy details.  Use the
  cmake_policy command to set the policy and suppress this warning.

  INTERPROCEDURAL_OPTIMIZATION property will be ignored for target 'brotli'.
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Generating done
-- Build files have been written to: /home/luo/devops/pipy/build
[  0%] Generating deps/version.h
[  0%] Building OpenSSL
[  0%] Building C object deps/brotli-1.0.9/CMakeFiles/brotlicommon-static.dir/c/common/constants.c.o
[  1%] Building C object deps/yajl-2.1.0/src/CMakeFiles/yajl_s.dir/yajl.c.o
[  1%] Built target GenVer
Operating system: x86_64-whatever-linux2
[  1%] Building C object deps/libexpat-R_2_2_6/expat/CMakeFiles/expat.dir/lib/loadlibrary.c.o
[  2%] Building C object deps/brotli-1.0.9/CMakeFiles/brotlicommon-static.dir/c/common/context.c.o
[  3%] Building C object deps/libexpat-R_2_2_6/expat/CMakeFiles/expat.dir/lib/xmlparse.c.o
[  3%] Building C object deps/yajl-2.1.0/src/CMakeFiles/yajl_s.dir/yajl_lex.c.o
[  3%] Building C object deps/brotli-1.0.9/CMakeFiles/brotlicommon-static.dir/c/common/dictionary.c.o
Configuring OpenSSL version 1.1.1q (0x1010111fL) for linux-x86_64-clang
Using os-specific seed configuration
[  3%] Building C object deps/yajl-2.1.0/src/CMakeFiles/yajl_s.dir/yajl_parser.c.o
[  3%] Building C object deps/brotli-1.0.9/CMakeFiles/brotlicommon-static.dir/c/common/platform.c.o
[  4%] Building C object deps/brotli-1.0.9/CMakeFiles/brotlicommon-static.dir/c/common/transform.c.o
[  5%] Building C object deps/yajl-2.1.0/src/CMakeFiles/yajl_s.dir/yajl_buf.c.o
[  5%] Building C object deps/yajl-2.1.0/src/CMakeFiles/yajl_s.dir/yajl_encode.c.o
[  5%] Linking C static library libbrotlicommon-static.a
[  5%] Built target brotlicommon-static
[  5%] Building C object deps/yajl-2.1.0/src/CMakeFiles/yajl_s.dir/yajl_gen.c.o
[  5%] Building CXX object deps/leveldb-1.23/CMakeFiles/leveldb.dir/db/builder.cc.o
In file included from /home/luo/devops/pipy/deps/leveldb-1.23/db/builder.cc:5:
In file included from /home/luo/devops/pipy/deps/leveldb-1.23/./db/builder.h:8:
/home/luo/devops/pipy/deps/leveldb-1.23/include/leveldb/status.h:16:10: fatal error: 'algorithm' file not found
#include <algorithm>
         ^~~~~~~~~~~
1 error generated.
make[2]: *** [deps/leveldb-1.23/CMakeFiles/leveldb.dir/build.make:76:deps/leveldb-1.23/CMakeFiles/leveldb.dir/db/builder.cc.o] 错误 1
make[1]: *** [CMakeFiles/Makefile2:730:deps/leveldb-1.23/CMakeFiles/leveldb.dir/all] 错误 2
make[1]: *** 正在等待未完成的任务....
[  6%] Building C object deps/yajl-2.1.0/src/CMakeFiles/yajl_s.dir/yajl_alloc.c.o
[  6%] Building C object deps/yajl-2.1.0/src/CMakeFiles/yajl_s.dir/yajl_tree.c.o
[  6%] Building C object deps/yajl-2.1.0/src/CMakeFiles/yajl_s.dir/yajl_version.c.o
[  6%] Building C object deps/libexpat-R_2_2_6/expat/CMakeFiles/expat.dir/lib/xmlrole.c.o
[  7%] Linking C static library ../yajl-2.1.0/lib/libyajl_s.a
[  7%] Built target yajl_s
[  8%] Building C object deps/libexpat-R_2_2_6/expat/CMakeFiles/expat.dir/lib/xmltok.c.o
[  8%] Building C object deps/libexpat-R_2_2_6/expat/CMakeFiles/expat.dir/lib/xmltok_impl.c.o
[  8%] Building C object deps/libexpat-R_2_2_6/expat/CMakeFiles/expat.dir/lib/xmltok_ns.c.o
Creating configdata.pm
Creating Makefile

**********************************************************************
***                                                                ***
***   OpenSSL has been successfully configured                     ***
***                                                                ***
***   If you encounter a problem while building, please open an    ***
***   issue on GitHub <https://github.com/openssl/openssl/issues>  ***
***   and include the output from the following command:           ***
***                                                                ***
***       perl configdata.pm --dump                                ***
***                                                                ***
***   (If you are new to OpenSSL, you might want to consult the    ***
***   'Troubleshooting' section in the INSTALL file first)         ***
***                                                                ***
**********************************************************************
make[3]: 警告: jobserver 不可用: 正使用 -j1。添加 “+” 到父 make 的规则。
[  9%] Linking C static library libexpat.a
[  9%] Built target expat
ar: creating apps/libapps.a

ar: creating libcrypto.a
ar: creating libssl.a
[  9%] Built target OpenSSL
make: *** [Makefile:136:all] 错误 2
keveinliu commented 1 year ago

Seems you missed libstdc++ packages. please install libstdc++-11-dev and try it again.

pajama-coder commented 1 year ago

@luojiyin1987 The error message shows that you are missing the header file 'algorithm', which is part of the C++ standard library. It comes with the package libstdc++. You can do 'apt install build-essential' to have that installed.

luojiyin1987 commented 1 year ago

@keveinliu @pajama-coder , I try apt install libstdc++-11-dev and apt install build-essential is not work.

finish , I try apt install libstdc++-12-dev, it work , not error.

 ./pipy -v
Version     : nightly-202212202038
Commit      : 7d2985ee5eca5f9836b512d3c17fd27fdae85490
Commit Date : Fri, 9 Dec 2022 15:17:49 +0800
Host        : Linux-5.15.0-56-generic x86_64
OpenSSL     : OpenSSL 1.1.1q  5 Jul 2022
Builtin GUI : No
Samples     : No
luojiyin1987 commented 1 year ago

Are you use C++ 12 to development ?

luojiyin1987 commented 1 year ago

I get error info /usr/bin/ld: cannot find -lstdc++

stackoverflow.com url

I run sudo ln -s /usr/lib/x86_64-linux-gnu/libstdc++.so.6 /usr/lib/libstdc++.so to solve error. Is It call [Makefile:136:all] 错误 2 error ?

keveinliu commented 1 year ago

I run sudo ln -s /usr/lib/x86_64-linux-gnu/libstdc++.so.6 /usr/lib/libstdc++.so to solve error. Is It call [Makefile:136:all] 错误 2 error ?

No, basically it was caused by lack of libstdc++-11-dev(or libstdc++-12-dev).

luojiyin1987 commented 1 year ago

@keveinliu I don't why apt install libstdc++-11-dev is not work . So I try apt install libstdc++-12-dev , It is work I will create a new VM to test.

keveinliu commented 1 year ago

@keveinliu I don't why apt install libstdc++-11-dev is not work . So I try apt install libstdc++-12-dev , It is work I will create a new VM to test.

libstdc++-11-dev provides files in /usr/include/x86_64-linux-gnu/c++/11 and /usr/include/c++/11, so does libstdc++-12-dev. It depends on what you've installed. So you just follow @pajama-coder says, to install build-essential.

luojiyin1987 commented 1 year ago
(base) [luo@node1 include]$ pwd
/usr/include
(base) [luo@node1 include]$ find . -type f -name "algorithm"
./c++/12/experimental/algorithm
./c++/12/ext/algorithm
./c++/12/parallel/algorithm
./c++/12/algorithm
./c++/11/experimental/algorithm
./c++/11/ext/algorithm
./c++/11/parallel/algorithm
./c++/11/algorithm
./c++/9/experimental/algorithm
./c++/9/ext/algorithm
./c++/9/parallel/algorithm
./c++/9/algorithm

yes, you are right, may be I install too much Development Languages run time, like Rust golang java Python... so I will creat VM to test.

luojiyin1987 commented 1 year ago

I create a VM, install ubuntu-22.04.1-server-amd64, upgrade to latest. run sudo apt install clang and sudo apt install cmake run .\build.sh is ok .

keveinliu commented 1 year ago

I create a VM, install ubuntu-22.04.1-server-amd64, upgrade to latest. run sudo apt install clang and sudo apt install cmake run .\build.sh is ok .

Great to hear!