Modify

Opened 6 years ago

Closed 5 years ago

Last modified 4 years ago

#11823 closed defect (worksforme)

failed to compile curlftpfs

Reported by: anonymous Owned by: florian
Priority: normal Milestone: Barrier Breaker 14.07
Component: packages Version: Trunk
Keywords: Cc:

Description

i am getting the following error, while compiling curlftpfs from the OpenWRT trunk.

OpenWrt-libtool: link: mips-openwrt-linux-uclibc-gcc -Os -pipe -mips32r2 -mtune=mips32r2 -fno-caller-saves -fhonour-copts -Wno-error=unused-but-set-variable -msoft-float -I/media/OpenWRT/trunk/staging_dir/target-mips_r2_uClibc-0.9.33.2/usr/lib/libiconv-stub/include -I/media/OpenWRT/trunk/staging_dir/target-mips_r2_uClibc-0.9.33.2/usr/lib/libintl-stub/include -I/media/OpenWRT/trunk/staging_dir/target-mips_r2_uClibc-0.9.33.2/usr/lib/libiconv-stub/include -I/media/OpenWRT/trunk/staging_dir/target-mips_r2_uClibc-0.9.33.2/usr/include/fuse -DICONV_CONST=const -Wall -W -Wno-sign-compare -D_REENTRANT -I/media/OpenWRT/trunk/staging_dir/target-mips_r2_uClibc-0.9.33.2/usr/include/glib-2.0 -I/media/OpenWRT/trunk/staging_dir/target-mips_r2_uClibc-0.9.33.2/usr/lib/glib-2.0/include -D_FILE_OFFSET_BITS=64 -o curlftpfs ftpfs.o  -L/media/OpenWRT/trunk/staging_dir/target-mips_r2_uClibc-0.9.33.2/usr/lib -L/media/OpenWRT/trunk/staging_dir/target-mips_r2_uClibc-0.9.33.2/lib -L/media/OpenWRT/trunk/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/usr/lib -L/media/OpenWRT/trunk/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/lib -L/media/OpenWRT/trunk/staging_dir/target-mips_r2_uClibc-0.9.33.2/usr/lib/libiconv-stub/lib -L/media/OpenWRT/trunk/staging_dir/target-mips_r2_uClibc-0.9.33.2/usr/lib/libintl-stub/lib libcurlftpfs.a -lglib-2.0 -liconv -lfuse -lcurl -lssl -lcrypto -lz
/media/OpenWRT/trunk/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/lib/gcc/mips-openwrt-linux-uclibc/4.6.3/../../../../mips-openwrt-linux-uclibc/bin/ld: ftpfs.o: undefined reference to symbol 'pthread_create'
/media/OpenWRT/trunk/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/lib/gcc/mips-openwrt-linux-uclibc/4.6.3/../../../../mips-openwrt-linux-uclibc/bin/ld: note: 'pthread_create' is defined in DSO /media/OpenWRT/trunk/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/mips-openwrt-linux-uclibc/bin/../../../toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/lib/libpthread.so.0 so try adding it to the linker command line
/media/OpenWRT/trunk/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/mips-openwrt-linux-uclibc/bin/../../../toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/lib/libpthread.so.0: could not read symbols: Invalid operation
collect2: ld returned 1 exit status
make[5]: *** [curlftpfs] Error 1
make[5]: Leaving directory `/media/OpenWRT/trunk/build_dir/target-mips_r2_uClibc-0.9.33.2/curlftpfs-0.9.2'
make[4]: *** [all-recursive] Error 1
make[4]: Leaving directory `/media/OpenWRT/trunk/build_dir/target-mips_r2_uClibc-0.9.33.2/curlftpfs-0.9.2'
make[3]: *** [all] Error 2
make[3]: Leaving directory `/media/OpenWRT/trunk/build_dir/target-mips_r2_uClibc-0.9.33.2/curlftpfs-0.9.2'
make[2]: *** [/media/OpenWRT/trunk/build_dir/target-mips_r2_uClibc-0.9.33.2/curlftpfs-0.9.2/.built] Error 2
make[2]: Leaving directory `/media/OpenWRT/trunk/feeds/packages/net/curlftpfs'
make[1]: *** [package/feeds/packages/curlftpfs/compile] Error 2
make[1]: Leaving directory `/media/OpenWRT/trunk'
make: *** [package/feeds/packages/curlftpfs/compile] Fehler 2

Any help is appreciated.

Attachments (0)

Change History (13)

comment:1 follow-up: Changed 5 years ago by florian

  • Owner changed from developers to florian
  • Status changed from new to accepted

This looks strange, your libpthread library is staged at the correct location, so it should properly be cross-compiled for your target system. What happens if you rebuild your toolchain?

comment:2 in reply to: ↑ 1 Changed 5 years ago by anonymous

Same problem here. Only with my own app. Unable to solve this undefined reference to `pthread_create'. Tried everything. Is there a quick solution, possibly?

comment:3 follow-up: Changed 5 years ago by jow

TARGET_LDFLAGS += -lpthread ?

comment:4 in reply to: ↑ 3 Changed 5 years ago by Dave

Replying to jow:

TARGET_LDFLAGS += -lpthread ?

Thanks, but no difference.

To review pls add one line "pthread_create(&thread, NULL, myfunc, NULL)" for example somewhere in hostapd-20120428/src/ap/wpa_auth.c

comment:5 follow-up: Changed 5 years ago by jow

I know the issue and the solution is to link pthread, as it is also suggested in the error message.
Question is how to convey the -lpthread flag into the libtool invocation, this is highly dependant on the specific build system in use.

comment:6 in reply to: ↑ 5 ; follow-up: Changed 5 years ago by Dave

Replying to jow:

I know the issue and the solution is to link pthread, as it is also suggested in the error message.

FYI: for some reason I am not seeing the 2nd line err msg shown in the OP "note: 'pthread_create' is defined in DSO ...". However my libpthread.so files do exist and in place.

Question is how to convey the -lpthread flag into the libtool invocation, this is highly dependant on the specific build system in use.

I'm on Ubuntu targeting ar71xx. I tried every variation of -lthread vs. -lpthread vs. -lpath-to-libpthread.so.

comment:7 in reply to: ↑ 6 ; follow-up: Changed 5 years ago by Dave

Edit: ... every variation of -pthread vs. -lpthread vs. -lpath-to-libpthread.so.

comment:8 in reply to: ↑ 7 Changed 5 years ago by Dave

I just realize that Backport is providing me with the same posix threads issue. This is not a quick regression thing then. Makes me wonder how it can be no other openwrt package is having a problem with that?

comment:9 Changed 5 years ago by Dave

I'm still trying to get over this problem.

Here is the full gcc call that is leading to the "undefined reference to pthread_create" message:

mips-openwrt-linux-uclibc-gcc

-c -o hostapd_multi.o -Dmain=hostapd_main -pthread
-I/trunk/staging_dir/target-mips_r2_uClibc-0.9.33.2/usr/include/libnl-tiny
-I/trunk/build_dir/target-mips_r2_uClibc-0.9.33.2/hostapd-wpad-mini/hostapd-20120428/src/crypto
-I/trunk/staging_dir/target-mips_r2_uClibc-0.9.33.2/usr/include
-I/trunk/staging_dir/target-mips_r2_uClibc-0.9.33.2/include
-I/trunk/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/usr/include
-I/trunk/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/include
-I/trunk/staging_dir/target-mips_r2_uClibc-0.9.33.2/usr/include/madwifi
-DCONFIG_LIBNL20 -D_GNU_SOURCE -DCONFIG_MSG_MIN_PRIORITY=3 -Os -pipe -mips32r2 -mtune=mips32r2
-fno-caller-saves -fhonour-copts -Wno-error=unused-but-set-variable -msoft-float -ffunction-sections -fdata-sections
-I../src -I../src/utils
-DHOSTAPD -DCONFIG_NO_RADIUS -DCONFIG_NO_ACCOUNTING -DCONFIG_CTRL_IFACE -DCONFIG_CTRL_IFACE_UNIX -DCONFIG_RSN_PREAUTH
-DCONFIG_PEERKEY -DCONFIG_IEEE80211W -DCONFIG_IEEE80211N -DCONFIG_DRIVER_WIRED -DCONFIG_DRIVER_NL80211
-DCONFIG_DRIVER_WIRED -DCONFIG_DRIVER_NL80211 -DEAP_SERVER_IDENTITY -DCONFIG_CRYPTO_INTERNAL -DCONFIG_SHA256 -DNEED_AP_MLME
-I/trunk/staging_dir/target-mips_r2_uClibc-0.9.33.2/usr/include/libnl-tiny
-I/trunk/build_dir/target-mips_r2_uClibc-0.9.33.2/hostapd-wpad-mini/hostapd-20120428/src/crypto
-I/trunk/staging_dir/target-mips_r2_uClibc-0.9.33.2/usr/include
-I/trunk/staging_dir/target-mips_r2_uClibc-0.9.33.2/include
-I/trunk/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/usr/include
-I/trunk/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/include
-I/trunk/staging_dir/target-mips_r2_uClibc-0.9.33.2/usr/include/madwifi
-DCONFIG_LIBNL20 -D_GNU_SOURCE -DCONFIG_MSG_MIN_PRIORITY=3
-I../src -I../src/utils
-DMULTICALL -DCONFIG_BACKEND_FILE -DCONFIG_IEEE80211W -DCONFIG_PEERKEY -DCONFIG_DRIVER_WIRED -DCONFIG_DRIVER_NL80211
-DCONFIG_CRYPTO_INTERNAL -DCONFIG_SHA256 -DCONFIG_CTRL_IFACE -DCONFIG_CTRL_IFACE_UNIX -DCONFIG_SME
main.c

The -pthread parameter was set by me. Everything else is unchanged.
You may notice that all "-I" pathes are given twice. Just saying.

The following pathes are being searched for libraries (-print-search-dirs):

/trunk/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/lib/gcc/mips-openwrt-linux-uclibc/4.6.3/:
/trunk/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/mips-openwrt-linux-uclibc/lib/mips-openwrt-linux-uclibc/4.6.3/:
/trunk/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/mips-openwrt-linux-uclibc/lib/

The 3rd folder contains these files (among others):

libpthread-0.9.33.2.so
libpthread.a
libpthread_nonshared.a
libpthread_nonshared_pic.a -> libpthread_nonshared.a
libpthread_pic.a -> libpthread.a
libpthread.so
libpthread.so.0 -> libpthread-0.9.33.2.so
libpthread_so.a

libpthread.so contains this:
/* GNU ld script

  • Use the shared library, but some functions are only in
  • the static library, so try that secondarily. */

GROUP ( libpthread.so.0 libpthread_nonshared.a )

All this seems to be OK. I'm not sure what to look for next. Is there anybody here who can provide me some support? Maybe a suggestion what I could try? Thank you.

comment:10 Changed 5 years ago by anonymous

Let me re-post this with better formatting:

Here is the full gcc call that is leading to the "undefined reference to pthread_create" message:

mips-openwrt-linux-uclibc-gcc 
  -c -o hostapd_multi.o -Dmain=hostapd_main -pthread 
  -I/trunk/staging_dir/target-mips_r2_uClibc-0.9.33.2/usr/include/libnl-tiny 
  -I/trunk/build_dir/target-mips_r2_uClibc-0.9.33.2/hostapd-wpad-mini/hostapd-20120428/src/crypto 
  -I/trunk/staging_dir/target-mips_r2_uClibc-0.9.33.2/usr/include 
  -I/trunk/staging_dir/target-mips_r2_uClibc-0.9.33.2/include 
  -I/trunk/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/usr/include 
  -I/trunk/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/include 
  -I/trunk/staging_dir/target-mips_r2_uClibc-0.9.33.2/usr/include/madwifi 
  -DCONFIG_LIBNL20 -D_GNU_SOURCE -DCONFIG_MSG_MIN_PRIORITY=3 -Os -pipe -mips32r2 -mtune=mips32r2 
  -fno-caller-saves -fhonour-copts -Wno-error=unused-but-set-variable -msoft-float -ffunction-sections -fdata-sections 
  -I../src -I../src/utils 
  -DHOSTAPD -DCONFIG_NO_RADIUS -DCONFIG_NO_ACCOUNTING -DCONFIG_CTRL_IFACE -DCONFIG_CTRL_IFACE_UNIX -DCONFIG_RSN_PREAUTH 
  -DCONFIG_PEERKEY -DCONFIG_IEEE80211W -DCONFIG_IEEE80211N -DCONFIG_DRIVER_WIRED -DCONFIG_DRIVER_NL80211 
  -DCONFIG_DRIVER_WIRED -DCONFIG_DRIVER_NL80211 -DEAP_SERVER_IDENTITY -DCONFIG_CRYPTO_INTERNAL -DCONFIG_SHA256 -DNEED_AP_MLME 
  -I/trunk/staging_dir/target-mips_r2_uClibc-0.9.33.2/usr/include/libnl-tiny 
  -I/trunk/build_dir/target-mips_r2_uClibc-0.9.33.2/hostapd-wpad-mini/hostapd-20120428/src/crypto 
  -I/trunk/staging_dir/target-mips_r2_uClibc-0.9.33.2/usr/include 
  -I/trunk/staging_dir/target-mips_r2_uClibc-0.9.33.2/include 
  -I/trunk/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/usr/include 
  -I/trunk/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/include 
  -I/trunk/staging_dir/target-mips_r2_uClibc-0.9.33.2/usr/include/madwifi 
  -DCONFIG_LIBNL20 -D_GNU_SOURCE -DCONFIG_MSG_MIN_PRIORITY=3 
  -I../src -I../src/utils 
  -DMULTICALL -DCONFIG_BACKEND_FILE -DCONFIG_IEEE80211W -DCONFIG_PEERKEY -DCONFIG_DRIVER_WIRED -DCONFIG_DRIVER_NL80211 
  -DCONFIG_CRYPTO_INTERNAL -DCONFIG_SHA256 -DCONFIG_CTRL_IFACE -DCONFIG_CTRL_IFACE_UNIX -DCONFIG_SME 
  main.c

The -pthread parameter was set by me. Everything else is unchanged.
You may notice that all "-I" pathes are given twice. Just saying.

The following pathes are being searched for libraries (-print-search-dirs):

  /trunk/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/lib/gcc/mips-openwrt-linux-uclibc/4.6.3/:
  /trunk/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/mips-openwrt-linux-uclibc/lib/mips-openwrt-linux-uclibc/4.6.3/:
  /trunk/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/mips-openwrt-linux-uclibc/lib/

The 3rd folder contains these files (among others):

  libpthread-0.9.33.2.so
  libpthread.a
  libpthread_nonshared.a
  libpthread_nonshared_pic.a -> libpthread_nonshared.a
  libpthread_pic.a -> libpthread.a
  libpthread.so
  libpthread.so.0 -> libpthread-0.9.33.2.so
  libpthread_so.a

libpthread.so contains this:

/* GNU ld script
 * Use the shared library, but some functions are only in
 * the static library, so try that secondarily. */
GROUP ( libpthread.so.0 libpthread_nonshared.a )

comment:11 Changed 5 years ago by jow

  • Resolution set to worksforme
  • Status changed from accepted to closed

I don't see how compiling hostapd can lead to undefined pthread_create issues in curlftpfs.

Also the correct flag is -*l*pthread. Carefully read the actual error message in the initial report. You're supposed to explicitely link the DSO, the message is quite specific and leaves little room for interpretation.

Additionally we're unable to reproduce this issue in curlftpfs. It works on the buildbots and no issues have been observed during the 12.09-beta release builds.

Regarding the "own app" - as pointed out already one has to pass -lpthread to the linker flags. How to convey this flag into the final gcc/ld invocation is up to the specific build system in use and outside of the scope of this ticket.

comment:12 Changed 4 years ago by anonymous

i love ipv6! <33

comment:13 Changed 4 years ago by jow

  • Milestone changed from Attitude Adjustment 12.09 to Barrier Breaker 14.07

Milestone Attitude Adjustment 12.09 deleted

Add Comment

Modify Ticket

Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.