OpenWrt 18.06 cannot compile my project with depends libmysqlclient

Hello,
Can anyone help me?
I can't compile my project for Mikrotik device (but in LEDE 17.01 is no problem).
Errors while compiling:

/home/riso/openwrt18.06/staging_dir/toolchain-mips_24kc_gcc-7.3.0_musl/lib/gcc/mips-openwrt-linux-musl/7.3.0/../../../../mips-openwrt-linux-musl/bin/ld: cannot find -luClibc++
collect2: error: ld returned 1 exit status
Makefile:30: recipe for target '/home/riso/openwrt18.06/build_dir/target-mips_24kc_musl//.built' failed
make[3]: *** [/home/riso/openwrt18.06/build_dir/target-mips_24kc_musl//.built] Error 1
make[3]: Leaving directory '/home/riso/openwrt18.06/package/marcon'
time: package/marcon/compile#1.31#0.05#1.32
package/Makefile:107: recipe for target 'package/marcon/compile' failed
make[2]: *** [package/marcon/compile] Error 2
make[2]: Leaving directory '/home/riso/openwrt18.06'
package/Makefile:103: recipe for target '/home/riso/openwrt18.06/staging_dir/target-mips_24kc_musl/stamp/.package_compile' failed
make[1]: *** [/home/riso/openwrt18.06/staging_dir/target-mips_24kc_musl/stamp/.package_compile] Error 2
make[1]: Leaving directory '/home/riso/openwrt18.06'
/home/riso/openwrt18.06/include/toplevel.mk:216: recipe for target 'world' failed
make: *** [world] Error 2

My Makefile:

include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/nls.mk

PKG_NAME:=marcontrol
PKG_RELEASE:=1
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)

define Package/marcontrol
	SECTION:=utils
	CATEGORY:=Utilities
	TITLE:=MaR Technology s.r.o. Control system
	MAINTAINER:=Richard Neuwirth <neuwirth@martechnology.cz>
	DEPENDS:=+libmodbus +libmysqlclient +libpthread +libconfig
endef

define Build/Prepare
	mkdir -p $(PKG_BUILD_DIR)
endef

define Build/Compile
	$(TARGET_CC) $(TARGET_CFLAGS) $(TARGET_LDFLAGS) -luClibc++ -o $(PKG_BUILD_DIR)/marcon marcon.cpp -lpthread `pkg-config --cflags --libs libmodbus` `pkg-config --cflags --libs libconfig` `mysql_config --cflags --libs`
endef

define Package/marcontrol/install
	$(INSTALL_DIR) $(1)/bin
	$(INSTALL_BIN) $(PKG_BUILD_DIR)/marcon $(1)/bin/
endef

$(eval $(call BuildPackage,marcontrol))

What I doing wrong?

Not a standard library -- needs to be a dependency

Side note: The preformatted-text button </> makes terminal output a lot easier to read.

1 Like

Is there some "standard" library alternative?

“Standard” meaning not always available without requesting it. C++ libraries aren’t installed by default, due to space constraints.

https://openwrt.org/packages/pkgdata/libstdcpp

This works for me when needing to run a C/C++ binary on OpenWrt.

1 Like

You probably need to add +uclibcxx to the DEPENDS:= line of your makefile. It is possible that one of the libraries you depend on implicitly pulled in libuClibc++ in the past but does not do so anymore.

Assuming that libstdc++ is all that is required by your program, it should be enough to simply remove the explicit -luClibc++ linkage from your Build/Compile line.

3 Likes

Adding +uclibcxx into DEPENDS solve this problem, thank you for your help guys...

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.