Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#1500 closed defect (fixed)

Huge amount of linker errors in datasource factory test

Reported by: vorner Owned by: vorner
Priority: high Milestone: Sprint-20111220
Component: build system Version:
Keywords: Cc:
CVSS Scoring: Parent Tickets:
Sensitive: no Defect Severity: N/A
Sub-Project: DNS Feature Depending on Ticket: none
Estimated Difficulty: 1 Add Hours to Ticket: 0
Total Hours: 0 Internal?: no

Description

Lately, distcheck started to fail on me with an linker error on the datasource factory unit tests binary. It produced huge amount of complains of missing gtest symbols. After some examination, I found out the linker is called like this:

/bin/sh ../../../../libtool --tag=CXX --mode=link g++ -Wall -Wextra -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare -Werror -fPIC -g -O2 -o run_unittests_factory run_unittests_factory-factory_unittest.o
libtool: link: g++ -Wall -Wextra -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare -Werror -fPIC -g -O2 -o run_unittests_factory run_unittests_factory-factory_unittest.o

Which is surprisingly short and doesn't contain any of the used libraries (including gtest).

When I was looking what happened, I did a small experiment which solved it, but I'm not completely sure why. It's attached and and I'd like someone to at last look at it if it is otherwise harmless, if providing a reason wouldn't be possible. It actually switches the code to compile the binary inside of the if HAVE_GTEST condition (where it should probably be anyway, as without gtest, it shouldn't be possible to compile it).

My wild guess would be that the common_ldadd variable didn't survive out of the conditional expression and became empty outside, so switching inside made it work. Also, the gtest library is installed in common prefix for me, so there's no -L needed for it, if it might be relevant.

Subtickets

Attachments (1)

makefile.patch (2.0 KB) - added by vorner 8 years ago.

Download all attachments as: .zip

Change History (11)

Changed 8 years ago by vorner

comment:1 follow-up: Changed 8 years ago by vorner

I just discovered that while my usual build is with the --with-gtest flag, the distcheck happened without it. So an explanation is not needed, the whole reason for this binary to fail was that it was the only one that wasn't excluded from the build when gtest wasn't available.

comment:2 in reply to: ↑ 1 Changed 8 years ago by jinmei

Replying to vorner:

I just discovered that while my usual build is with the --with-gtest flag, the distcheck happened without it. So an explanation is not needed, the whole reason for this binary to fail was that it was the only one that wasn't excluded from the build when gtest wasn't available.

Hmm, I thought it was changed recently:

# Use same --with-gtest flag if set
DISTCHECK_CONFIGURE_FLAGS += $(DISTCHECK_GTEST_CONFIGURE_FLAG)

comment:3 Changed 8 years ago by vorner

I don't know why, but it has no effect here, this happens. Should I open another ticket for that?

./configure --with-gtest
make
make check # Checks with gtest
make clean
make distcheck DISTCHECK_CONFIGURE_FLAGS="some flags" # Happens without the gtest

I'm not sure if it should run with or without it, but even if it should have, I believe this problem is still valid, as someone might have a system without gtest.

comment:4 Changed 8 years ago by vorner

  • Milestone changed from New Tasks to Sprint-20111220

comment:5 Changed 8 years ago by vorner

  • Status changed from new to reviewing

It should have been in review for all the time :-|

comment:6 Changed 8 years ago by jelte

  • Owner changed from UnAssigned to jelte

comment:7 Changed 8 years ago by shane

  • Feature Depending on Ticket set to none

comment:8 Changed 8 years ago by jelte

  • Owner changed from jelte to vorner

Looks good, please merge

comment:9 Changed 8 years ago by vorner

  • Resolution set to fixed
  • Status changed from reviewing to closed

Thanks, closing.

comment:10 Changed 8 years ago by vorner

  • Estimated Difficulty changed from 0 to 1
Note: See TracTickets for help on using tickets.