Hello developers,
I encountered a linker error while building Metabuli from source:
/usr/bin/ld: CMakeFiles/metabuli.dir/workflow/classify.cpp.o: in function `validate_interleaved(char*)':
classify.cpp:(.text+0x125): undefined reference to `fastq_validate_entry(fastq_file*, fastq_entry*)'
/usr/bin/ld: classify.cpp:(.text+0x138): undefined reference to `fastq_validate_entry(fastq_file*, fastq_entry*)'
/usr/bin/ld: CMakeFiles/metabuli.dir/workflow/classify.cpp.o: in function `validate_paired_sorted_fastq_file(char*, char*)':
classify.cpp:(.text+0x35e): undefined reference to `fastq_validate_entry(fastq_file*, fastq_entry*)'
/usr/bin/ld: classify.cpp:(.text+0x384): undefined reference to `fastq_validate_entry(fastq_file*, fastq_entry*)'
/usr/bin/ld: CMakeFiles/metabuli.dir/workflow/classify.cpp.o: in function `validate_single_fastq_file(char const*)':
classify.cpp:(.text+0x5f1): undefined reference to `fastq_validate_entry(fastq_file*, fastq_entry*)'
/usr/bin/ld: CMakeFiles/metabuli.dir/workflow/classify.cpp.o:classify.cpp:(.text+0xdec): more undefined references to `fastq_validate_entry(fastq_file*, fastq_entry*)' follow
collect2: error: ld returned 1 exit status
make[2]: *** [src/CMakeFiles/metabuli.dir/build.make:946: src/metabuli] Error 1
make[1]: *** [CMakeFiles/Makefile2:1091: src/CMakeFiles/metabuli.dir/all] Error 2
make: *** [Makefile:136: all] Error 2
Steps to reproduce
- Clone the repository and initialize submodules.
- Run CMake with CUDA and OpenMP enabled:
cmake -DCMAKE_BUILD_TYPE=Release \
-DENABLE_CUDA=ON \
-DCUDA_ARCHITECTURES=75 \
-DNATIVE_ARCH=ON \
-DREQUIRE_OPENMP=ON \
-DHAVE_SSE2=ON \
-DHAVE_SSE4_1=ON \
-DHAVE_AVX2=ON \
-DINSTALL_UTIL=ON \
-DCMAKE_INSTALL_PREFIX=$(pwd) ..
- Run make -j$(nproc).
Observations
- The function fastq_validate_entry is declared in fastq.h and defined in fastq.cpp as inline int fastq_validate_entry(...).
- Because it is marked inline in the .cpp file, no global symbol is emitted into libfastq_utils.a.
- As a result, calls from classify.cpp cannot be resolved at link time, even though fastq_utils is linked.
Suggested fix
- Remove the inline keyword from the definition in fastq.cpp so the function is compiled into the library as a proper symbol.
- Keep only the declaration in fastq.h:
int fastq_validate_entry(FASTQ_FILE* fd, FASTQ_ENTRY* e);
- Ensure fastq.cpp is included in the fastq_utils target in lib/fastq_utils/CMakeLists.txt.
Environment
OS: Ubuntu 20.04
GPU: Quadro RTX 4000 (CUDA 7.5)
CPU: Intel with AVX2/AVX512 support
CMake version: 3.26.3
GCC: GNU compile
Hello developers,
I encountered a linker error while building Metabuli from source:
Steps to reproduce
Observations
Suggested fix
int fastq_validate_entry(FASTQ_FILE* fd, FASTQ_ENTRY* e);Environment
OS: Ubuntu 20.04
GPU: Quadro RTX 4000 (CUDA 7.5)
CPU: Intel with AVX2/AVX512 support
CMake version: 3.26.3
GCC: GNU compile