ryanlayer/giggle

Compiling issue

kearseya opened this issue · 3 comments

It appears that something is wrong with compiling steps of giggle, many /usr/bin/ld: ../obj/leaf.o:(.bss+0xe0): multiple definition of 'cache'; /tmp/ccMqGR06.o:(.bss+0x2c0): first defined here type errors.

Output of make in src:
before.log

When prefixing the LEAF_* variables with static they are removed from the multiple definition of error:

leaf.c:

static uint64_t LEAF_POINTERS_SIZE = sizeof(uint32_t);
static uint64_t LEAF_NUMS_SIZE = sizeof(uint64_t);
static uint64_t LEAF_LEADING_STARTS_ENDS_SIZE = sizeof(uint64_t);

leaf.h:

static uint64_t LEAF_POINTERS_SIZE;
static uint64_t LEAF_NUMS_SIZE;
static uint64_t LEAF_LEADING_STARTS_ENDS_SIZE;

make now outputs:
after.log

The only edits to the makefile were to use the system htslib instead of the included one and include the lzma and bz2 libraries.
src/Makefile:

BIN=../bin
OBJ=../obj
LIBD=../lib
#HTS_ROOT=$(LIBD)/htslib
HTS_ROOT=/usr/local/include/htslib/
LIBMHD_INCLUDES=$(HOME)/usr/local/include
LIBMHD_LIBS=$(HOME)/usr/local/lib
CFLAGS=-O2 -D_FILE_OFFSET_BITS=64 -Werror -Wuninitialized
#CFLAGS=-g -D_FILE_OFFSET_BITS=64 -Werror -Wuninitialized
CFLAGS+=-DBLOCK_STORE 
INCLUDES=-I$(HTS_ROOT)
LIBS=-ldl -lz -lm -pthread -lcurl -llzma -lbz2 -lhts
LIBS+=-lcrypto
CC=gcc


LIB=bpt.o \
    disk_file_header.o \
    disk_store.o \
    zlib_wrapper.o \
    fastlz_wrapper.o \
    cache.o \
    data_reg.o \
    file_read.o \
    giggle_index.o \
    lists.o \
    ll.o \
    util.o \
    timer.o \
    wah.o \
    kfunc.o \
    index.o \
    offset_index.o \
    search.o \
    leaf.o \
    pq.o \
    jsw_avltree.o \
    fastlz.o


.SUFFIXES:

OBJS=$(addprefix $(OBJ)/, $(LIB))

.SECONDARY: $(OBJS)


PROG=giggle \
     api_test \
     offset_idx_lookup

LIST=$(addprefix $(BIN)/, $(PROG))


all: check-env $(LIST) library

server: INCLUDES+=-I$(LIBMHD_INCLUDES) -L$(LIBMHD_LIBS)
server: LIBS+=-lmicrohttpd 
server: $(BIN)/server_enrichment

library: $(OBJS)
	ar -cvq $(LIBD)/libgiggle.a $(OBJS)

$(OBJ)/%.o: %.c 
	$(CC) -c -Wno-unused-variable $(CFLAGS) -o $@ $< \
		-I$(HTS_ROOT) -lhts


$(BIN)/%: %.c $(OBJS)
	$(CC) $(CFLAGS) -o $@ $^ \
		$(INCLUDES) \
		-DSAMTOOLS=1 \
		/usr/local/lib/libhts.a \
		$(LIBS)


check-env:
ifdef TRAVIS_BUILD_DIR
HTS_ROOT=$(TRAVIS_BUILD_DIR)/htslib
endif

gcc version:

Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/11/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 11.2.0-19ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-11/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-11 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-11-gBFGDP/gcc-11-11.2.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-11-gBFGDP/gcc-11-11.2.0/debian/tmp-gcn/usr --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-serialization=2
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.2.0 (Ubuntu 11.2.0-19ubuntu1) 

I have the same problem, could you fix the error?

I noticed this error in this version of gcc. We haven't pinpointed the reason why its occurring, but in the meantime I've created a singularity container that uses versions of the dependencies that don't cause any issues. You can find it in my comment in #68

I'm going to go ahead and close this issue. Feel free to open it back up if the singularity approach doesn't work for you.