Note that there are some explanatory texts on larger screens.

plurals
  1. POc - Linker error building OpenWrt package
    primarykey
    data
    text
    <p>I'm building a little OpenWRT application and I want to statically link a library to it.</p> <p><strong>EDIT</strong>: This happens with other libraries as well, not only libcurl.</p> <p>I'm getting this error while building it:</p> <pre><code>make[3]: Entering directory `/home/md/work/openwrt/build_dir/target-mips_r2_uClibc-0.9.33.2/app' mips-openwrt-linux-uclibc-gcc -c -Os -pipe -mips32r2 -mtune=34kc -mno-branch-likely -fno-caller-saves -fhonour-copts -Wno-error=unused-but-set-variable -msoft-float -Wall -Werror main.c -o main.o mips-openwrt-linux-uclibc-gcc -Os -pipe -mips32r2 -mtune=34kc -mno-branch-likely -fno-caller-saves -fhonour-copts -Wno-error=unused-but-set-variable -msoft-float -Wall -Werror -L/home/md/work/openwrt/staging_dir/target-mips_r2_uClibc-0.9.33.2/usr/lib -L/home/md/work/openwrt/staging_dir/target-mips_r2_uClibc-0.9.33.2/lib -L/home/md/work/openwrt/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/usr/lib -L/home/md/work/openwrt/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/lib -Wl,-Bstatic -lcurl main.o -o app /home/md/work/openwrt/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/lib/gcc/mips-openwrt-linux-uclibc/4.6.4/../../../../mips-openwrt-linux-uclibc/bin/ld: cannot find -lgcc_s /home/md/work/openwrt/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/lib/gcc/mips-openwrt-linux-uclibc/4.6.4/../../../../mips-openwrt-linux-uclibc/bin/ld: cannot find -lgcc_s collect2: ld returned 1 exit status make[3]: *** [app] Error 1 </code></pre> <p>It's weird, because I have libgcc_s.so on the search path:</p> <pre><code>stormbreaker:openwrt&gt; find . -name libgcc_s.* ./build_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/uClibc-0.9.33.2/libc/sysdeps/linux/common/libgcc_s.h ./build_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/gcc-linaro-4.6-2012.12-final/gcc/libgcc_s.so ./build_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/gcc-linaro-4.6-2012.12-final/gcc/libgcc_s.so.1 ./build_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/gcc-linaro-4.6-2012.12-final/mips-openwrt-linux-uclibc/libgcc/libgcc_s.so ./build_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/gcc-linaro-4.6-2012.12-final/mips-openwrt-linux-uclibc/libgcc/libgcc_s.so.1 ./build_dir/target-mips_r2_uClibc-0.9.33.2/toolchain/ipkg-ar71xx/libgcc/lib/libgcc_s.so.1 ./build_dir/target-mips_r2_uClibc-0.9.33.2/toolchain/libgcc_s.so.1 ./staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/lib/libgcc_s.so ./staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/lib/libgcc_s.so.1 ./staging_dir/target-mips_r2_uClibc-0.9.33.2/root-ar71xx/lib/libgcc_s.so ./staging_dir/target-mips_r2_uClibc-0.9.33.2/root-ar71xx/lib/libgcc_s.so.1 </code></pre> <p>I tried some hacks with -rpath and -rpath-link, but got the same result. As far as I know, libcurl doesn't need libgcc_s.</p> <p>I created a simple case to reproduce this:</p> <p>The relevant part of <code>openwrt/package/app/Makefile</code>:</p> <pre><code>TARGET_CFLAGS += -Wall -Werror TARGET_LIBS = -Wl,-Bstatic -lcurl define Build/Compile CC="$(TARGET_CC)" \ CFLAGS="$(TARGET_CFLAGS)" \ LDFLAGS="$(TARGET_LDFLAGS)" \ LIBS="$(TARGET_LIBS)" \ $(MAKE) -C $(PKG_BUILD_DIR) endef </code></pre> <p><code>openwrt/package/app/src/Makefile</code>:</p> <pre><code>APP = app SOURCES = $(wildcard *.c) OBJECTS = $(SOURCES:.c=.o) $(APP): $(OBJECTS) $(CC) $(CFLAGS) $(LDFLAGS) $(LIBS) $(OBJECTS) -o $(APP) # Objects %.o: %.c $(CC) -c $(CFLAGS) $&lt; -o $@ </code></pre> <p>The application itself is a single file:</p> <pre><code>#include &lt;stdio.h&gt; #include &lt;curl/curl.h&gt; int main (void) { curl_global_init(CURL_GLOBAL_ALL); printf("Ok!\n"); return 0; } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload