On Tue, Mar 17, 2020 at 9:04 AM <mmahmoud2...@gmail.com> wrote: > > I have created swigcxx file , since swig now is natively integrated in go > tools > I ran the following to build a test program that interact with the mabain > wrapper go package to test the APIs > > go install -x -i -ldflags '-w -extldflags "-lmabain"' > > > However I ran into linker errors that I am not able to resolve > > > # mabain > > /tmp/go-build378478658/b001/_x003.o: In function `mbOpen': > > ./mabain_c_interface.cpp:10: undefined reference to > `mabain::CONSTS::ReaderOptions()' > > ./mabain_c_interface.cpp:12: undefined reference to `mabain::DB::DB(char > const*, int, unsigned long, unsigned long, unsigned int)' > > ./mabain_c_interface.cpp:13: undefined reference to `mabain::DB::is_open() > const' > > ./mabain_c_interface.cpp:14: undefined reference to `mabain::DB::StatusStr() > const' > > ./mabain_c_interface.cpp:11: undefined reference to > `mabain::CONSTS::WriterOptions()' > > /tmp/go-build378478658/b001/_x003.o: In function `mbFind': > > ./mabain_c_interface.cpp:44: undefined reference to `mabain::MBData::MBData()' > > ./mabain_c_interface.cpp:45: undefined reference to `mabain::DB::Find(char > const*, int, mabain::MBData&) const' > > ./mabain_c_interface.cpp:44: undefined reference to > `mabain::MBData::~MBData()' > > ./mabain_c_interface.cpp:44: undefined reference to > `mabain::MBData::~MBData()' > > /tmp/go-build378478658/b001/_x003.o: In function `mbClose': > > ./mabain_c_interface.cpp:23: undefined reference to `mabain::DB::Close()' > > /tmp/go-build378478658/b001/_x003.o: In function `mbAdd': > > ./mabain_c_interface.cpp:30: undefined reference to `mabain::DB::Add(char > const*, int, char const*, int, bool)' > > /tmp/go-build378478658/b001/_x003.o: In function `mbRemove': > > ./mabain_c_interface.cpp:37: undefined reference to `mabain::DB::Remove(char > const*, int)' > > collect2: error: ld returned 1 exit status > > > > root@e75d907ebd87:/usr/local/lib# ls -ltr > > total 1844 > > -rwxr-xr-x 1 root root 1887608 Mar 17 11:42 libmabain.so > > root@e75d907ebd87:/usr/local/lib# > > > > root@e75d907ebd87:/usr/local/lib# objdump -t libmabain.so | grep ReaderOption > > 0000000000022b60 g F .text 0000000000000003 > _ZN6mabain6CONSTS13ReaderOptionsEv > > > Any suggestions on how to fix this linker error ?
I don't see anything obviously wrong. Add -v to -ldflags to see exactly how the external linker is being invoked. Make sure that -lmabain appears at the right point in the link line. Ian -- 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/CAOyqgcWhbQJZ8tqT4LrOe2sR%3DUdfJXDos15r27R-VgpB3%2BfB8w%40mail.gmail.com.