collect2: error: ld returned 1 exit status
arunkhattri opened this issue ยท 7 comments
Hi @arunkhattri, I had the same problem, I resolved changing the build command on Makefile, as follow:
libswe.so: $(SWEOBJ)
$(CC) -shared -o libswe.so $(SWEOBJ) -lm -ldl
I added the -lm -ldl
Hi @arunkhattri, I had the same problem, I resolved changing the build command on Makefile, as follow:
libswe.so: $(SWEOBJ) $(CC) -shared -o libswe.so $(SWEOBJ) -lm -ldlI added the
-lm -ldl
Great! We look forward to reviewing your pull request.
This helped, thanks.. After that, I had one more issue after running go run main.go
/tmp/go-build1130359442/b001/exe/main: error while loading shared libraries: libswe.so: cannot open shared object file: No such file or directory exit status 127
@hiteshpariyani Hi, you should copy the compiled library to your ld library path, it might help you https://stackoverflow.com/questions/480764/linux-error-while-loading-shared-libraries-cannot-open-shared-object-file-no-s
Thank you @elvishp2006 , that worked ๐
Just a suggestion, add that in your PR of updating readme
I am having trouble building it in WINDOWS, how do I do that?
It currently gives undefined: swephgo.UtcToJd
Was trying to install swepgo on Raspberry PI and got bunch of collect2 errors. Tried passing -lm -ldl for ldflags. Looks like the go compiler ignores LDFLAG if it is already specified in the source. cgo_helpers.go the flag is set to #cgo LDFLAGS: -lswe. I locally modified the source to include -lm and -ldl flags #cgo LDFLAGS: -lm -ldl -lswe. This resolved the linking error during