veg / tn93

TN93 fast distance calculator
MIT License
15 stars 7 forks source link

linux install #42

Closed brmagalis closed 5 months ago

brmagalis commented 5 months ago

With gcc 12.2.0, I am running into the following installation issues:

[brittany.rife@login7 tn93]$ make install [ 9%] Built target tn93 [ 19%] Built target tn93-cluster [ 28%] Built target seqcoverage [ 30%] Building CXX object CMakeFiles/readreduce.dir/src/read_reducer.cpp.o /home/brittany.rife/tn93/src/read_reducer.cpp: In function ‘void handle_a_sequence(StringBuffer&, StringBuffer&, Vector&, Vector&, long int, long int, Vector*)’: /home/brittany.rife/tn93/src/read_reducer.cpp:128:187: error: ‘firstSequenceLength’ is predetermined ‘shared’ for ‘shared’

pragma omp parallel for default(none) shared(currently_defined_clusters, try_cluster, sequence_lengths, current_sequence, current_clusters, firstSequenceLength, min_overlap)

                                                                                                                                                                                       ^

/home/brittany.rife/tn93/src/read_reducer.cpp:128:187: error: ‘min_overlap’ is predetermined ‘shared’ for ‘shared’ make[2]: [CMakeFiles/readreduce.dir/build.make:76: CMakeFiles/readreduce.dir/src/read_reducer.cpp.o] Error 1 make[1]: [CMakeFiles/Makefile2:183: CMakeFiles/readreduce.dir/all] Error 2 make: *** [Makefile:136: all] Error 2

stevenweaver commented 5 months ago

Hi Brittany,

I hope you are well. Would you mind sharing the output of CMake?

Mine looks like this:

(base) 14:27:17 sweaver@Stevens-MacBook-Pro.local tn93 master ? cmake .
CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
  Compatibility with CMake < 3.5 will be removed from a future version of 
  CMake.                                 

  Update the VERSION argument <min> value or use a ...<max> suffix to tell       
  CMake that the project does not need compatibility with older versions. 

-- The C compiler identification is GNU 12.3.0                   
-- The CXX compiler identification is GNU 12.3.0          
-- Checking whether C compiler has -isysroot                          
-- Checking whether C compiler has -isysroot - yes
-- Checking whether C compiler supports OSX deployment target flag
-- Checking whether C compiler supports OSX deployment target flag - yes
-- Detecting C compiler ABI info                                                                                                                  
-- Detecting C compiler ABI info - done                   
-- Check for working C compiler: /usr/local/Cellar/gcc@12/12.3.0/bin/gcc-12 - skipped
-- Detecting C compile features                           
-- Detecting C compile features - done
-- Checking whether CXX compiler has -isysroot            
-- Checking whether CXX compiler has -isysroot - yes
-- Checking whether CXX compiler supports OSX deployment target flag
-- Checking whether CXX compiler supports OSX deployment target flag - yes
-- Detecting CXX compiler ABI info        
-- Detecting CXX compiler ABI info - done                 
-- Check for working CXX compiler: /usr/local/Cellar/gcc@12/12.3.0/bin/g++-12 - skipped
-- Detecting CXX compile features                         
-- Detecting CXX compile features - done
-- Found OpenMP_C: -fopenmp (found version "4.5")         
-- Found OpenMP_CXX: -fopenmp (found version "4.5") 
-- Found OpenMP: TRUE (found version "4.5")  
-- Configuring done (6.8s)           
-- Generating done (0.1s)                                 
-- Build files have been written to: /Users/sweaver/Programming/hivtrace/tn93

Best, Steven

brmagalis commented 5 months ago

Sure thing! Can't let you get bored over there ;)

[brittany.rife@login7 tn93]$ cmake .
-- The C compiler identification is GNU 8.5.0
-- The CXX compiler identification is GNU 8.5.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found OpenMP_C: -fopenmp (found version "4.5")
-- Found OpenMP_CXX: -fopenmp (found version "4.5")
-- Found OpenMP: TRUE (found version "4.5")
-- Configuring done (1.5s)
-- Generating done (0.3s)
-- Build files have been written to: /home/brittany.rife/tn93

8.5.0 too old?

spond commented 5 months ago

Dear @brmagalis,

It should be just fine. The issue is that one of the rarely used modules (read_reducer.cpp) has an OpenMP statement which doesn't properly handle the combination of OpenMP/gcc that you have installed.

I just pushed a little fix, try pulling the repo and recompiling. If it works, I'll bump the version.

Best, Sergei

brmagalis commented 5 months ago

[brittany.rife@login7 tn93]$ git pull remote: Enumerating objects: 5, done. remote: Counting objects: 100% (5/5), done. remote: Compressing objects: 100% (2/2), done. remote: Total 5 (delta 4), reused 4 (delta 3), pack-reused 0 Unpacking objects: 100% (5/5), 413 bytes | 17.00 KiB/s, done. From https://github.com/veg/tn93 8705363..ddc0ad7 master -> origin/master 8c54a5c..9b19f48 develop -> origin/develop Updating 8705363..ddc0ad7 Fast-forward src/read_reducer.cpp | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) [brittany.rife@login7 tn93]$ cmake . -- Configuring done (0.0s) -- Generating done (0.3s) -- Build files have been written to: /home/brittany.rife/tn93 [brittany.rife@login7 tn93]$ make install [ 9%] Built target tn93 [ 19%] Built target tn93-cluster [ 28%] Built target seqcoverage [ 30%] Building CXX object CMakeFiles/readreduce.dir/src/read_reducer.cpp.o /home/brittany.rife/tn93/src/read_reducer.cpp: In function ‘void handle_a_sequence(StringBuffer&, StringBuffer&, Vector&, Vector&, long int, long int, Vector*)’: /home/brittany.rife/tn93/src/read_reducer.cpp:126:183: error: ‘firstSequenceLength’ is predetermined ‘shared’ for ‘shared’

pragma omp parallel for default(none) shared(currently_defined_clusters, try_cluster, sequence_lengths, current_sequence, current_clusters, firstSequenceLength, min_overlap)

                                                                                                                                                                                   ^

/home/brittany.rife/tn93/src/read_reducer.cpp:126:183: error: ‘min_overlap’ is predetermined ‘shared’ for ‘shared’ make[2]: [CMakeFiles/readreduce.dir/build.make:76: CMakeFiles/readreduce.dir/src/read_reducer.cpp.o] Error 1 make[1]: [CMakeFiles/Makefile2:183: CMakeFiles/readreduce.dir/all] Error 2 make: *** [Makefile:136: all] Error 2

stevenweaver commented 5 months ago

Hi @brmagalis,

I think your cmake cache needs to be cleared.

rm -rf CMakeCache.txt CMakeFiles

Then run cmake and make again.

Best, Steven

brmagalis commented 5 months ago

Well, shoot. A new one:

[brittany.rife@login7 tn93]$ rm -rf CMakeCache.txt CMakeFiles [brittany.rife@login7 tn93]$ cmake . -- The C compiler identification is GNU 13.2.0 -- The CXX compiler identification is GNU 12.2.0 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /apps/hivtrace/1.5.0/bin/gcc - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /apps/compilers/gcc/12.2/bin/g++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Found OpenMP_C: -fopenmp (found version "4.5") -- Found OpenMP_CXX: -fopenmp (found version "4.5") -- Found OpenMP: TRUE (found version "4.5")
-- Configuring done (1.8s) -- Generating done (0.3s) -- Build files have been written to: /home/brittany.rife/tn93 [brittany.rife@login7 tn93]$ make install [ 1%] Building CXX object CMakeFiles/tn93.dir/src/TN93.cpp.o [ 3%] Building CXX object CMakeFiles/tn93.dir/src/stringBuffer.cc.o [ 5%] Building CXX object CMakeFiles/tn93.dir/src/tn93_shared.cc.o [ 7%] Building CXX object CMakeFiles/tn93.dir/src/argparse.cpp.o [ 9%] Linking CXX executable tn93 /apps/hivtrace/1.5.0/x86_64-conda-linux-gnu/sysroot/usr/lib/libm.so: undefined reference to `__get_cpu_features@GLIBC_PRIVATE' collect2: error: ld returned 1 exit status make[2]: [CMakeFiles/tn93.dir/build.make:147: tn93] Error 1 make[1]: [CMakeFiles/Makefile2:105: CMakeFiles/tn93.dir/all] Error 2 make: *** [Makefile:136: all] Error 2

stevenweaver commented 5 months ago

This one appears to be likely due to your version of GLIBC. Can you confirm which version of glibc you have installed in your conda environment?

conda list | grep libc

If it's an earlier version than 2.29, then the fix should be easy.

conda install -c conda-forge glibc=2.29

If it's 2.29 or later, this might be tricky.

Best, Steven

brmagalis commented 5 months ago

Hm, so I did not have it, but when I tried to install 2.29, it doesn't seem to find it using conda-forge:

[brittany.rife@login7 tn93]$ conda install -c conda-forge glibc=2.29 Channels:

PackagesNotFoundError: The following packages are not available from current channels:

Current channels:

stevenweaver commented 5 months ago

Hi Brittany,

I think this might be due to the system you are trying to build on. I'm working internally with a couple of folks to see if we can find a solution for you.

Best, Steven

stevenweaver commented 5 months ago

Hi @brmagalis,

I was able to create two different static builds for you.

1) https://data.hyphy.org/web/stevenweaver/tn93_static.singlethread This is a single-threaded, very slow, statically built version of tn93.

2) https://data.hyphy.org/web/stevenweaver/tn93_mixed_openmp This is a mixed statically and dynamically-linked openmp binary that, if you have OpenMP libraries installed on the system, might work. Unfortunately, there is a limitation of glibc -based systems that do not allow OpenMP to be statically linked due to issues with underlying pthreads.

I believe this is the best that can be done given the age of the system you are trying to build on. If neither of these work, tn93 would need to be either updated to allow for backwards compatibility with older versions of glibc, or maybe, an older version of tn93 might work. (Which you could try by checking out a tag like git fetch --tags;git checkout v1.0.4.

I'm sorry I don't have a better answer here, but this is about as much as I can do without incorporating backwards compatibility into tn93.

Best, Steven

stevenweaver commented 5 months ago

Also, if you'd like to try something experimental, @daniel-ji has released a complete in-browser version of tn93 utilizing wasm here.

brmagalis commented 5 months ago

No worries, Steven. I went ahead and requested the HPC staff install it globally as part of an HIV-TRACE module, and it works just fine, which is probably better than a local instance anyway. Thanks for the effort!

stevenweaver commented 5 months ago

Great, glad to hear that it's been resolved. Please take care.