KueWW
June 20, 2020, 8:58am
1
Hi there,
I'm trying to create a MQTT client basing on libmosquitto.
On my debian it builds an runs very well.
Now I try to make it run on openWRT.
I'm not able to build the application for the target.
It's very frustrating and I don't have any ideas.
Maybe I'm too blind to see.
Here are my ENV settings:
export STAGING_DIR=/"home/user/Source/git/sks/openWRT/openwrt/staging_dir"
export TOOLCHAIN_DIR="$STAGING_DIR/toolchain-mips_24kc_gcc-7.5.0_musl"
export TARGET_DIR="$STAGING_DIR/target-mips_24kc_musl"
export LDCFLAGS="-L$TARGET_DIR/usr/lib"
export LDFLAGS="-L$TARGET_DIR/usr/lib"
export LD_LIBRARY_PATH="$TARGET_DIR/usr/lib"
export PATH="$STAGING_DIR/bin:$PATH"
export CPATH="$TARGET_DIR/usr/include"
export CFLAGS="-I$TARGET_DIR/usr/include"
export LIBRARY_PATH="$TARGET_DIR/usr/lib"
The gcc directive is:
mips-openwrt-linux-musl-gcc-7.5.0 -o mqtt-client main.c client.c Application.c SignalHandling.c -lmosquitto
The output is:
/home/user/Source/git/sks/openWRT/openwrt/staging_dir/toolchain-mips_24kc_gcc-7.5.0_musl/lib/gcc/mips-openwrt-linux-musl/7.5.0/../../../../mips-openwrt-linux-musl/bin/ld: cannot find -lmosquitto
collect2: error: ld returned 1 exit status
This is the mosquitto content of $TARGET_DIR/usr/lib
:
So I think that
-lmosquitto
should be availiable.
I'm trying for days now and I don't have any ideas anymore.
Is there somebody out there who can give some inspiration?
thanks in advance.....
KueWW
July 13, 2020, 1:09pm
2
Hi there,
I've got it solved.
The problem was to create the right Makefile to include the compiled application binary into the image.
The problem of cross compiling the code was to set up the environment well and to choose the right target compiler.
Setting up the environmaent is:
#!/bin/sh
# Set up paths and environment for cross compiling for openwrt
export STAGING_DIR="$(pwd)/staging_dir"
export TOOLCHAIN_DIR="$STAGING_DIR/toolchain-mips_24kc_gcc-7.5.0_musl"
export TARGET_DIR="$STAGING_DIR/target-mips_24kc_musl"
export LDCFLAGS="-L$TARGET_DIR/usr/lib"
export LDFLAGS="-L$TARGET_DIR/usr/lib"
export LD_LIBRARY_PATH="$TARGET_DIR/usr/lib"
export CPATH="$TARGET_DIR/usr/include"
export CFLAGS="-I$TARGET_DIR/usr/include"
export LIBRARY_PATH="$TARGET_DIR/usr/lib"
export PATH="$PATH:$TOOLCHAIN_DIR/bin"
The compiling command is:
mips-openwrt-linux-musl-gcc -o mqtt-client -L/home/user_build/project/openWRT/staging_dir/target-mips_24kc_musl/usr/lib main.c ....... -lmosquitto
tmomas
July 13, 2020, 2:31pm
3
If your problem is solved, please consider marking this topic as [Solved]. See How to mark a topic as [Solved] for a short how-to.
KueWW
July 22, 2020, 9:36am
4
Hi,
I'm sorry but it doesn't work!
On clicking the pencil I just get the history.
What am I doing wrong?
Am I to late?
system
Closed
August 1, 2020, 9:36am
5
This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.