The undefined reference errors means that you gave it headers for rocksdb 
but you forgot to give it the corresponding library flag that starts with 
-l like  -lyour_rocksdb_library_name (I don't know what the rocksdb or go 
shim to rocksdb library you are using is called; you'll have to figure that 
out). For example to link the math library libm.so, you typically use the 
linker flag -lm (so the lib prefix part of the name gets replace with -l on 
the linker command line)

On Wednesday, June 28, 2023 at 4:30:57 PM UTC+1 Richard Whatever wrote:

> *Utilizing the c and c++ cross compiler, my first try on the go 
> build command is as follows:*
>
> *```*
>
> CGO_LDFLAGS="-L/opt/homebrew/Cellar/roc...@7.7.3/7.7.3/lib 
> -L/opt/homebrew/Cellar/zstd/1.5.5/lib -L/opt/homebrew/Cellar/lz4/1.9.4/lib 
> -L/opt/homebrew/Cellar/snappy/1.1.10/lib 
> -L/opt/homebrew/Cellar/zlib/1.2.13/lib 
> -L/opt/homebrew/cellar/musl-cross/0.9.9_1/libexec/lib" 
> CGO_CFLAGS="-I/opt/homebrew/cellar/roc...@7.7.3/7.7.3/include" 
> CGO_ENABLED=1 GOOS=linux  GOARCH=amd64 CC=x86_64-linux-musl-gcc 
> CXX=x86_64-linux-musl-g++ go build -o yeeeeeeeeet
>
> ```
>
>
> *Ideally, this should work, but my terminal once again yells at me*
>
>
> -link-2821846975/000054.o: in function 
> `gorocksdb_comparator_with_ts_create':
>
> grocksdb.c:(.text+0x88): undefined reference to 
> `rocksdb_comparator_with_ts_create'
>
> /opt/homebrew/Cellar/musl-cross/0.9.9_1/libexec/bin/../lib/gcc/x86_64-linux-musl/9.2.0/../../../../x86_64-linux-musl/bin/ld:
>  
> /var/folders/85/7xzvr1n56wnbx8tj6h38drq80000gn/T/go-link-2821846975/000054.o: 
> in function `gorocksdb_compactionfilter_create':
>
> grocksdb.c:(.text+0xbe): undefined reference to 
> `rocksdb_compactionfilter_create'
>
> /opt/homebrew/Cellar/musl-cross/0.9.9_1/libexec/bin/../lib/gcc/x86_64-linux-musl/9.2.0/../../../../x86_64-linux-musl/bin/ld:
>  
> /var/folders/85/7xzvr1n56wnbx8tj6h38drq80000gn/T/go-link-2821846975/000054.o: 
> in function `gorocksdb_mergeoperator_create':
>
> grocksdb.c:(.text+0x104): undefined reference to 
> `rocksdb_mergeoperator_create'
>
> /opt/homebrew/Cellar/musl-cross/0.9.9_1/libexec/bin/../lib/gcc/x86_64-linux-musl/9.2.0/../../../../x86_64-linux-musl/bin/ld:
>  
> /var/folders/85/7xzvr1n56wnbx8tj6h38drq80000gn/T/go-link-2821846975/000054.o: 
> in function `gorocksdb_slicetransform_create':
>
> grocksdb.c:(.text+0x16d): undefined reference to 
> `rocksdb_slicetransform_create'
>
> collect2: error: ld returned 1 exit status
>
>
> *Being spammed of those countless undefined reference errors, I think 
> there must have been something wrong with my go build configurations, by 
> looking and half-guessing at *
> *https://stackoverflow.com/questions/62158905/undefined-references-to-symbols-in-standard-libraries-with-musl-cross-make*
>  
> <https://github.com/FiloSottile/homebrew-musl-cross/issues/url>* , I 
> changed my go build command as follows:*
>
>
> CGO_LDFLAGS="-L/opt/homebrew/Cellar/roc...@7.7.3/7.7.3/lib 
> -L/opt/homebrew/Cellar/zstd/1.5.5/lib -L/opt/homebrew/Cellar/lz4/1.9.4/lib 
> -L/opt/homebrew/Cellar/snappy/1.1.10/lib 
> -L/opt/homebrew/Cellar/zlib/1.2.13/lib 
> -L/opt/homebrew/cellar/musl-cross/0.9.9_1/libexec/lib" 
> CGO_CFLAGS="-I/opt/homebrew/cellar/roc...@7.7.3/7.7.3/include" 
> CGO_ENABLED=1 GOOS=linux  GOARCH=amd64 CC=x86_64-linux-musl-gcc 
> CXX=x86_64-linux-musl-g++ go build -o yeeeeeeeeet
>
>
> *Yet the same error occurs.*
>
> *I think there must have been something extremely simple and outright on 
> the surface, right below my nose, that somehow I've just managed to unsee, 
> yet I can't figure out what and how. Partly because my familiarity with C 
> is not competent enough. And that's why I'm now humbly asking for any 
> assistance that can help me get this over with.*
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/97a52ede-db01-4026-bc7b-2ee2ea26ae7dn%40googlegroups.com.

Reply via email to