sudo does not preserve environment variables for security reasons, run:

sudo echo $LD_LIBRARY_PATH

You'll likely see that it's empty, unless you have a global system one set.


On Mon, Jun 24, 2019 at 9:48 AM Nitish Saboo <nitish.sabo...@gmail.com>
wrote:

> Hi ,
>
> I am using cgo in this project where I need the following given .so files.
> After building the go code, I get the binary 'main'.
>
> ubuntu@hexint09-ingest-0693b91d:/opt/tap-parsing/bin$ ls -lrt
> total 17000
> -rwxr-xr-x 1 parsing parsing 17405424 Jun 24 11:14 main
>
> '.*/main' works fine whereas 'sudo ./main' throws the following error:*
>
>
> *ubuntu@hexint09-ingest-0693b91d:/opt/tap-parsing/bin$ sudo ./main./main:
> error while loading shared libraries: libsyslog-ng-3.6.so.0: cannot open
> shared object file: No such file or directory*
>
> Following is the LD_LIBRARY_PATH set to:
> --------------------------------------------------------------
> ubuntu@hexint09-ingest-0693b91d:/opt/tap-parsing/bin$ echo
> $LD_LIBRARY_PATH
>
>  
> /opt/tap-parsing/dep/syslog/syslog-ng-3.6.2/install/lib/syslog-ng:/opt/tap-parsing/dep/syslog/syslog-ng-3.6.2/install/lib
>
>
> ubuntu@hexint09-ingest-0693b91d:/opt/tap-parsing/bin$ *cd
> /opt/tap-parsing/dep/syslog/syslog-ng-3.6.2/install/lib/*
> ubuntu@hexint09-ingest-0693b91d
> :/opt/tap-parsing/dep/syslog/syslog-ng-3.6.2/install/lib$ *ls -lrt*
> total 2544
> -rwxr-xr-x 1 parsing parsing 861259 Jun 24 11:14 libsyslog-ng.so
> -rwxr-xr-x 1 parsing parsing   1405 Jun 24 11:14 libsyslog-ng.la
> -rwxr-xr-x 1 parsing parsing 861259 Jun 24 11:14 libsyslog-ng-3.6.so.0.0.0
> -rwxr-xr-x 1 parsing parsing 861259 Jun 24 11:14 libsyslog-ng-3.6.so.0
> drwxr-xr-x 2 parsing parsing   4096 Jun 24 11:25 pkgconfig
> drwxr-xr-x 3 parsing parsing   4096 Jun 24 11:25 syslog-ng
>
> Parsing user details:
> =================
>
> ubuntu@hexint09-ingest-0693b91d:~$ cat /etc/passwd | grep parsing
> parsing:x:1004:1006::/home/parsing:
>
> ubuntu@hexint09-ingest-0693b91d:~$ cat /etc/group | grep parsing
> parsing:x:1006:
>
>
> makefile:
> =======
>
> .PHONY: all clean
>
> all: main
>
> main:./lib/syslog-node.so main.go ./lib/syslog-node1.h
> go build -v -x main.go
>
> ./lib/syslog-node.so: ./lib/syslog-node.c ./lib/syslog-node1.h
> gcc -L/usr/local/lib -lsyslog-ng -o ./lib/syslog-node.so
> -L/usr/local/lib/syslog-ng -ldbparser -c `pkg-config --libs --cflags
> glib-2.0` -I/usr/local/include/syslog-ng/ -I./lib/syslog-ng-3.6.2/
> -I/usr/local/include/eventlog/ ./lib/syslog-node.c
>
> clean:
> rm main
> rm ./lib/syslog-node.so
>
>
> I understand I am missing a very small point here but couldn't just figure
> it out.
> Can someone please guide me here ?
>
>
> Thanks,
> Ntiish
>
> --
> 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/3cc0a8f8-8b39-4948-9084-55a0b6628399%40googlegroups.com
> <https://groups.google.com/d/msgid/golang-nuts/3cc0a8f8-8b39-4948-9084-55a0b6628399%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CA%2Bv29Lst4NXgMnmYdzJ9nNVwTWJ_sTS0UJGy4pwez5Qso%2BEj9A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to