OpenWrt Forum Archive

Topic: Issue in new application

The content of this topic has been archived on 27 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

barrier_breaker/staging_dir/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/lib/gcc/mipsel-openwrt-linux-uclibc/4.8.3/../../../../mipsel-openwrt-linux-uclibc/bin/ld: skipping incompatible /lib/x86_64-linux-gnu/libpthread.so.0 when searching for /lib/x86_64-linux-gnu/libpthread.so.0
barrier_breaker/staging_dir/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/lib/gcc/mipsel-openwrt-linux-uclibc/4.8.3/../../../../mipsel-openwrt-linux-uclibc/bin/ld: cannot find /lib/x86_64-linux-gnu/libpthread.so.0
barrier_breaker/staging_dir/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/lib/gcc/mipsel-openwrt-linux-uclibc/4.8.3/../../../../mipsel-openwrt-linux-uclibc/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libpthread_nonshared.a when searching for /usr/lib/x86_64-linux-gnu/libpthread_nonshared.a
barrier_breaker/staging_dir/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/lib/gcc/mipsel-openwrt-linux-uclibc/4.8.3/../../../../mipsel-openwrt-linux-uclibc/bin/ld: cannot find /usr/lib/x86_64-linux-gnu/libpthread_nonshared.a


i receive this whiel compile an applcation having pthreads. this compile properly in PC but not able to compile in openwrt.

below is my make file for a[pplication
.SUFFIXES: .tar.gz .c
overrides CFLAGS += -Wall -O0 -g
xxx:xxx.c -lpthread
PKG_RELEASE:=1
PKG_VERSION:=0
all:xxx xxx.tar.gz
%.tar.gz: DIR=$(subst .tar.gz,,$@)
%.tar.gz: %.c
    mkdir -p ./$(DIR)-$(PKG_VERSION).$(PKG_RELEASE)
    cp $^ Makefile ./$(DIR)-$(PKG_VERSION).$(PKG_RELEASE)
    tar -cz -f $@ ./$(DIR)-$(PKG_VERSION).$(PKG_RELEASE)
    cp ./xxx.tar.gz ./barrier_breaker/dl/
clean:
    rm -rf *.tar* xxx *~
********************
and here is the makefile for openwrt
include $(TOPDIR)/rules.mk
PKG_NAME:=xxx
PKG_RELEASE:=1
PKG_VERSION:=0
PKG_BUILD_DIR := $(PKG_NAME)-$(PKG_VERSION).$(PKG_RELEASE)
PKG_SOURCE:=$(PKG_NAME).tar.gz
PKG_PATH:=Some custom path
PKG_SOURCE_URL:=file://$(PKG_PATH)/
include $(INCLUDE_DIR)/package.mk

define Package/$(PKG_NAME)
  SECTION:=utils
  CATEGORY:=Utilities
  TITLE:= Custom app with pthread
  DEPENDS:=+libpthread
endef
CONFIGURE_VARS+= \
    LIBS="-lpthread"
define Package/$(PKG_NAME)/description
This is a sample program for make
endef
define Package/$(PKG_NAME)/Build/Prepare
    mkdir -p $(PKG_BUILD_DIR)
    $(CP) ./* $(PKG_BUILD_DIR)/
endef
define Package/$(PKG_NAME)/Build/Configure
endef
define Package/$(PKG_NAME)/Build/Compile
    $(MAKE) -C $(PKG_BUILD_DIR) $(PKG_NAME)
endef
define Package/$(PKG_NAME)/install
   
    $(INSTALL_DIR) $(1)/usr/bin
    $(INSTALL_BIN) $(PKG_BUILD_DIR)/$(PKG_NAME) $(1)/usr/bin/
endef
$(eval $(call BuildPackage,$(PKG_NAME)))

**********************


Can anyone help me out with this .

(Last edited by vikaspshinde on 22 Jan 2015, 08:08)

Are you building for the x86_64 target?

my host is x86_64. my target for ramips

The build Makefile (not the package Makefile) needs to honor the environment variables fo CC, CFLAGS and LDFLAGS.
Otherwise you build for the wrong target (the host target).

The discussion might have continued from here.