google / google/googletest

[Bug]: gtest_main.so doesn't contain symbols from gtest.so

Open
#4,486 2 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

gtest_main.so built by the FreeBSD port doesn't contain symbols normally found in gtest.so

Is ```gtest_main.so``` documented anywhere? Is it supposed to only have the ```main``` symbol, or also all symbols from ```gtest.so```?

[This post](https://stackoverflow.com/questions/6457856/whats-the-difference-between-gtest-lib-and-gtest-main-lib) says:
> [...] inconsistent part is that gtest_main sometimes also includes everything from gtest, so that you only need to link against either gtest (if you want to write your own main() method) or gtest_main [...]

It isn't clear what does it mean "gtest_main sometimes also includes everything from gtest".

Many projects only link with ```gtest_main``` and it works somehow.

So is ```gtest_main``` supposed to be a complete replacement of ```gtest``` + the ```main``` function, or not?

Could you please document ```gtest_main``` and clearly define there what does it contain?

### Steps to reproduce the problem

n/a

### What version of GoogleTest are you using?

googletest-1.14.0

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

FreeBSD 14.0

### What compiler and version are you using?

clang-16

### What build system are you using?

cmake

### Additional context

_No response_

Contributor guide

Open the contributing guide

Research direction

The issue names no repository files or tests; start by locating the gtest_main and gtest shared-library build and documentation in the repository. Compare the documented linking behavior with the FreeBSD 14.0/CMake case described here. Done means the documentation clearly states which symbols and linkage requirements gtest_main provides, including whether it replaces gtest.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake, cpp
Domain
build-system, testing-qa
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.