google / google/googletest

[Bug]: When I generated the libgtest.so.1.12.1, it doesn't have the symbol 'regexec'

Open
#4,703 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
39.5k
Forks
10.9k
Avg merge
6d 13h
Merged PRs (30d)
1

Description

### Describe the issue

I cross-compile the gtest lib for QNX. But the libgtest.so.1.12.1, **it doesn't have the symbol 'regexec'**.

### Steps to reproduce the problem

I do `source /opt/qnx/qnx710_v45601/qnxsdp-env.sh
cmake ../../../googletest -DBUILD_SHARED_LIBS=ON -DCMAKE_TOOLCHAIN_FILE=../qnx_8650_45601.cmake \
-DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_INCLUDE_PATH=/opt/qnx/qnx710_v45601/target/qnx7/usr/include
make clean
make -j8`.
The log is:
```
QNX_HOST=/opt/qnx/qnx710_v45601/host/linux/x86_64
QNX_TARGET=/opt/qnx/qnx710_v45601/target/qnx7
MAKEFLAGS=-I/opt/qnx/qnx710_v45601/target/qnx7/usr/include
-- The CXX compiler identification is GNU 8.3.0
-- The C compiler identification is GNU 8.3.0
-- Check for working CXX compiler: /opt/qnx/qnx710_v45601/host/linux/x86_64/usr/bin/aarch64-unknown-nto-qnx7.1.0-g++
-- Check for working CXX compiler: /opt/qnx/qnx710_v45601/host/linux/x86_64/usr/bin/aarch64-unknown-nto-qnx7.1.0-g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Check for working C compiler: /opt/qnx/qnx710_v45601/host/linux/x86_64/usr/bin/aarch64-unknown-nto-qnx7.1.0-gcc
-- Check for working C compiler: /opt/qnx/qnx710_v45601/host/linux/x86_64/usr/bin/aarch64-unknown-nto-qnx7.1.0-gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Found Python: /usr/bin/python3.8 (found version "3.8.10") found components: Interpreter
-- 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
-- 111$/data4//OSS-compile/gtest/googletest>
-- 222$/>
-- regex libraries:
-- Configuring done
-- Generating done
CMake Warning:
Manually-specified variables were not used by the project:

CMAKE_INCLUDE_PATH

-- Build files have been written to: /data4/OSS-compile/gtest/build/prj_qnx_8650_45601/build
make -f CMakeFiles/Makefile2 clean
make[1]: Entering directory '/data4//OSS-compile/gtest/build/prj_qnx_8650_45601/build'
make -f CMakeFiles/gtest_main.dir/build.make CMakeFiles/gtest_main.dir/clean
make[2]: Entering directory '/data4//OSS-compile/gtest/build/prj_qnx_8650_45601/build'
/usr/bin/cmake -P CMakeFiles/gtest_main.dir/cmake_clean.cmake
make[2]: Leaving directory '/data4/OSS-compile/gtest/build/prj_qnx_8650_45601/build'
make -f CMakeFiles/gtest.dir/build.make CMakeFiles/gtest.dir/clean
make[2]: Entering directory '/data4/OSS-compile/gtest/build/prj_qnx_8650_45601/build'
/usr/bin/cmake -P CMakeFiles/gtest.dir/cmake_clean.cmake
make[2]: Leaving directory '/data4/OSS-compile/gtest/build/prj_qnx_8650_45601/build'
make[1]: Leaving directory '/data4/OSS-compile/gtest/build/prj_qnx_8650_45601/build'
/usr/bin/cmake -S/data4/OSS-compile/gtest/googletest -B/data4/OSS-compile/gtest/build/prj_qnx_8650_45601/build --check-build-system CMakeFiles/Makefile.cmake 0
/usr/bin/cmake -E cmake_progress_start /data4/OSS-compile/gtest/build/prj_qnx_8650_45601/build/CMakeFiles /data4/OSS-compile/gtest/build/prj_qnx_8650_45601/build/CMakeFiles/progress.marks
make -f CMakeFiles/Makefile2 all
make[1]: Entering directory '/data4/OSS-compile/gtest/build/prj_qnx_8650_45601/build'
make -f CMakeFiles/gtest.dir/build.make CMakeFiles/gtest.dir/depend
make[2]: Entering directory '/data4/OSS-compile/gtest/build/prj_qnx_8650_45601/build'
cd /data4/OSS-compile/gtest/build/prj_qnx_8650_45601/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /data4/OSS-compile/gtest/googletest /data4/OSS-compile/gtest/googletest /data4/OSS-compile/gtest/build/prj_qnx_8650_45601/build /data4/OSS-compile/gtest/build/prj_qnx_8650_45601/build /data4/OSS-compile/gtest/build/prj_qnx_8650_45601/build/CMakeFiles/gtest.dir/DependInfo.cmake --color=
Scanning dependencies of target gtest
make[2]: Leaving directory '/data4/OSS-compile/gtest/build/prj_qnx_8650_45601/build'
make -f CMakeFiles/gtest.dir/build.make CMakeFiles/gtest.dir/build
make[2]: Entering directory '/data4/OSS-compile/gtest/build/prj_qnx_8650_45601/build'
[ 25%] Building CXX object CMakeFiles/gtest.dir/src/gtest-all.cc.o
/opt/qnx/qnx710_v45601/host/linux/x86_64/usr/bin/aarch64-unknown-nto-qnx7.1.0-g++ -DGTEST_CREATE_SHARED_LIBRARY=1 -Dgtest_EXPORTS -I/data4//OSS-compile/gtest/googletest/include -I/data4/OSS-compile/gtest/googletest -O2 -Wall -fPIC -O2 -Wall -fPIC -fPIC -Wall -Wshadow -Wno-error=dangling-else -DGTEST_HAS_PTHREAD=1 -fexceptions -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -std=gnu++14 -o CMakeFiles/gtest.dir/src/gtest-all.cc.o -c /data4/OSS-compile/gtest/googletest/src/gtest-all.cc
[ 50%] Linking CXX shared library lib/libgtest.so
/usr/bin/cmake -E cmake_link_script CMakeFiles/gtest.dir/link.txt --verbose=1
/opt/qnx/qnx710_v45601/host/linux/x86_64/usr/bin/aarch64-unknown-nto-qnx7.1.0-g++ -fPIC -O2 -Wall -fPIC -O2 -Wall -fPIC -shared -Wl,-soname,libgtest.so.1.12.1 -o lib/libgtest.so.1.12.1 CMakeFiles/gtest.dir/src/gtest-all.cc.o /opt/qnx/qnx710_v45601/target/qnx7/aarch64le/lib/libregex.so.1
/usr/bin/cmake -E cmake_symlink_library lib/libgtest.so.1.12.1 lib/libgtest.so.1.12.1 lib/libgtest.so
make[2]: Leaving directory '/data4/OSS-compile/gtest/build/prj_qnx_8650_45601/build'
[ 50%] Built target gtest
make -f CMakeFiles/gtest_main.dir/build.make CMakeFiles/gtest_main.dir/depend
make[2]: Entering directory '/data4/OSS-compile/gtest/build/prj_qnx_8650_45601/build'
cd /data4/OSS-compile/gtest/build/prj_qnx_8650_45601/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /data4/OSS-compile/gtest/googletest /data4/OSS-compile/gtest/googletest /data4/OSS-compile/gtest/build/prj_qnx_8650_45601/build /data4/OSS-compile/gtest/build/prj_qnx_8650_45601/build /data4/OSS-compile/gtest/build/prj_qnx_8650_45601/build/CMakeFiles/gtest_main.dir/DependInfo.cmake --color=
Scanning dependencies of target gtest_main
make[2]: Leaving directory '/data4/OSS-compile/gtest/build/prj_qnx_8650_45601/build'
make -f CMakeFiles/gtest_main.dir/build.make CMakeFiles/gtest_main.dir/build
make[2]: Entering directory '/data4/OSS-compile/gtest/build/prj_qnx_8650_45601/build'
[ 75%] Building CXX object CMakeFiles/gtest_main.dir/src/gtest_main.cc.o
/opt/qnx/qnx710_v45601/host/linux/x86_64/usr/bin/aarch64-unknown-nto-qnx7.1.0-g++ -DGTEST_CREATE_SHARED_LIBRARY=1 -Dgtest_main_EXPORTS -I/opt/qnx/qnx710_v45601/target/qnx7/usr/include/regex.h -isystem /data4/OSS-compile/gtest/googletest/include -isystem /data4/OSS-compile/gtest/googletest -O2 -Wall -fPIC -O2 -Wall -fPIC -fPIC -Wall -Wshadow -Wno-error=dangling-else -DGTEST_HAS_PTHREAD=1 -fexceptions -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -std=gnu++14 -o CMakeFiles/gtest_main.dir/src/gtest_main.cc.o -c /data4/OSS-compile/gtest/googletest/src/gtest_main.cc
cc1plus: warning: /opt/qnx/qnx710_v45601/target/qnx7/usr/include/regex.h: not a directory
[100%] Linking CXX shared library lib/libgtest_main.so
/usr/bin/cmake -E cmake_link_script CMakeFiles/gtest_main.dir/link.txt --verbose=1
/opt/qnx/qnx710_v45601/host/linux/x86_64/usr/bin/aarch64-unknown-nto-qnx7.1.0-g++ -fPIC -O2 -Wall -fPIC -O2 -Wall -fPIC -shared -Wl,-soname,libgtest_main.so.1.12.1 -o lib/libgtest_main.so.1.12.1 CMakeFiles/gtest_main.dir/src/gtest_main.cc.o -Wl,-rpath,/data4/OSS-compile/gtest/build/prj_qnx_8650_45601/build/lib lib/libgtest.so.1.12.1 /opt/qnx/qnx710_v45601/target/qnx7/aarch64le/lib/libregex.so.1
/usr/bin/cmake -E cmake_symlink_library lib/libgtest_main.so.1.12.1 lib/libgtest_main.so.1.12.1 lib/libgtest_main.so
make[2]: Leaving directory '/data4/OSS-compile/gtest/build/prj_qnx_8650_45601/build'
[100%] Built target gtest_main
make[1]: Leaving directory '/data4/OSS-compile/gtest/build/prj_qnx_8650_45601/build'
/usr/bin/cmake -E cmake_progress_start /data4/OSS-compile/gtest/build/prj_qnx_8650_45601/build/CMakeFiles 0
```
Then I do `nm libgtest.so.1.12.1 | grep regexec`, the log is `U regexec`.
I run `readelf -d libgtest.so.1.12.1`, NEEDED includes `libregex.so.1`.
I run `nm libgtest.so.1.12.1 | grep regexec`, th log is `0000000000006d40 T regexec`.

### What version of GoogleTest are you using?

1.12.1

### What operating system and version are you using?

linux_x86

### What compiler and version are you using?

aarch64-unknown-nto-qnx7.1.0-g++

### What build system are you using?

cmake version 3.16.3

### Additional context

_No response_

Contributor guide

Open the contributing guide

Research direction

Reproduce the QNX cross-build using the shown CMake toolchain invocation, then inspect libgtest.so.1.12.1 with nm and readelf as described. Compare the two reported regexec results and the libregex.so.1 dependency; done means establishing the expected symbol behavior and identifying whether a project change is required.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake, cpp
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.