bowtie2 icon indicating copy to clipboard operation
bowtie2 copied to clipboard

cmake build ignores CMAKE_INSTALL_PREFIX

Open mathog opened this issue 4 years ago • 7 comments

As of 2.4.1 the cmake build is ignoring CMAKE_INSTALL_PREFIX.

pversion=2.4.1
TOPDIR=/usr/common/modules/el8/x86_64/software/bowtie/${pversion}-CentOS-vanilla
wget https://github.com/BenLangmead/bowtie2/archive/v${pversion}.tar.gz
gunzip -c v${pversion}.tar.gz | tar -xf -
/bin/rm v${pversion}.tar.gz
ln -s bowtie2-${pversion} bowtie2
cd bowtie2
mkdir -p $TOPDIR
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX:PATH=$TOPDIR ..
make 2>&1 | tee build_2020_04_27.log
make install
make: *** No rule to make target 'install'.  Stop.

Expected to see output in $TOPDIR but it was in "build". Probably this happens because make is not creating an install option.

https://cmake.org/cmake/help/latest/variable/CMAKE_INSTALL_PREFIX.html

The DESTDIR mechanism

https://cmake.org/cmake/help/latest/envvar/DESTDIR.html#envvar:DESTDIR

also leaves the files in the build directory.

make DESTDIR=$TOPDIR

Also the build isn't quite clean, there are some warnings with gcc 8.3.1.

mathog avatar Apr 27 '20 21:04 mathog

Also, after the build this happens:

make test
Running tests...
Test project /usr/common/src/bowtie2-2.4.1/build
    Start 1: simple-align
1/1 Test #1: simple-align .....................***Failed    0.04 sec

0% tests passed, 1 tests failed out of 1

Total Test time (real) =   0.04 sec

The following tests FAILED:
          1 - simple-align (Failed)
Errors while running CTest
make: *** [Makefile:84: test] Error 8

That happens whether or not I have set up $TOPDIR and paths so that it finds bowtie2 (the script) and otherwise runs normally.

The log file says:

cat Temporary/LastTest.log
Start testing: Apr 27 14:25 PDT
----------------------------------------------------------
1/1 Testing: simple-align
1/1 Test: simple-align
Command: "/usr/common/src/bowtie2-2.4.1/bowtie2" "-x" "example/index/lambda_virus" "example/reads/longreads.fq"
Directory: /usr/common/src/bowtie2-2.4.1/build
"simple-align" start time: Apr 27 14:25 PDT
Output:
----------------------------------------------------------
(ERR): Expected bowtie2 to be in same directory with bowtie2-align:
/usr/common/src/bowtie2-2.4.1/
Exiting now ...
<end of output>
Test time =   0.04 sec
----------------------------------------------------------
Test Failed.
"simple-align" end time: Apr 27 14:25 PDT
"simple-align" time elapsed: 00:00:00
----------------------------------------------------------

End testing: Apr 27 14:25 PDT

However, if one does:

cd ../..
module load bowtie2 #set up paths
bowtie2 "-x" "example/index/lambda_virus" "example/reads/longreads.fq"

It runs fine. So nothing wrong with bowtie2, but the test in makefile isn't quite right. Unknown if the placement of the binaries (first post) is related to the failed "make test" (second post).

mathog avatar Apr 27 '20 21:04 mathog

Great catch! I think it's better to add cmake command step to our .travis.yml to test.

junaruga avatar Apr 28 '20 15:04 junaruga

This should be resolved in the commit referenced above. The change is on the bug_fixes branch if you're willing to test.

ch4rr0 avatar Apr 29 '20 16:04 ch4rr0

The bug_fixes branch CMakeLists.txt was loaded on top of an otherwise vanilla 2.4.1, then

mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX:PATH=$TOPDIR ..
make 2>&1 | tee ../build_2020_04_27.log
make install

This did put everything in the right place in $TOPDIR. However, the chmod bits were not set correctly on bowtie2, bowtie2-build, and bowtie2-inspect, (the other programs were OK.) The problem ones were all 644 even though the original files were 775.

"make test" still fails as it did previously.

mathog avatar Apr 29 '20 17:04 mathog

Pushed another change that hopefully resolves these.

ch4rr0 avatar Apr 29 '20 20:04 ch4rr0

I confirmed the make test is okay on my local.

$ mkdir build
$ cd build 
$ cmake -DCMAKE_INSTALL_PREFIX:PATH=$(pwd)/../dest/ ..
$ make 2>&1 | tee ../build.log
$ make install

$ make test
Running tests...
Test project /home/jaruga/git/bowtie2/build
    Start 1: simple-align
1/3 Test #1: simple-align .....................   Passed    0.18 sec
    Start 2: simple-build
2/3 Test #2: simple-build .....................   Passed    0.21 sec
    Start 3: simple-inspect
3/3 Test #3: simple-inspect ...................   Passed    0.00 sec

100% tests passed, 0 tests failed out of 3

But the make test has only 3 tests, unlike top directory's Makefile make test including simple-test task including many tests. https://github.com/BenLangmead/bowtie2/blob/b8c13c0401885873a99b229fca668deecde08749/Makefile#L625

junaruga avatar May 03 '20 18:05 junaruga

This change, although not mentioned in the release notes, is part of our most recent version, v2.4.2. I will work on adding support for running simple and random tests in time for the next release.

ch4rr0 avatar Oct 06 '20 04:10 ch4rr0