PlatformIO Community

CI unit test gtest fail: undefined reference to `pthread_setspecific'

Hi,
I have a project with unit tests with google tests.
Locally everything is ok but on CI(GitHub actions) I have something like this:

Does anyone have something like this?
I see the problem with testing::internal::ThreadLocal but some information that I found relates to other makefiles :confused:
Is this a PlatformIO problem or something with gtest?

Please follow the official documentation GoogleTest — PlatformIO v6.0 documentation

  1. Remove lib_deps
  2. Change testing framework
  3. Restructure your “test” folder into the multiple test suites Test Hierarchy — PlatformIO v6.0 documentation

After a few days I back to this, and try something like You mention, but I have one problem.

Local and on CI I got:

.pio\build\seeed_wio_terminal_test\lib54d\libgoogletest.a(gtest-filepath.cc.o): In function `testing::internal::FilePath::CreateFolder() const':
gtest-filepath.cc:(.text._ZNK7testing8internal8FilePath12CreateFolderEv+0xa): undefined reference to `mkdir'

I found something similar Hot/Cold build problems on Linux with GCC 9.2.0 · Issue #176 · purduesigbots/pros · GitHub but I don’t know it’s good way?

Please remove CUSTOM GOOGLE LIBRARY from lib_deps

lib_deps = 
	google/googletest @ ^1.10.0

But now I use this env

[env:seeed_wio_terminal_test]
platform = atmelsam
board = seeed_wio_terminal
framework = arduino
build_src_filter = -<main.cpp>
test_framework = googletest

[env]
test_framework = googletest

and run

      - name: UT
        run: pio test -e seeed_wio_terminal_test

and I have no idea why this locally working fine

[env:UT]
platform = native
lib_compat_mode = off
src_filter = -<main.cpp>
lib_deps = 
	google/googletest @ ^1.10.0

and this, give me error with heap allocation

[env:seeed_native_test]
platform = native
build_src_filter = -<main.cpp>
test_framework = googletest

Program errored with 3221226356 code