[SOLVED] Developing a new package that depends on another OpenWrt package

#1

I am a beginner in developing software for OpenWRT. I have done "Hello, world!" successfully.

I have wrote a simple MQTT client using libmosquitto library and it works well on my Linux PC.

Then I tried to make the code as a package for OpenWRT (like "Hello, world!" example).

I have encountered a lot of problems.

Mainly because the tool chain does not see libmosquitto.

How can I add a package (like libmosquitto-ssl) to the build environment in order to be seen by tool chain?

Any idea, What I have to do in a situation like this ?

0 Likes

#2

I'm not at my main build machine right now, but I'm fairly certain OpenWRT has mosquitto available as a package option.

You might simply need to add that package to the DEPENDS for your package.

0 Likes

#3

Suggested reading:

0 Likes

#4

The problem is SOLVED.

Through this thread: [probably solved] How to build on debian 9? Missing libpam, libgnutls,

And by adding this option:
-lmosquitto
at the end of the second line of Package build instructions (Build/Compile) section in Makefile, like that:

$(TARGET_CC) $(TARGET_LDFLAGS) -o $(PKG_BUILD_DIR)/$1 $(PKG_BUILD_DIR)/mynewpackage.o -lmosquitto

Thanks,

0 Likes

#5

You probably still need to update DEPENDS to ensure that mosquitto is always selected AND is built before your package.

Otherwise whether your package succesfully builds or not will not be deterministic.

0 Likes

#6

I have missed to mention adding DEPENDS in Makefile.

I have added

DEPENDS:= +libmosquitto-ssl

In Package definition section in Makefile

Excuse me Andy Dodd (Entropy512),

0 Likes

#7

yup, that should take care of it. :slight_smile:

0 Likes