Uploaded image for project: 'Couchbase Server'
  1. Couchbase Server
  2. MB-28764

indexer won't compile when there's a incompatible system-wide jemalloc installed

    XMLWordPrintable

Details

    • Bug
    • Resolution: Won't Fix
    • Major
    • feature-backlog
    • master, 5.5.0
    • build
    • None
    • Untriaged
    • Unknown

    Description

      I have jemalloc installed system-wide without the je_ prefix. When I try to compile indexer it fails as follows:

      gcc -I . -fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK=/tmp/go-build -gno-record-gcc-switches -o $WORK/github.com/couchbase/nitro/mm/_obj/_cgo_.o $WORK/github.com/couchbase/nitro/mm/_obj/_cgo_main.o $WORK/github.com/couchbase/nitro/mm/_obj/_cgo_export.o $WORK/github.com/couchbase/nitro/mm/_obj/build.cgo2.o $WORK/github.com/couchbase/nitro/mm/_obj/malloc.cgo2.o $WORK/github.com/couchbase/nitro/mm/_obj/malloc.o -L /home/shaleny/dev/membase/repo-master/build/forestdb -L /home/shaleny/dev/membase/repo-master/build/sigar/src -L /home/shaleny/dev/membase/repo-master/build/platform -L /usr/lib -L /home/shaleny/dev/membase/repo-master/install/lib -ljemalloc
       
      # github.com/couchbase/nitro/mm
      /tmp/go-build761750868/github.com/couchbase/nitro/mm/_obj/malloc.o: In function `doStats':
      ../../../../../../goproj/src/github.com/couchbase/nitro/mm/malloc.c:36: undefined reference to `je_malloc_stats_print'
      /tmp/go-build761750868/github.com/couchbase/nitro/mm/_obj/malloc.o: In function `mm_size':
      ../../../../../../goproj/src/github.com/couchbase/nitro/mm/malloc.c:82: undefined reference to `je_mallctl'
      ../../../../../../goproj/src/github.com/couchbase/nitro/mm/malloc.c:84: undefined reference to `je_mallctl'
      /tmp/go-build761750868/github.com/couchbase/nitro/mm/_obj/malloc.o: In function `mm_free2os':
      ../../../../../../goproj/src/github.com/couchbase/nitro/mm/malloc.c:96: undefined reference to `je_mallctl'
      ../../../../../../goproj/src/github.com/couchbase/nitro/mm/malloc.c:98: undefined reference to `je_mallctl'
      /tmp/go-build761750868/github.com/couchbase/nitro/mm/_obj/malloc.o: In function `mm_malloc':
      ../../../../../../goproj/src/github.com/couchbase/nitro/mm/malloc.c:45: undefined reference to `je_malloc'
      /tmp/go-build761750868/github.com/couchbase/nitro/mm/_obj/malloc.o: In function `mm_free':
      ../../../../../../goproj/src/github.com/couchbase/nitro/mm/malloc.c:53: undefined reference to `je_free'
      /tmp/go-build761750868/github.com/couchbase/nitro/mm/_obj/malloc.o: In function `mm_sizeat':
      ../../../../../../goproj/src/github.com/couchbase/nitro/mm/malloc.c:69: undefined reference to `je_sallocx'
      collect2: error: ld returned 1 exit status
      

      As seen, simply -ljemalloc is passed to gcc, which means that it will use the library found in standard global library paths over the one installed in $PREFIX/install/lib. We should path the full path to jemalloc here and also set the rpath instead.

      Note, I do see this in go-install.cmake:

      # QQQ TOTAL HACK to enable CGO binaries to find Couchbase-built shared
      # libraries.  This will clearly only work on Linux ELF-based systems,
      # and only for those libraries which are installed in the correct path
      # relative to the installed location of the Go executable. I'm still
      # trying to figure out how to handle this correctly.
      SET (ENV{LD_RUN_PATH} "$ORIGIN/../lib")
      

      So this sort of works at run-time.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            ceej Chris Hillery
            Aliaksey Artamonau Aliaksey Artamonau (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty