NVISOsecurity / IOXY

MQTT intercepting proxy
GNU General Public License v3.0
132 stars 20 forks source link

another error on go build in kali #8

Closed SecJoe closed 2 years ago

SecJoe commented 2 years ago

while using "go build ." kali throws the following error:

# github.com/mattn/go-sqlite3
sqlite3-binding.c: In function ‘sqlite3SelectNew’:
sqlite3-binding.c:128049:10: warning: function may return address of local variable [-Wreturn-local-addr]
128049 |   return pNew;
       |          ^~~~
sqlite3-binding.c:128009:10: note: declared here
128009 |   Select standin;
       |          ^~~~~~~
# github.com/NVISOsecurity/IOXY/ioxy
/usr/bin/ld: $WORK/b001/_pkg1_.a(_x011.o): undefined reference to symbol 'pthread_mutexattr_settype@@GLIBC_2.2.5'
/usr/bin/ld: /lib/x86_64-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
alt3kx commented 2 years ago

Same here error on kali , any update ?

hutchYy commented 2 years ago

Hey guys!

Can you try to compile using the following command:

go build -gccgoflags="-lpthread"

If it still doesn't work can you please give me the version of your Kali? lsb_release -a

Have a nice day! hutchYy

alt3kx commented 2 years ago

FYI @hutchYy same error

$ lsb_release -a                      
No LSB modules are available.
Distributor ID: Kali
Description:    Kali GNU/Linux Rolling
Release:    2022.1
Codename:   kali-rolling
hutchYy commented 2 years ago

Thanks! We will have a look at the issue 🙃

hutchYy commented 2 years ago

Hey guys,

Just found out the issue, it is trying to compile using the gccgo-go when it should use golang-go.

To fix your issue:

  1. Uninstall gccgo-go (sudo apt --purge remove gccgo-go)
  2. Install golang-go (sudo apt install golang-go)
  3. Enjoy!

Have a nice day :) hutchYy

alt3kx commented 2 years ago

Btw not working below my workaround

$ sudo apt-get remove gccgo-go
$ sudo apt install golang-go 

$ go build -gccgoflags='-lpthread' 
go build: when using gc toolchain, please pass compile flags using -gcflags, and linker flags using -ldflags
# github.com/mattn/go-sqlite3
sqlite3-binding.c: In function ‘sqlite3SelectNew’:
sqlite3-binding.c:128049:10: warning: function may return address of local variable [-Wreturn-local-addr]
128049 |   return pNew;
       |          ^~~~
sqlite3-binding.c:128009:10: note: declared here
128009 |   Select standin;
       |          ^~~~~~~

$ sudo apt-get install golang-github-mattn-go-sqlite3-dev

$ export CGO_CFLAGS="-g -O2 -Wno-return-local-addr"

See this thread 
https://github.com/mattn/go-sqlite3/issues/803

$ go build -gccgoflags='-lpthread'

$  ./ioxy gui   
Log Level Set To : info
[2022-02-27 21:31:08.00]  INFO auth : no auth url configured : bypassing!
[2022-02-27 21:31:08.00]  INFO GUI listening on 0.0.0.0:1111
[2022-02-27 21:31:19.74]  INFO Starting the server
[2022-02-27 21:31:19.74]  INFO Starting ioxy
[2022-02-27 21:31:19.74]  INFO MiTM Broker Settings | Mode : - | Host : 0.0.0.0 | Port : 1883
[2022-02-27 21:31:19.74]  INFO Distant Broker Settings | Host : / | Port : 1883
[2022-02-27 21:31:19.74]  INFO Broker Misc | Payload Intercept : disabled
[2022-02-27 21:31:44.19]  INFO Server already started, status 1
[2022-02-27 21:31:46.33]  INFO Server already stopped, status 1
[2022-02-27 21:31:48.56]  INFO Server already stopped, status 1
hutchYy commented 2 years ago

Hey guys,

Just found out the issue, it is trying to compile using the gccgo-go when it should use golang-go.

To fix your issue:

  1. Uninstall gccgo-go (sudo apt --purge remove gccgo-go)

  2. Install golang-go (sudo apt install golang-go)

  3. Enjoy!

Have a nice day :)

hutchYy

Whoops forgot to mention that to build, you can just do go build . instead of adding specific flags and it should work out of the box.

Let me know if it works on your side with that technique 😊

Btw, I tested it this morning on a fresh install ✌️

alt3kx commented 2 years ago

Yep remove and clone again the git repo it works , thanks for your feedback @hutchYy

FlyingDomotic commented 2 years ago

Same on Buster on RPi 4