Re: [go-nuts] sudo ./main command throwing error

2019-06-25 Thread Kurtis Rader
That means your "sudo" configuration doesn't allow the use of the `-E`
flag; at least in that specific use case. Alternatively, your system
doesn't preserve the value of `LD_LIBRARY_PATH` when the shell is invoked
via `sudo -E` because the shell's startup scripts clobber that var.

I hope you recognize this isn't a Go issue. You'll need to figure out how
to configure "sudo" on your system to meet your requirements and/or modify
the bash startup scripts for the root account not overwrite the value of
`LD_LIBRARY_PATH`.

On Mon, Jun 24, 2019 at 11:06 PM Nitish Saboo 
wrote:

> Looks like it is still not preserving the env variable:
>
> nsaboo@ubuntu:~/Documents/goworkspace/src/poc$ export
> LD_LIBRARY_PATH=/usr/local/lib/syslog-ng
> nsaboo@ubuntu:~/Documents/goworkspace/src/poc$ sudo -E bash -c 'echo
> $LD_LIBRARY_PATH'
>
> nsaboo@ubuntu:~/Documents/goworkspace/src/poc$ echo $LD_LIBRARY_PATH
> /usr/local/lib/syslog-ng
> nsaboo@ubuntu:~/Documents/goworkspace/src/poc$
>

-- 
Kurtis Rader
Caretaker of the exceptional canines Junior and Hank

-- 
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/CABx2%3DD_4UC%3DWVK%3DVEka390%3D%2BQDqCrHXQ%2BtxrAm07OYJUMjNpAQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] sudo ./main command throwing error

2019-06-25 Thread Nitish Saboo
HI Michael,

Looks like it is still not preserving the env variable:

nsaboo@ubuntu:~/Documents/goworkspace/src/poc$ export
LD_LIBRARY_PATH=/usr/local/lib/syslog-ng
nsaboo@ubuntu:~/Documents/goworkspace/src/poc$ sudo -E bash -c 'echo
$LD_LIBRARY_PATH'

nsaboo@ubuntu:~/Documents/goworkspace/src/poc$ echo $LD_LIBRARY_PATH
/usr/local/lib/syslog-ng
nsaboo@ubuntu:~/Documents/goworkspace/src/poc$

Thanks,
Nitish

On Mon, Jun 24, 2019 at 11:45 PM Michael Anderson 
wrote:

> You could try:
>
> sudo -E bash -c 'echo $LD_LIBRARY_PATH'
>
> The -E is --preserve-env
>
>
> On 6/24/19 12:32 PM, Marcin Romaszewicz wrote:
>
> sudo echo $LD_LIBRARY_PATH
>
> --
> 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/b14d6f43-6b3f-6bb7-691f-af9978d65054%40gmail.com
> 
> .
> 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/CALjMrq5io9pM8gDEgHmsJ0BN0RqwvvRALaV%2Bom4mPZ-AAYFqfw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] sudo ./main command throwing error

2019-06-24 Thread Michael Anderson

You could try:

sudo -E bash -c 'echo $LD_LIBRARY_PATH'

The -E is --preserve-env


On 6/24/19 12:32 PM, Marcin Romaszewicz wrote:

sudo echo $LD_LIBRARY_PATH


--
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/b14d6f43-6b3f-6bb7-691f-af9978d65054%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] sudo ./main command throwing error

2019-06-24 Thread 'Michael Stiller' via golang-nuts
Hi,

i think sudo kills the LD_LIBRARY_PATH variable. 

But this is configurable, try something like:

Defaultsenv_keep += “LD_LIBRARY_PATH"

in /etc/sudoers and / or consult the sudo man page.

Best regards,

Michael


> On 24. Jun 2019, at 18:48, Nitish Saboo  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.
> For more options, visit https://groups.google.com/d/optout.

-- 
2scale GmbH, Schanzenstr. 20, 40549 Düsseldorf
Amtsgericht:Düsseldorf HRB 50718
Geschäftsführer:Georg von Zezschwitz, Dirk Vleugels
USt-IdNr.:  DE 210936505





-- 
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/E4EFBEC1-40E7-452F-B2BC-68BECE7C7AA0%402scale.net.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] sudo ./main command throwing error

2019-06-24 Thread Marcin Romaszewicz
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 
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
> 
> .
> 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.


[go-nuts] sudo ./main command throwing error

2019-06-24 Thread Nitish Saboo
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.
For more options, visit https://groups.google.com/d/optout.