-bash: opkg: command not found

Hello, I am new to the topic. I need a guide on what I should read.
From already thank you very much!!!
I am working with OpenWRT on Linux to then integrate it into a tp-link router

My goal is to compile a program (C language) using the libmosquitto.ssl library

I understand that I must install the libmosquittto-ssl package with the opkg command.

When I run opkg update it gives me an error
gaarenas@srv:~/openwrt$ opkg update
-bash:opkg:command not found

I can't find how to install OPKG on openwrt (on a Linux PC).

I look forward to any help.
From already thank you very much!!!
Greetings Gustavo

you can't.

if you're creating a new image, it's being cross compiled, the package (and source code) should be installed from the package repo of your Linux dist.

1 Like

Thanks for answering..
I am on Linux within the openWRT directory.
I need is to compile a C program using the following command.
gaarenas@srv:~/openwrt$ mipsel-openwrt-linux-gcc -o m m.c -llibmosquitto.h

The error is the following
/home/gaarenas/openwrt/staging_dir/toolchain-mipsel_24kc_gcc-12.3.0_musl/bin/../lib/gcc/mipsel-openwrt-linux-musl/12.3.0/../../../../ mipsel-openwrt-linux-musl/bin/ld: cannot find -llibmosquitto.h: No such file or directory
collect2: error: ld returned 1 exit status

I understand that the libmosquitto.h library needs to be installed
then I enter with
make menuconfig
I select the mosquitto libraries and then execute

opkg update

This is where I am with my problem.

Maybe I'm doing the steps wrong.

I am very thankfull for your help!!!

you need to distinguish between the end result and the source code/build environment.

opkg is used when your device is already running openwrt, something your Linux build host isn't.

https://openwrt.org/docs/guide-developer/toolchain/install-buildsystem
https://openwrt.org/docs/guide-developer/packages

Please use the search function, compiling programs with mosquitto has been asked several times before. A recent example with links to older posts is this.

1 Like