Hello,
I have problem with make your newest openwrt with my project.
I clone main development tree to local disk and make it without problems for Mikrotik device, but when I add my project (using libconfig, libmodbus, libmysqlclient) into packages, I got error: cannot find -liconv
I was try add libiconv in make menuconfig, but no success.
On LEDE and oldest openwrt works everything fine...
Hi there,
Just include nls.mk in your package's Makefile. See how "net/gnunet/Makefile" does it for example:
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/nls.mk
libmysqlclient (libmariadb, really) in trunk requires to be linked in together with libiconv. That's probably why you're seeing this.
Kind regards,
Seb
Thank you for reply.
I add include in my makefile, but still the same error.
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)
include $(INCLUDE_DIR)/package.mk
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) -o $(PKG_BUILD_DIR)/marcon marcon.c -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))
Wrong order.
You have two times included package.mk, so the later one overrides the changes from nls.mk
The order of the include directives has significance.
And I think that you have the first package include plus the nls include too early in the makefile.
What @hnyman says and probably you're also missing $(TARGET_LDFLAGS). nls.mk changes them to help the linker find the correct lib (iconv).
I think you're missing TARGET_LDFLAGS, which gets also redefined in nls.mk. Try adding them after the other flags you have.
Ups, yes, there was include $(INCLUDE_DIR)/package.mk
two times, but still the same error...
With adding TARGET_LDFLAGS you thinking this:
include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/nls.mk
include $(TARGET_LDFLAGS)/nls.mk
?
but there is output:
make[3]: Entering directory '/home/riso/openwrt/package/marcontrol'
Makefile:4: -L/home/riso/openwrt/staging_dir/target-mips_24kc_musl/usr/lib: No such file or directory
Makefile:4: -L/home/riso/openwrt/staging_dir/target-mips_24kc_musl/lib: No such file or directory
Makefile:4: -L/home/riso/openwrt/staging_dir/toolchain-mips_24kc_gcc-7.3.0_musl/usr/lib: No such file or directory
Makefile:4: -L/home/riso/openwrt/staging_dir/toolchain-mips_24kc_gcc-7.3.0_musl/lib: No such file or directory
Makefile:4: -znow: No such file or directory
Makefile:4: -zrelro: No such file or directory
Makefile:4: -L/home/riso/openwrt/staging_dir/target-mips_24kc_musl/usr/lib/libiconv-stub/lib: No such file or directory
Makefile:4: -Wl,-rpath-link=/home/riso/openwrt/staging_dir/target-mips_24kc_musl/usr/lib/libiconv-stub/lib: No such file or directory
Makefile:4: -L/home/riso/openwrt/staging_dir/target-mips_24kc_musl/usr/lib/libintl-stub/lib: No such file or directory
Makefile:4: -Wl,-rpath-link=/home/riso/openwrt/staging_dir/target-mips_24kc_musl/usr/lib/libintl-stub/lib/nls.mk: No such file or directory
make[3]: *** No rule to make target '-Wl,-rpath-link=/home/riso/openwrt/staging_dir/target-mips_24kc_musl/usr/lib/libintl-stub/lib/nls.mk'. Stop.
make[3]: Leaving directory '/home/riso/openwrt/package/marcontrol'
time: package/marcontrol/compile#0.05#0.02#0.06
package/Makefile:107: recipe for target 'package/marcontrol/compile' failed
make[2]: *** [package/marcontrol/compile] Error 2
make[2]: Leaving directory '/home/riso/openwrt'
package/Makefile:103: recipe for target '/home/riso/openwrt/staging_dir/target-mips_24kc_musl/stamp/.package_compile' failed
make[1]: *** [/home/riso/openwrt/staging_dir/target-mips_24kc_musl/stamp/.package_compile] Error 2
make[1]: Leaving directory '/home/riso/openwrt'
/home/riso/openwrt/include/toplevel.mk:216: recipe for target 'world' failed
make: *** [world] Error 2
still no success
No
I mean this:
define Build/Compile
$(TARGET_CC) $(TARGET_CFLAGS) $(TARGET_LDFLAGS) -o $(PKG_BUILD_DIR)/marcon marcon.c -lpthread `pkg-config --cflags --libs libmodbus` `pkg-config --cflags --libs libconfig` `mysql_config --cflags --libs`
endef
BINGO, success, thank you very much
If your problem is solved, please consider marking this topic as [Solved]. (Click the pencil behind the topic...)
You can also mark the reply that solved your problem:
This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.