gflags regression in 1.12.0rc3
envgap__ceres-solver__ceres-solver-242
Original GitHub issue ↗Opened 2016-11-21
01 / FAILURE SIGNATURE
As reported upstream
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Not a benchmark task.
- No curated issue-specific recipe or verified environment fix is available.
02 / ENVIRONMENT RECIPE
- Base commit
Not freshly verified- Manifest
CMakeLists.txt- Reproduce
Awaiting issue-specific recipe- Run under trace
Awaiting a meaningful runtime command
03 / ORIGINAL ISSUE TEXT
ceres-solver/ceres-solver #242 · read the original issue
The error is
```
==> make
Scanning dependencies of target helloworld
[ 50%] Building CXX object CMakeFiles/helloworld.dir/helloworld.cc.o
[100%] Linking CXX executable helloworld
ld: library not found for -lgflags-shared
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [helloworld] Error 1
make[1]: *** [CMakeFiles/helloworld.dir/all] Error 2
make: *** [all] Error 2
Error: homebrew/science/ceres-solver: failed
Failed executing: make
```
which occurs when running running the Homebrew test block:
```
test do
cp pkgshare/"examples/helloworld.cc", testpath
(testpath/"CMakeLists.txt").write <<-EOS.undent
cmake_minimum_required(VERSION 2.8)
project(helloworld)
find_package(Ceres REQUIRED)
include_directories(${CERES_INCLUDE_DIRS})
add_executable(helloworld helloworld.cc)
target_link_libraries(helloworld ${CERES_LIBRARIES})
EOS
system "cmake", "-DCeres_DIR=#{share}/Ceres", "."
system "make"
assert_match "CONVERGENCE", shell_output("./helloworld", 0)
end
```
Not surprisingly, git bisect identifies 29888185a1427ffcc03a228a82432944c12aa530 as the first bad commit:
```
29888185a1427ffcc03a228a82432944c12aa530 is the first bad commit
commit 29888185a1427ffcc03a228a82432944c12aa530
Author: Alex Stewart <alexs.mac@gmail.com>
Date: Sat Nov 12 18:36:28 2016 +0000
Make gflags a public dependency of Ceres if it and glog are found.
- Previously we were not listing gflags as a public dependency of Ceres
if it and glog were found (and MINIGLOG was not being used). This
does not reflect that if glog was compiled with gflags then it will
#include gflags/gflags.h in glog/logging.h, thus making gflags a
public dependency of anything linking against glog.
- On *nix OSs if glog/gflags are shared libraries this did not result
in a link error when compiling Ceres as the gflags symbols were
indirectly resolved. However, on MSVC this is not the case, and this
could result in unresolved gflags symbol link errors when compiling
Ceres.
- Now we add gflags to the list of public Ceres dependencies if both
glog and gflags are found (and MINIGLOG is not enabled).
Change-Id: I5ce6038fa816781cc81b378522068dc563d29c51
:100644 100644 97a1726641e50018affffd57681b0be6f1fb43f4 89d0bf035fa99ac73768b87f3a4627244f85e686 M CMakeLists.txt
:040000 040000 8bcb6f7276c35a27c251f09a13110333fd899851 1c3a2118e1e31a648904ea366d6938e0f7e38f50 M examples
:040000 040000 5174069dd9d3cd904568967ac67b1690cafd8b21 fc046df7a9e4c43129869104f3140541347886bf M internal
```
Full build log is here:
https://bot.brew.sh/job/Homebrew%20Science%20Pull%20Requests/6401/version=sierra/consoleText
The error is of course telling the truth since there is indeed no library actually named `libgflags-shared`:
```
iMac-TMP:ceres-solver joe$ find /usr/local/Cellar|gre04 / LABELS
Labels from the report text only; not yet run
No supported category has been assigned.
Label rules and the text that matched
[]
Issue-specific recipe and runtime smoke command require review against the complete issue and repository.
Legacy reproduction is generic install-only; match the actual issue failure before admission.