OpenWrt Forum Archive

Topic: can't resolve symbol '__uClibc_start_main'

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

followed Gargoyle Wiki tutorial to compile a package. After getting the .ipk, installed on the linksysWRT54GL (Kamikaze8.09), run error message is as topic.

any help?

make V=99 #gives, this is the later retry output, didn't save the 1st compile message, it showed some dependent package missing...
-----------------------------------------------------------------------------------------------------------
user@ubuntu:~/OpenWrt-SDK-Linux-i686-1$ make V=99
make package/compile
make[1]: Entering directory `/home/user/OpenWrt-SDK-Linux-i686-1'
make -C package compile SDK=1
make[2]: Entering directory `/home/user/OpenWrt-SDK-Linux-i686-1/package'
make -j1 compile-targets
make[3]: Entering directory `/home/user/OpenWrt-SDK-Linux-i686-1/package'
make -C helloworld_2 compile
Rebuilding /home/user/OpenWrt-SDK-Linux-i686-1/bin/packages/helloworld_1_mipsel.ipk
make[4]: Entering directory `/home/user/OpenWrt-SDK-Linux-i686-1/package/helloworld_2'
CFLAGS="-Os -pipe -mips32 -mtune=mips32 -funit-at-a-time -I/home/user/OpenWrt-SDK-Linux-i686-1/staging_dir_mipsel/usr/include -I/home/user/OpenWrt-SDK-Linux-i686-1/staging_dir_mipsel/include " LDFLAGS="-L/home/user/OpenWrt-SDK-Linux-i686-1/staging_dir_mipsel/usr/lib -L/home/user/OpenWrt-SDK-Linux-i686-1/staging_dir_mipsel/lib " make -C /home/user/OpenWrt-SDK-Linux-i686-1/build_mipsel/helloworld AR=mipsel-linux-uclibc-ar AS="mipsel-linux-uclibc-gcc -c -Os -pipe -mips32 -mtune=mips32 -funit-at-a-time" LD=mipsel-linux-uclibc-ld NM=mipsel-linux-uclibc-nm CC="mipsel-linux-uclibc-gcc" GCC="mipsel-linux-uclibc-gcc" CXX=mipsel-linux-uclibc-g++ RANLIB=mipsel-linux-uclibc-ranlib STRIP=mipsel-linux-uclibc-strip OBJCOPY=mipsel-linux-uclibc-objcopy CROSS="mipsel-linux-uclibc-" CXXFLAGS="-Os -pipe -mips32 -mtune=mips32 -funit-at-a-time -I/home/user/OpenWrt-SDK-Linux-i686-1/staging_dir_mipsel/usr/include -I/home/user/OpenWrt-SDK-Linux-i686-1/staging_dir_mipsel/include " ARCH="mipsel" ;
make[5]: Entering directory `/home/user/OpenWrt-SDK-Linux-i686-1/build_mipsel/helloworld'
make[5]: `helloworld' is up to date.
make[5]: Leaving directory `/home/user/OpenWrt-SDK-Linux-i686-1/build_mipsel/helloworld'
touch /home/user/OpenWrt-SDK-Linux-i686-1/build_mipsel/helloworld/.built
install -d -m0755 /home/user/OpenWrt-SDK-Linux-i686-1/build_mipsel/helloworld/ipkg/helloworld/bin
install -m0755 /home/user/OpenWrt-SDK-Linux-i686-1/build_mipsel/helloworld/helloworld /home/user/OpenWrt-SDK-Linux-i686-1/build_mipsel/helloworld/ipkg/helloworld/bin/
mkdir -p /home/user/OpenWrt-SDK-Linux-i686-1/bin/packages
find /home/user/OpenWrt-SDK-Linux-i686-1/build_mipsel/helloworld/ipkg/helloworld -name CVS | xargs rm -rf
find /home/user/OpenWrt-SDK-Linux-i686-1/build_mipsel/helloworld/ipkg/helloworld -name .svn | xargs rm -rf
find /home/user/OpenWrt-SDK-Linux-i686-1/build_mipsel/helloworld/ipkg/helloworld -name '.#*' | xargs rm -f
STRIP="/home/user/OpenWrt-SDK-Linux-i686-1/staging_dir_mipsel/bin/sstrip" STRIP_KMOD="mipsel-linux-uclibc-strip --strip-unneeded --remove-section=.comment" /home/user/OpenWrt-SDK-Linux-i686-1/scripts/rstrip.sh /home/user/OpenWrt-SDK-Linux-i686-1/build_mipsel/helloworld/ipkg/helloworld
rstrip.sh: /home/user/OpenWrt-SDK-Linux-i686-1/build_mipsel/helloworld/ipkg/helloworld/bin/helloworld:executable
ipkg-build -c -o 0 -g 0 /home/user/OpenWrt-SDK-Linux-i686-1/build_mipsel/helloworld/ipkg/helloworld /home/user/OpenWrt-SDK-Linux-i686-1/bin/packages
Packaged contents of /home/user/OpenWrt-SDK-Linux-i686-1/build_mipsel/helloworld/ipkg/helloworld into /home/user/OpenWrt-SDK-Linux-i686-1/bin/packages/helloworld_1_mipsel.ipk
make[4]: Leaving directory `/home/user/OpenWrt-SDK-Linux-i686-1/package/helloworld_2'
make[3]: Leaving directory `/home/user/OpenWrt-SDK-Linux-i686-1/package'
make[2]: Leaving directory `/home/user/OpenWrt-SDK-Linux-i686-1/package'
make[1]: Leaving directory `/home/user/OpenWrt-SDK-Linux-i686-1'
( \
        cd package; \
        find . -maxdepth 2 -name Config.in | \
            sed -e 's,/Config.in,,g' | \
            xargs -r -n1 make compile -C; \
    )
------------------------------------------------------ end of make error message--------------------------------

------------------------------------ Makefile --------------------------------------------------
##############################################
# OpenWrt Makefile for helloworld program
#
#
# Most of the variables used here are defined in
# the include directives below. We just need to
# specify a basic description of the package,
# where to build our program, where to find
# the source files, and where to install the
# compiled program on the router.
#
# Be very careful of spacing in this file.
# Indents should be tabs, not spaces, and
# there should be no trailing whitespace in
# lines that are not commented.
#
##############################################

include $(TOPDIR)/rules.mk

# Name and release number of this package
PKG_NAME:=helloworld
PKG_RELEASE:=1


# This specifies the directory where we're going to build the program. 
# The root build directory, $(BUILD_DIR), is by default the build_mipsel
# directory in your OpenWrt SDK directory
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)


include $(INCLUDE_DIR)/package.mk



# Specify package information for this program.
# The variables defined here should be self explanatory.
# If you are running Kamikaze, delete the DESCRIPTION
# variable below and uncomment the Kamikaze define
# directive for the description below
define Package/helloworld
    SECTION:=utils
    CATEGORY:=Utilities
    TITLE:=Helloworld -- prints a snarky message
    DESCRIPTION:=\
    If you can't figure out what this program does, \\\
    you're probably brain-dead and need immediate \\\
    medical attention.
endef


# Uncomment portion below for Kamikaze and delete DESCRIPTION variable above
#define Package/helloworld/description
#    If you can't figure out what this program does, you're probably
#    brain-dead and need immediate medical attention.
#endef



# Specify what needs to be done to prepare for building the package.
# In our case, we need to copy the source files to the build directory.
# This is NOT the default.  The default uses the PKG_SOURCE_URL and the
# PKG_SOURCE which is not defined here to download the source from the web.
# In order to just build a simple program that we have just written, it is
# much easier to do it this way.
define Build/Prepare
    mkdir -p $(PKG_BUILD_DIR)
    $(CP) ./src/* $(PKG_BUILD_DIR)/
endef


# We do not need to define Build/Configure or Build/Compile directives
# The defaults are appropriate for compiling a simple program such as this one


# Specify where and how to install the program. Since we only have one file,
# the helloworld executable, install it by copying it to the /bin directory on
# the router. The $(1) variable represents the root directory on the router running
# OpenWrt. The $(INSTALL_DIR) variable contains a command to prepare the install
# directory if it does not already exist.  Likewise $(INSTALL_BIN) contains the
# command to copy the binary file from its current location (in our case the build
# directory) to the install directory.
define Package/helloworld/install
    $(INSTALL_DIR) $(1)/bin
    $(INSTALL_BIN) $(PKG_BUILD_DIR)/helloworld $(1)/bin/
endef


# This line executes the necessary commands to compile our program.
# The above define directives specify all the information needed, but this
# line calls BuildPackage which in turn actually uses this information to
# build a package.
$(eval $(call BuildPackage,helloworld))
----------------------------------------- End of Makefile ----------------------------------------------

------------------------------------------ Source Code -----------------------------------------------
/****************
* Helloworld.c
* The most simplistic C program ever written.
* An epileptic monkey on crack could write this code.
*****************/

#include <stdio.h>
int main(void)
{
     printf("Hell! O' world, why won't my code compile?\n\n");
     return 0;
}
------------------------------------------ End of Source Code -----------------------------------------

Packaged contents of /home/user/OpenWrt-SDK-Linux-i686-1/build_mipsel/helloworld/ipkg/helloworld into /home/user/OpenWrt-SDK-Linux-i686-1/bin/packages/helloworld_1_mipsel.ipk

I fail to see an error.

Edit:

Missing references to "__uClibc_start_main" can have various reasons:
- your executable was not linked against uClibc (-lc)
- your executable was linked against a different version of uClibc
- the wrong compiler was choosen to build the executable

(Last edited by jow on 15 Sep 2009, 20:00)

I had exactly the same problem with another application I want to execute in my router.

This is my OpenWRT SDK Makefile:

############################################################################################

include $(TOPDIR)/rules.mk

# Name and release number of this package
PKG_NAME:=dump
PKG_RELEASE:=1

# This specifies the directory where we're going to build the program. 
# The root build directory, $(BUILD_DIR), is by default the build_mipsel
# directory in your OpenWrt SDK directory
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)

include $(INCLUDE_DIR)/package.mk

# Specify package information for this program.
# The variables defined here should be self explanatory.
# If you are running Kamikaze, delete the DESCRIPTION
# variable below and uncomment the Kamikaze define
# directive for the description below

define Package/dump
    SECTION:=utils
    CATEGORY:=Utilities
    TITLE:=Aero -- CCX scanning
    DESCRIPTION:=\
    Aero scanning
endef

# Uncomment portion below for Kamikaze and delete DESCRIPTION variable above
define Package/dump/description
Aero scanning
endef

# Specify what needs to be done to prepare for building the package.
# In our case, we need to copy the source files to the build directory.
# This is NOT the default. The default uses the PKG_SOURCE_URL and the
# PKG_SOURCE which is not defined here to download the source from the web.

# In order to just build a simple program that we have just written, it is
# much easier to do it this way.

define Build/Prepare
    mkdir -p $(PKG_BUILD_DIR)
    $(CP) ./src/* $(PKG_BUILD_DIR)/
endef

# We do not need to define Build/Configure or Build/Compile directives
# The defaults are appropriate for compiling a simple program such as this one
# Specify where and how to install the program. Since we only have one file,
# the aero executable, install it by copying it to the /bin directory on
# the router. The $(1) variable represents the root directory on the router running
# OpenWrt. The $(INSTALL_DIR) variable contains a command to prepare the install
# directory if it does not already exist. Likewise $(INSTALL_BIN) contains the
# command to copy the binary file from its current location (in our case the build
# directory) to the install directory.

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

# This line executes the necessary commands to compile our program.
# The above define directives specify all the information needed, but this
# line calls BuildPackage which in turn actually uses this information to
# build a package.

$(eval $(call BuildPackage,dump))

############################################################################################

And this is the Makefile that compiles the app:

############################################################################################
dump: airodump-ng.o common.o
    $(CC) $(LDFLAGS) -nodefaultlibs -L$(STAGING_DIR)/lib -lc airodump-ng.o common.o -o dump

airodump-ng.o: airodump-ng.c common.c
    $(CC) $(CFLAGS) -c airodump-ng.c common.c

clean:
    rm -f *.o dump
############################################################################################

What did I miss?

Thank you.

The discussion might have continued from here.