Make error
Closed this issue · 9 comments
AlexandrMoruk commented
When I compiling the project I get the following error:
[ 95%] Building CXX object CMakeFiles/alm.dir/app/alm.cpp.o
[100%] Linking CXX executable alm
/usr/bin/ld: cannot find -ltcmalloc
collect2: error: ld returned 1 exit status
CMakeFiles/alm.dir/build.make:87: recipe for target 'alm' failed
make[2]: *** [alm] Error 1
CMakeFiles/Makefile2:104: recipe for target 'CMakeFiles/alm.dir/all' failed
make[1]: *** [CMakeFiles/alm.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
anyks commented
sudo apt-get install google-perftools
… 4 авг. 2020 г., в 00:25, AlexandrMoruk ***@***.***> написал(а):
When I compiling the project I get the following error:
[ 95%] Building CXX object CMakeFiles/alm.dir/app/alm.cpp.o
[100%] Linking CXX executable alm
/usr/bin/ld: cannot find -ltcmalloc
collect2: error: ld returned 1 exit status
CMakeFiles/alm.dir/build.make:87: recipe for target 'alm' failed
make[2]: *** [alm] Error 1
CMakeFiles/Makefile2:104: recipe for target 'CMakeFiles/alm.dir/all' failed
make[1]: *** [CMakeFiles/alm.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub <#1>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AC3USOTQEAU3FHWVAJBFN23R64TN5ANCNFSM4PTXRUOQ>.
AlexandrMoruk commented
I tried, but it wasn't working
anyks commented
Please replace CMakeLists.txt
4 авг. 2020 г., в 00:35, AlexandrMoruk ***@***.***> написал(а):
I tried, but it wasn't working
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub <#1 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AC3USOTUQK5WAZUPWS725QDR64UTPANCNFSM4PTXRUOQ>.
# Example:
# cmake \
# -DOPENSSL_ROOT_DIR=/usr/local/Cellar/openssl@1.1/1.1.1g \
# -DOPENSSL_LIBRARIES=/usr/local/Cellar/openssl@1.1/1.1.1g/include/lib \
# -DPYTHON_INCLUDE_DIR='/System/Volumes/Data/usr/local/Cellar/python@3.8/3.8.3_2/Frameworks/Python.framework/Versions/3.8/include/python3.8' \
# -DPYTHON_LIBRARY='/System/Volumes/Data/usr/local/Cellar/python@3.8/3.8.3_2/Frameworks/Python.framework/Versions/3.8/lib/libpython3.8.dylib' \
# ..
# Проверка версии CMake.
cmake_minimum_required(VERSION 2.8)
# Название проекта
project(ANYKS LANGUAGES CXX)
# Устанавливаем название вендора
set(PROJECT_VENDOR_LONG "ANYKS")
set(ORG_WEBSITE "https://anyks.com")
set(APP_NAME "Smart Language Model")
# Устанавливаем адрес установки
if("${CMAKE_INSTALL_PREFIX}" STREQUAL "/usr/local" OR "${CMAKE_INSTALL_PREFIX}" STREQUAL "/usr/local/")
set(INSTALL_TO_USR TRUE)
else()
set(INSTALL_TO_USR FALSE)
endif()
# Устанавливаем флаг использования потоков
set(THREADS_PREFER_PTHREAD_FLAG ON)
# Ищем библиотеку Threads
find_package(Threads REQUIRED)
# Ищем библиотеку ZLib
find_package(ZLIB REQUIRED)
# Выводим сообщение
message("Zlib include dir: ${ZLIB_INCLUDE_DIRS}")
message("Zlib libraries: ${ZLIB_LIBRARIES}")
# Подключаем заголовочные файлы
include_directories(${ZLIB_INCLUDE_DIRS})
# Добавляем библиотеки в список
list(APPEND LIB_LIST ${ZLIB_LIBRARIES})
# Ищем библиотеку Python
find_package(PythonLibs 3.7 REQUIRED)
# Выводим сообщение
message("Python include dir: ${PYTHON_INCLUDE_DIRS}")
message("Python libraries: ${PYTHON_LIBRARIES}")
# Подключаем заголовочные файлы
include_directories(${PYTHON_INCLUDE_DIRS})
# Добавляем библиотеки в список
list(APPEND LIB_LIST ${PYTHON_LIBRARIES})
# Ищем зависимости OpenSSL
# find_library(SSL_LIBRARY ssl)
# find_library(CRYPTO_LIBRARY crypto)
find_package(OpenSSL REQUIRED)
# Выводим сообщение
message("OpenSSL libraries: ${OPENSSL_LIBRARIES}")
message("OpenSSL include dir: ${OPENSSL_INCLUDE_DIR}")
# Формируем время для копирайта
string(TIMESTAMP CURRENT_YEAR "%Y")
string(TIMESTAMP CURRENT_TIME "%d.%m.%Y %H:%M:%S")
# Формируем копирайт
set(PROJECT_COPYRIGHT "Copyright (c) ${CURRENT_YEAR} ${PROJECT_VENDOR_LONG}")
# Выводим сообщение о начале работы
message(STATUS "Creating \"${APP_NAME}\" application")
# Set build type
# if(NOT CMAKE_BUILD_TYPE)
# set(CMAKE_BUILD_TYPE Debug)
# endif()
message(STATUS "Build Type: ${CMAKE_BUILD_TYPE}")
# Подключаем зависимости
set_target_properties(${TARGET} PROPERTIES COMPILE_FLAGS "-stdlib=libc++")
# Устанавливаем опции компилятора
message(STATUS "Using C++ compiler: ${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION}")
message(STATUS "Using C compiler: ${CMAKE_C_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION}")
# Способ первый: затребовать от компилятора фичу cxx_std_17
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED on)
# Подстраиваемся под компилятор
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -fPIC")
set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG")
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -Wall -fPIC -pthread")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CC_OPT_FLAGS} ${CXX_OPT_FLAGS}")
# Если режим отладки включён
if(CMAKE_BUILD_TYPE MATCHES Debug)
message(STATUS "C++ Flags: ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_DEBUG}")
message(STATUS "C Flags: ${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_DEBUG}")
else()
message(STATUS "C++ Flags: ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE}")
message(STATUS "C Flags: ${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_RELEASE}")
endif()
# Устанавливаем путь установки приложения
set(CMAKE_PREFIX_PATH $ENV{ALM_PREFIX_PATH} ${CMAKE_PREFIX_PATH})
# Если установка требуется
if(INSTALL_TO_USR)
set(CONFIG_INSTALL_DEST "/${CONFIG_INSTALL_DEST}")
endif()
# Устанавливаем адрес каталога установки
set(CONFIG_INSTALL_DEST "etc/${PROJECT_NAME}")
# Подключаем заголовочные файлы
include_directories(${OPENSSL_INCLUDE_DIR})
# Добавляем библиотеки в список
list(APPEND LIB_LIST ${OPENSSL_LIBRARIES})
# Устанавливаем каталог заголовков
include_directories(${PROJECT_BINARY_DIR}/../)
include_directories(${PROJECT_BINARY_DIR}/../include)
include_directories(${PROJECT_BINARY_DIR}/../contrib/include)
# Установка переменной со списком исходников для исполняемого файла
set(ALM_EXE ${PROJECT_BINARY_DIR}/../app/alm.cpp)
# Добавляем исходники
set(ENV_LIB ${PROJECT_BINARY_DIR}/../src/env.cpp)
set(IDW_LIB ${PROJECT_BINARY_DIR}/../src/idw.cpp)
set(NWT_LIB ${PROJECT_BINARY_DIR}/../src/nwt.cpp)
set(ALM_LIB ${PROJECT_BINARY_DIR}/../src/alm.cpp)
set(ALM1_LIB ${PROJECT_BINARY_DIR}/../src/alm1.cpp)
set(ALM2_LIB ${PROJECT_BINARY_DIR}/../src/alm2.cpp)
set(ARPA_LIB ${PROJECT_BINARY_DIR}/../src/arpa.cpp)
set(ABLM_LIB ${PROJECT_BINARY_DIR}/../src/ablm.cpp)
set(PYTHON_LIB ${PROJECT_BINARY_DIR}/../src/python.cpp)
set(TOOLKIT_LIB ${PROJECT_BINARY_DIR}/../src/toolkit.cpp)
set(PROGRESS_LIB ${PROJECT_BINARY_DIR}/../src/progress.cpp)
set(ALPHABET_LIB ${PROJECT_BINARY_DIR}/../src/alphabet.cpp)
set(COLLECTOR_LIB ${PROJECT_BINARY_DIR}/../src/collector.cpp)
set(TOKENIZER_LIB ${PROJECT_BINARY_DIR}/../src/tokenizer.cpp)
set(LEVENSHTEIN_LIB ${PROJECT_BINARY_DIR}/../src/levenshtein.cpp)
set(CITYHASH_LIB ${PROJECT_BINARY_DIR}/../contrib/src/cityhash/city.cc)
set(BIGINTEGER_LIB ${PROJECT_BINARY_DIR}/../contrib/src/bigint/BigInteger.cc)
set(BIGUNSIGNED_LIB ${PROJECT_BINARY_DIR}/../contrib/src/bigint/BigUnsigned.cc)
set(BIGINTEGERUTILS_LIB ${PROJECT_BINARY_DIR}/../contrib/src/bigint/BigIntegerUtils.cc)
set(BIGUNSIGNEDINBASE_LIB ${PROJECT_BINARY_DIR}/../contrib/src/bigint/BigUnsignedInABase.cc)
set(BIGINTEGERALGORITHMS_LIB ${PROJECT_BINARY_DIR}/../contrib/src/bigint/BigIntegerAlgorithms.cc)
# Определяем операционную систему
if(APPLE)
# Выводим сообщение
message("Select MacOS X")
# Добавляем библиотеку Gperftools
set(GPERFTOOLS_LIB /usr/local/lib/libtcmalloc.a)
elseif(UNIX)
# Если это Linux
if(CMAKE_SYSTEM_NAME STREQUAL Linux)
# Выводим сообщение
message("Select Linux")
# Добавляем библиотеку Gperftools
# set(GPERFTOOLS_LIB tcmalloc)
endif()
# Если это FreeBSD
if(CMAKE_SYSTEM_NAME STREQUAL FreeBSD)
# Выводим сообщение
message("Select FreeBSD")
# Добавляем библиотеку Gperftools
set(GPERFTOOLS_LIB /usr/local/lib/libtcmalloc.a)
endif()
endif()
# Создаем список модулей
list(APPEND LIB_LISTS ${IDW_LIB} ${NWT_LIB} ${ALPHABET_LIB} ${ENV_LIB} ${LEVENSHTEIN_LIB} ${CITYHASH_LIB} ${COLLECTOR_LIB} ${TOKENIZER_LIB} ${ALM_LIB} ${ALM1_LIB} ${ALM2_LIB} ${ARPA_LIB} ${PYTHON_LIB} ${ABLM_LIB} ${PROGRESS_LIB} ${TOOLKIT_LIB} ${BIGINTEGER_LIB} ${BIGUNSIGNED_LIB} ${BIGINTEGERUTILS_LIB} ${BIGUNSIGNEDINBASE_LIB} ${BIGINTEGERALGORITHMS_LIB})
# Создание динамической библиотеки с именем alm
add_library(lm STATIC ${LIB_LISTS})
# Создает исполняемый файл с именем alm
add_executable(alm ${ALM_EXE})
# Выполняем линковку приложения
target_link_libraries(alm lm Threads::Threads ${GPERFTOOLS_LIB} ${BIGINT_LIB} ${ZLIB_LIBRARIES} ${OPENSSL_LIBRARIES} ${PYTHON_LIBRARIES})
AlexandrMoruk commented
Ваше решение к сожалению не помогло, возможно проблема в том что cmake не совсем работал, не видел python-3.7, поэтому я сделал так:
https://stackoverflow.com/a/38121972
(python-3.7.7)ml ➜ build git:(master) cmake .. \
-DPYTHON_INCLUDE_DIR=$(python -c "from distutils.sysconfig import get_python_inc; print(get_python_inc())") \
-DPYTHON_LIBRARY=$(python -c "import distutils.sysconfig as sysconfig; print(sysconfig.get_config_var('LIBDIR'))")
-- The CXX compiler identification is GNU 5.5.0
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for C++ include pthread.h
-- Looking for C++ include pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Check if compiler accepts -pthread
-- Check if compiler accepts -pthread - yes
-- Found Threads: TRUE
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.8")
Zlib include dir: /usr/include
Zlib libraries: /usr/lib/x86_64-linux-gnu/libz.so
-- Found PythonLibs: /home/omorykon/.pyenv/versions/3.7.7/lib (found suitable version "3.7.7", minimum required is "3.7")
Python include dir: /home/omorykon/.pyenv/versions/3.7.7/include/python3.7m
Python libraries: /home/omorykon/.pyenv/versions/3.7.7/lib
-- Found OpenSSL: /usr/lib/x86_64-linux-gnu/libcrypto.so (found version "1.0.2g")
OpenSSL libraries: /usr/lib/x86_64-linux-gnu/libssl.so;/usr/lib/x86_64-linux-gnu/libcrypto.so
OpenSSL include dir: /usr/include
-- Creating "Smart Language Model" application
-- Build Type:
-- Using C++ compiler: GNU 5.5.0
-- Using C compiler: 5.5.0
-- C++ Flags: -std=c++17 -Wall -fPIC -pthread -O2 -DNDEBUG
-- C Flags: -Wall -fPIC
Select Linux
-- Configuring done
WARNING: Target "alm" requests linking to directory "/home/omorykon/.pyenv/versions/3.7.7/lib". Targets may link only to libraries. CMake is dropping the item.
-- Generating done
-- Build files have been written to: /home/omorykon/lm_dataset/alm/build
а когда я поправил CmakeList.txt то получил следующее
liblm.a(python.cpp.o): In function `anyks::Python::add(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned short)':
python.cpp:(.text+0x7b0): undefined reference to `PySys_GetObject'
python.cpp:(.text+0x7ce): undefined reference to `PyUnicode_FromString'
python.cpp:(.text+0x7ee): undefined reference to `PyList_Append'
python.cpp:(.text+0x84c): undefined reference to `PyUnicode_DecodeFSDefault'
python.cpp:(.text+0x862): undefined reference to `PyImport_Import'
python.cpp:(.text+0x8d6): undefined reference to `PyObject_GetAttrString'
python.cpp:(.text+0x8f3): undefined reference to `PyObject_GetAttrString'
python.cpp:(.text+0x919): undefined reference to `PyCallable_Check'
python.cpp:(.text+0x930): undefined reference to `PyTuple_New'
python.cpp:(.text+0x950): undefined reference to `PyObject_CallObject'
python.cpp:(.text+0xa1c): undefined reference to `PyCallable_Check'
python.cpp:(.text+0xb83): undefined reference to `PyErr_Occurred'
python.cpp:(.text+0xb92): undefined reference to `PyErr_Print'
python.cpp:(.text+0xbd9): undefined reference to `PyErr_Occurred'
python.cpp:(.text+0xbe8): undefined reference to `PyErr_Print'
python.cpp:(.text+0xc2c): undefined reference to `PyErr_Print'
liblm.a(python.cpp.o): In function `anyks::Python::run(unsigned long, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&) const':
python.cpp:(.text+0xe4e): undefined reference to `PyTuple_New'
python.cpp:(.text+0xec4): undefined reference to `PyUnicode_FromString'
python.cpp:(.text+0xeec): undefined reference to `PyTuple_SetItem'
python.cpp:(.text+0xf68): undefined reference to `PyList_New'
python.cpp:(.text+0xfb4): undefined reference to `PyUnicode_FromString'
python.cpp:(.text+0xfca): undefined reference to `PyList_SetItem'
python.cpp:(.text+0x1000): undefined reference to `PyTuple_SetItem'
python.cpp:(.text+0x1093): undefined reference to `PyTuple_New'
python.cpp:(.text+0x10a6): undefined reference to `PyCallable_Check'
python.cpp:(.text+0x10c9): undefined reference to `PyObject_CallObject'
python.cpp:(.text+0x114b): undefined reference to `PyUnicode_AsWideCharString'
python.cpp:(.text+0x1252): undefined reference to `PyErr_Print'
liblm.a(python.cpp.o): In function `anyks::Python::Python()':
python.cpp:(.text+0x12b4): undefined reference to `Py_IsInitialized'
python.cpp:(.text+0x12c2): undefined reference to `Py_Initialize'
liblm.a(python.cpp.o): In function `anyks::Python::Python(anyks::Tokenizer const*)':
python.cpp:(.text+0x12fe): undefined reference to `Py_IsInitialized'
python.cpp:(.text+0x130c): undefined reference to `Py_Initialize'
liblm.a(python.cpp.o): In function `anyks::Python::~Python()':
python.cpp:(.text+0x133f): undefined reference to `Py_IsInitialized'
python.cpp:(.text+0x134d): undefined reference to `Py_Finalize'
collect2: error: ld returned 1 exit status
CMakeFiles/alm.dir/build.make:87: recipe for target 'alm' failed
make[2]: *** [alm] Error 1
CMakeFiles/Makefile2:104: recipe for target 'CMakeFiles/alm.dir/all' failed
make[1]: *** [CMakeFiles/alm.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
anyks commented
Что-то не то с версией python, нужны исходники. С версией 3.7 должно работать, с 3.8 тоже. Если это ubuntu, то нужен пакет python3-dev
WARNING: Target "alm" requests linking to directory "/home/omorykon/.pyenv/versions/3.7.7/lib". Targets may link only to libraries. CMake is dropping the item.
Говорит о том, что ваши переменные были сброшены, python нужен системный.
… 4 авг. 2020 г., в 00:55, AlexandrMoruk ***@***.***> написал(а):
Ваше решение к сожалению не помогло, возможно проблема в том что cmake не совсем работал, не видел python-3.7, поэтому я сделал так:
https://stackoverflow.com/a/38121972 <https://stackoverflow.com/a/38121972>
(python-3.7.7)ml ➜ build git:(master) cmake .. \
-DPYTHON_INCLUDE_DIR=$(python -c "from distutils.sysconfig import get_python_inc; print(get_python_inc())") \
-DPYTHON_LIBRARY=$(python -c "import distutils.sysconfig as sysconfig; print(sysconfig.get_config_var('LIBDIR'))")
-- The CXX compiler identification is GNU 5.5.0
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for C++ include pthread.h
-- Looking for C++ include pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Check if compiler accepts -pthread
-- Check if compiler accepts -pthread - yes
-- Found Threads: TRUE
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.8")
Zlib include dir: /usr/include
Zlib libraries: /usr/lib/x86_64-linux-gnu/libz.so
-- Found PythonLibs: /home/omorykon/.pyenv/versions/3.7.7/lib (found suitable version "3.7.7", minimum required is "3.7")
Python include dir: /home/omorykon/.pyenv/versions/3.7.7/include/python3.7m
Python libraries: /home/omorykon/.pyenv/versions/3.7.7/lib
-- Found OpenSSL: /usr/lib/x86_64-linux-gnu/libcrypto.so (found version "1.0.2g")
OpenSSL libraries: /usr/lib/x86_64-linux-gnu/libssl.so;/usr/lib/x86_64-linux-gnu/libcrypto.so
OpenSSL include dir: /usr/include
-- Creating "Smart Language Model" application
-- Build Type:
-- Using C++ compiler: GNU 5.5.0
-- Using C compiler: 5.5.0
-- C++ Flags: -std=c++17 -Wall -fPIC -pthread -O2 -DNDEBUG
-- C Flags: -Wall -fPIC
Select Linux
-- Configuring done
WARNING: Target "alm" requests linking to directory "/home/omorykon/.pyenv/versions/3.7.7/lib". Targets may link only to libraries. CMake is dropping the item.
-- Generating done
-- Build files have been written to: /home/omorykon/lm_dataset/alm/build
а когда я поправил CmakeList.txt то получил следующее
liblm.a(python.cpp.o): In function `anyks::Python::add(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned short)':
python.cpp:(.text+0x7b0): undefined reference to `PySys_GetObject'
python.cpp:(.text+0x7ce): undefined reference to `PyUnicode_FromString'
python.cpp:(.text+0x7ee): undefined reference to `PyList_Append'
python.cpp:(.text+0x84c): undefined reference to `PyUnicode_DecodeFSDefault'
python.cpp:(.text+0x862): undefined reference to `PyImport_Import'
python.cpp:(.text+0x8d6): undefined reference to `PyObject_GetAttrString'
python.cpp:(.text+0x8f3): undefined reference to `PyObject_GetAttrString'
python.cpp:(.text+0x919): undefined reference to `PyCallable_Check'
python.cpp:(.text+0x930): undefined reference to `PyTuple_New'
python.cpp:(.text+0x950): undefined reference to `PyObject_CallObject'
python.cpp:(.text+0xa1c): undefined reference to `PyCallable_Check'
python.cpp:(.text+0xb83): undefined reference to `PyErr_Occurred'
python.cpp:(.text+0xb92): undefined reference to `PyErr_Print'
python.cpp:(.text+0xbd9): undefined reference to `PyErr_Occurred'
python.cpp:(.text+0xbe8): undefined reference to `PyErr_Print'
python.cpp:(.text+0xc2c): undefined reference to `PyErr_Print'
liblm.a(python.cpp.o): In function `anyks::Python::run(unsigned long, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&) const':
python.cpp:(.text+0xe4e): undefined reference to `PyTuple_New'
python.cpp:(.text+0xec4): undefined reference to `PyUnicode_FromString'
python.cpp:(.text+0xeec): undefined reference to `PyTuple_SetItem'
python.cpp:(.text+0xf68): undefined reference to `PyList_New'
python.cpp:(.text+0xfb4): undefined reference to `PyUnicode_FromString'
python.cpp:(.text+0xfca): undefined reference to `PyList_SetItem'
python.cpp:(.text+0x1000): undefined reference to `PyTuple_SetItem'
python.cpp:(.text+0x1093): undefined reference to `PyTuple_New'
python.cpp:(.text+0x10a6): undefined reference to `PyCallable_Check'
python.cpp:(.text+0x10c9): undefined reference to `PyObject_CallObject'
python.cpp:(.text+0x114b): undefined reference to `PyUnicode_AsWideCharString'
python.cpp:(.text+0x1252): undefined reference to `PyErr_Print'
liblm.a(python.cpp.o): In function `anyks::Python::Python()':
python.cpp:(.text+0x12b4): undefined reference to `Py_IsInitialized'
python.cpp:(.text+0x12c2): undefined reference to `Py_Initialize'
liblm.a(python.cpp.o): In function `anyks::Python::Python(anyks::Tokenizer const*)':
python.cpp:(.text+0x12fe): undefined reference to `Py_IsInitialized'
python.cpp:(.text+0x130c): undefined reference to `Py_Initialize'
liblm.a(python.cpp.o): In function `anyks::Python::~Python()':
python.cpp:(.text+0x133f): undefined reference to `Py_IsInitialized'
python.cpp:(.text+0x134d): undefined reference to `Py_Finalize'
collect2: error: ld returned 1 exit status
CMakeFiles/alm.dir/build.make:87: recipe for target 'alm' failed
make[2]: *** [alm] Error 1
CMakeFiles/Makefile2:104: recipe for target 'CMakeFiles/alm.dir/all' failed
make[1]: *** [CMakeFiles/alm.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub <#1 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AC3USOTNXHZFO54OFCJWDGLR64W3PANCNFSM4PTXRUOQ>.
AlexandrMoruk commented
Спасибо поставил 3.8.1, но получил ошибку:
[ 95%] Building CXX object CMakeFiles/alm.dir/app/alm.cpp.o
[100%] Linking CXX executable alm
/usr/bin/ld: /usr/local/lib/libpython3.8.a(dynload_shlib.o): undefined reference to symbol 'dlsym@@GLIBC_2.2.5'
//lib/x86_64-linux-gnu/libdl.so.2: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
CMakeFiles/alm.dir/build.make:88: recipe for target 'alm' failed
make[2]: *** [alm] Error 1
CMakeFiles/Makefile2:104: recipe for target 'CMakeFiles/alm.dir/all' failed
make[1]: *** [CMakeFiles/alm.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
может все же 3,7 будет лучше?
anyks commented
Нет, дело не в версии а в сборке, он подцепил статическую библиотеку libpython3.8.a и эта ошибка в этом. Нужна динамическая библиотека *.so. Возможно, есть смысл либо удалить, либо изменить название libpython3.8.a. Конечно, если динамическая библиотека есть в системе. Здесь ошибку линовки сам питон выдает а не CMake в данном случае.
… 4 авг. 2020 г., в 01:27, AlexandrMoruk ***@***.***> написал(а):
Спасибо поставил 3.8.1, но получил ошибку:
[ 95%] Building CXX object CMakeFiles/alm.dir/app/alm.cpp.o
[100%] Linking CXX executable alm
/usr/bin/ld: /usr/local/lib/libpython3.8.a(dynload_shlib.o): undefined reference to symbol 'dlsym@@GLIBC_2.2.5'
//lib/x86_64-linux-gnu/libdl.so.2: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
CMakeFiles/alm.dir/build.make:88: recipe for target 'alm' failed
make[2]: *** [alm] Error 1
CMakeFiles/Makefile2:104: recipe for target 'CMakeFiles/alm.dir/all' failed
make[1]: *** [CMakeFiles/alm.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
может все же 3,7 будет лучше?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub <#1 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AC3USOSV4YC6QRVVDAA4UXTR642WVANCNFSM4PTXRUOQ>.
AlexandrMoruk commented
Попробовал еще на одной машине где установлен системный python 3.7
build git:(master) ls -ls /usr/bin/python*
0 lrwxrwxrwx 1 root root 9 кві 16 2018 /usr/bin/python -> python2.7
0 lrwxrwxrwx 1 root root 9 кві 16 2018 /usr/bin/python2 -> python2.7
3580 -rwxr-xr-x 1 root root 3665768 лип 20 18:37 /usr/bin/python2.7
0 lrwxrwxrwx 1 root root 33 лип 20 18:37 /usr/bin/python2.7-config -> x86_64-linux-gnu-python2.7-config
0 lrwxrwxrwx 1 root root 16 кві 16 2018 /usr/bin/python2-config -> python2.7-config
0 lrwxrwxrwx 1 root root 9 жов 25 2018 /usr/bin/python3 -> python3.6
4424 -rwxr-xr-x 2 root root 4526456 лип 17 15:50 /usr/bin/python3.6
0 lrwxrwxrwx 1 root root 33 лип 17 15:50 /usr/bin/python3.6-config -> x86_64-linux-gnu-python3.6-config
4424 -rwxr-xr-x 2 root root 4526456 лип 17 15:50 /usr/bin/python3.6m
0 lrwxrwxrwx 1 root root 34 лип 17 15:50 /usr/bin/python3.6m-config -> x86_64-linux-gnu-python3.6m-config
5184 -rwxr-xr-x 2 root root 5308240 чер 29 08:44 /usr/bin/python3.7
5184 -rwxr-xr-x 2 root root 5308240 чер 29 08:44 /usr/bin/python3.7m
0 lrwxrwxrwx 1 root root 16 жов 25 2018 /usr/bin/python3-config -> python3.6-config
0 lrwxrwxrwx 1 root root 10 жов 25 2018 /usr/bin/python3m -> python3.6m
0 lrwxrwxrwx 1 root root 17 жов 25 2018 /usr/bin/python3m-config -> python3.6m-config
0 lrwxrwxrwx 1 root root 16 кві 16 2018 /usr/bin/python-config -> python2.7-config
та же ошибка при проверке cmake на наличие python 3.7
CMake Error at /usr/share/cmake-3.10/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
Could NOT find PythonLibs (missing: PYTHON_LIBRARIES PYTHON_INCLUDE_DIRS)
(Required is at least version "3.7")
Call Stack (most recent call first):
/usr/share/cmake-3.10/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
/usr/share/cmake-3.10/Modules/FindPythonLibs.cmake:262 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
CMakeLists.txt:45 (find_package)
потом взял на гугл клауде чистый инстанс и установил google-perftools но все равно получал ошибку
/usr/bin/ld: cannot find -ltcmalloc
и только после #1 (comment)
все заработало. Спасибо!!!
anyks commented
С питоном, CMake однозначно не видит библиотеку, можно попробовать указать:
$ cmake -DPYTHON_INCLUDE_DIR='/usr/include/python3.8' -DPYTHON_LIBRARY='/usr/lib/x86_64-linux-gnu/libpython3.8.so' ..
Возможно нужны были исходники от Google-PerfTools
apt-get install libgoogle-perftools-dev
… 4 авг. 2020 г., в 03:19, AlexandrMoruk ***@***.***> написал(а):
Попробовал еще на одной машине где установлен системный python 3.7
build git:(master) ls -ls /usr/bin/python*
0 lrwxrwxrwx 1 root root 9 кві 16 2018 /usr/bin/python -> python2.7
0 lrwxrwxrwx 1 root root 9 кві 16 2018 /usr/bin/python2 -> python2.7
3580 -rwxr-xr-x 1 root root 3665768 лип 20 18:37 /usr/bin/python2.7
0 lrwxrwxrwx 1 root root 33 лип 20 18:37 /usr/bin/python2.7-config -> x86_64-linux-gnu-python2.7-config
0 lrwxrwxrwx 1 root root 16 кві 16 2018 /usr/bin/python2-config -> python2.7-config
0 lrwxrwxrwx 1 root root 9 жов 25 2018 /usr/bin/python3 -> python3.6
4424 -rwxr-xr-x 2 root root 4526456 лип 17 15:50 /usr/bin/python3.6
0 lrwxrwxrwx 1 root root 33 лип 17 15:50 /usr/bin/python3.6-config -> x86_64-linux-gnu-python3.6-config
4424 -rwxr-xr-x 2 root root 4526456 лип 17 15:50 /usr/bin/python3.6m
0 lrwxrwxrwx 1 root root 34 лип 17 15:50 /usr/bin/python3.6m-config -> x86_64-linux-gnu-python3.6m-config
5184 -rwxr-xr-x 2 root root 5308240 чер 29 08:44 /usr/bin/python3.7
5184 -rwxr-xr-x 2 root root 5308240 чер 29 08:44 /usr/bin/python3.7m
0 lrwxrwxrwx 1 root root 16 жов 25 2018 /usr/bin/python3-config -> python3.6-config
0 lrwxrwxrwx 1 root root 10 жов 25 2018 /usr/bin/python3m -> python3.6m
0 lrwxrwxrwx 1 root root 17 жов 25 2018 /usr/bin/python3m-config -> python3.6m-config
0 lrwxrwxrwx 1 root root 16 кві 16 2018 /usr/bin/python-config -> python2.7-config
та же ошибка при проверке cmake на наличие python 3.7
CMake Error at /usr/share/cmake-3.10/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
Could NOT find PythonLibs (missing: PYTHON_LIBRARIES PYTHON_INCLUDE_DIRS)
(Required is at least version "3.7")
Call Stack (most recent call first):
/usr/share/cmake-3.10/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
/usr/share/cmake-3.10/Modules/FindPythonLibs.cmake:262 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
CMakeLists.txt:45 (find_package)
потом взял на гугл клауде чистый инстанс и установил google-perftools но все равно получал ошибку
/usr/bin/ld: cannot find -ltcmalloc
и только после #1 (comment) <#1 (comment)>
все заработало. Спасибо!!!
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub <#1 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AC3USOVXM4JDB4FS2BOK4Z3R65H2PANCNFSM4PTXRUOQ>.