Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error during make check, target common_stringutil #67

Closed
wookietreiber opened this issue May 7, 2015 · 10 comments
Closed

error during make check, target common_stringutil #67

wookietreiber opened this issue May 7, 2015 · 10 comments
Assignees

Comments

@wookietreiber
Copy link
Contributor

$ make check
...
make  common_stringutil common_histogram common_bitutil common_kmer common_sequence common_KmerIterator common_sam BloomFilter Konnector_DBGBloom Konnector_DBGBloomAlgorithms graph_ConstrainedBFSVisitor graph_BidirectionalBFS graph_AllPathsSearch graph_HashGraph graph_ConstrainedBidiBFSVisitor Konnector_konnector
make[2]: Entering directory '/tmp/makepkg/abyss/src/abyss-1.5.2/Unittest'
g++ -Wall -Wextra -Werror -march=native -mfpmath=sse -O2 -pipe -fstack-protector-strong --param=ssp-buffer-size=4 -D_FORTIFY_SOURCE=2  -L/usr/lib  -Wl,-O1,--sort-common,--as-needed,-z,relro -o common_stringutil Common/common_stringutil-StringUtilTest.o -lgtest_main -lpthread -ldl -lm  -ldl -lm 
/usr/bin/ld: Common/common_stringutil-StringUtilTest.o: undefined reference to symbol '_ZN7testing8internal13PrintStringToERKSsPSo'
/usr/lib/libgtest.so: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
Makefile:761: recipe for target 'common_stringutil' failed
make[2]: *** [common_stringutil] Error 1
...
@wookietreiber
Copy link
Contributor Author

I am on up-to-date Arch Linux, my PKGBUILD (which is the Arch Linux way of preparing a software package) looks as follows:

# Maintainer: Christian Krause ("wookietreiber") <kizkizzbangbang@googlemail.com>

pkgname=abyss
pkgver=1.5.2
pkgrel=1
pkgdesc="Assembly By Short Sequences - a de novo, parallel, paired-end sequence assembler"
arch=('i686' 'x86_64')
url="http://www.bcgsc.ca/platform/bioinfo/software/abyss"
license=('custom')
depends=('openmpi' 'boost-libs')
makedepends=('boost' 'sparsehash')
checkdepends=('gtest')
source=(https://github.com/bcgsc/abyss/releases/download/$pkgver/$pkgname-$pkgver.tar.gz)
md5sums=('10d6d72d1a915e618d41a5cbbcf2364c')

build() {
  cd $srcdir/$pkgname-$pkgver

  ./configure \
    --prefix=/usr \
    --with-boost=/usr/include/boost \
    --with-mpi=/usr

  make
}

check() {
  cd $srcdir/$pkgname-$pkgver

  make check
}

package() {
  cd $srcdir/$pkgname-$pkgver

  make DESTDIR=$pkgdir install

  install -Dm644 LICENSE $pkgdir/usr/share/licenses/$pkgname/LICENSE
}

@benvvalk
Copy link
Contributor

benvvalk commented May 7, 2015

Hi @wookietreiber,

It looks like an error when linking to the Google Test library. (In the future, we should probably just bundle Google Test with ABySS, since that is the method recommended by the gtest people.)

configure for ABySS has a --with-gtest option which you can point to the root of Google Test source tree, e.g. --with-gtest=/home/johndoe/src/gtest-1.7.0.

If that doesn't help, I would suggest disabling 'make check' for now.

@sjackman
Copy link
Collaborator

sjackman commented May 7, 2015

This linker option looks a bit odd -Wl,-O1,--sort-common,--as-needed,-z,relro. Does it compile if you remove it?

@wookietreiber
Copy link
Contributor Author

@benvvalk I had not used --with-gtest before since it is installed in a standard location. Even with an explicit --with-gtest=/usr it results in the same error.

@sjackman I have removed these linker flags, still no joy.

@wookietreiber
Copy link
Contributor Author

It seems like the linker flags are missing -lgtest. When I go to the directory and cut down the g++ command line to the bare essentials I experimented with what I found on the web, see 1 and 2.

$ g++ -o common_histogram Common/common_histogram-HistogramTest.o -lgtest_main -lpthread 
/usr/bin/ld: Common/common_histogram-HistogramTest.o: undefined reference to symbol '_ZN7testing8internal12AssertHelperD1Ev'
/usr/lib/libgtest.so: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
$ echo $?
1
$ g++ -o common_histogram Common/common_histogram-HistogramTest.o -lgtest_main -lgtest -lpthread 
$ echo $?
0

Seems the trick is to not only link against gtest_main but also against gtest directly.

@wookietreiber
Copy link
Contributor Author

It finally worked with that approach. My PKGBUILD now looks as follows (the important changes are in the prepare function):

# Maintainer: Christian Krause ("wookietreiber") <kizkizzbangbang@googlemail.com>                                                                                                                                                              

pkgname=abyss
pkgver=1.5.2
pkgrel=1
pkgdesc="Assembly By Short Sequences - a de novo, parallel, paired-end sequence assembler"
arch=('i686' 'x86_64')
url="http://www.bcgsc.ca/platform/bioinfo/software/abyss"
license=('custom')
depends=('openmpi' 'boost-libs')
makedepends=('boost' 'sparsehash')
checkdepends=('gtest')
source=(https://github.com/bcgsc/abyss/releases/download/$pkgver/$pkgname-$pkgver.tar.gz)
md5sums=('10d6d72d1a915e618d41a5cbbcf2364c')

prepare() {
  cd $srcdir/$pkgname-$pkgver

  sed -e 's|$(GTEST_LIBS)|$(GTEST_LIBS) -lgtest|' \
      -i Unittest/Makefile.am

  autoreconf -fi
}

build() {
  cd $srcdir/$pkgname-$pkgver

  ./configure \
    --prefix=/usr \
    --with-boost=/usr/include/boost \
    --with-mpi=/usr

  make
}

check() {
  cd $srcdir/$pkgname-$pkgver

  make check
}

package() {
  cd $srcdir/$pkgname-$pkgver

  make DESTDIR=$pkgdir install

  install -Dm644 LICENSE $pkgdir/usr/share/licenses/$pkgname/LICENSE
}

I think a patch can be easily made from these changes. I wonder why others did not experience this problem or did not report it.

@wookietreiber
Copy link
Contributor Author

Might be even better to just set the following in configure.ac:

AC_SUBST(GTEST_LIBS, "-lgtest_main -lgtest")

@sjackman
Copy link
Collaborator

sjackman commented May 8, 2015

The recommended method of building gest is make -C make (see https://github.com/smarr/googletest/blob/master/make/Makefile#L65-L66), and that builds a library gtest_main.a that includes both -lgtest_main and -lgtest in a single library. In the future I think we'll just vendor in the gtest dependency. Depending on gtest as an external dependency is a bit of mess.

@benvvalk
Copy link
Contributor

benvvalk commented May 8, 2015

Thanks very much, @wookietreiber.

@sjackman: Yes, I agree, let's bundle GTest with ABySS.

@wookietreiber
Copy link
Contributor Author

With 1.9.0 gtest is included and there are no errors.

jwcodee added a commit that referenced this issue Jan 30, 2020
* refactor deprecated functions

* BranchGroup.h: add missing function

* Pipemux.h: capitalize Semaphoe

* Pipemux.h: correct header

* PipeMux.h: remove directory
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants