catkin_make doesn't work without any errors or warnings and functions can't be imported
Hello, I am using ROS noetic on Ubuntu 20.04. The error I am facing now was not anywhere in Ubuntu 18.04 (ROS Melodic). Even a few days ago everything was ok. The situation is that "catkin_make" doesn't work without any errors or warnings, and one python file can't import another file's function in the same directory. Here is the test files with the same problem.
test1.py:
#!/usr/bin/env python
from test2 import *
a=test()
print(math.pi*2)
test2()
test2.py:
#!/usr/bin/env python
import math
class test:
def __init__(self):
print(math.pi)
def test2():
print('test')
print('test2 is imported')
CMakeLists.txt:
cmake_minimum_required(VERSION 3.0.2)
project(test)
find_package(catkin REQUIRED COMPONENTS
roscpp
rospy
std_msgs
)
catkin_package(
# INCLUDE_DIRS include
# LIBRARIES test
# CATKIN_DEPENDS roscpp rospy std_msgs
# DEPENDS system_lib
)
include_directories(
# include
${catkin_INCLUDE_DIRS}
)
catkin_install_python(PROGRAMS
src/test1.py
src/test2.py
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)
catkin_make:
mu@mu-TM1703:~/mu$ catkin_make -DCATKIN_WHITELIST_PACKAGES="test"
Base path: /home/mu/mu
Source space: /home/mu/mu/src
Build space: /home/mu/mu/build
Devel space: /home/mu/mu/devel
Install space: /home/mu/mu/install
####
#### Running command: "cmake /home/mu/mu/src -DCATKIN_WHITELIST_PACKAGES=test -DCATKIN_DEVEL_PREFIX=/home/mu/mu/devel -DCMAKE_INSTALL_PREFIX=/home/mu/mu/install -G Unix Makefiles" in "/home/mu/mu/build"
####
-- The C compiler identification is GNU 9.3.0
-- The CXX compiler identification is GNU 9.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- 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
-- Using CATKIN_DEVEL_PREFIX: /home/mu/mu/devel
-- Using CMAKE_PREFIX_PATH: /home/mu/mu/devel;/opt/ros/noetic
-- This workspace overlays: /home/mu/mu/devel;/opt/ros/noetic
-- Found PythonInterp: /usr/bin/python3 (found suitable version "3.8.5", minimum required is "3")
-- Using PYTHON_EXECUTABLE: /usr/bin/python3
-- Using Debian Python package layout
-- Found PY_em: /usr/lib/python3/dist-packages/em.py
-- Using empy: /usr/lib/python3/dist-packages/em.py
-- Using CATKIN_ENABLE_TESTING: ON
-- Call enable_testing()
-- Using CATKIN_TEST_RESULTS_DIR: /home/mu/mu/build/test_results
-- Forcing gtest/gmock from source, though one was otherwise available.
-- Found gtest sources under '/usr/src/googletest': gtests will be built
-- Found gmock sources under '/usr/src/googletest': gmock will be built
-- Found PythonInterp: /usr/bin/python3 (found version "3.8.5")
-- Found Threads: TRUE
-- Using Python nosetests: /usr/bin/nosetests3
-- catkin 0.8.10
-- BUILD_SHARED_LIBS is on
-- BUILD_SHARED_LIBS is on
-- Using CATKIN_WHITELIST_PACKAGES: test
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- ~~ traversing 1 packages in topological order:
-- ~~ - test
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- +++ processing catkin package: 'test'
-- ==> add_subdirectory(test)
-- Installing devel-space wrapper /home/mu/mu/src/test/src/test1.py to /home/mu/mu/devel/lib/test
-- Installing devel-space wrapper /home/mu/mu/src/test/src/test2.py to /home/mu/mu/devel/lib/test
-- Configuring done
-- Generating ...