Bug 21520

Summary: mono build is broken because of test-conc-hashtable failing to link
Product: [Mono] Runtime Reporter: Dylan Borg <borgdylan>
Component: GeneralAssignee: Bugzilla <bugzilla>
Status: REOPENED ---    
Severity: normal CC: anders, dkingsley, grendel, mono-bugs+mono, mono-bugs+runtime, saper, vargaz, woodsb02
Priority: High    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Tags: Is this bug a regression?: ---
Last known good build:
Attachments: config.log

Description Dylan Borg 2014-07-22 14:25:13 UTC
When trying to build the mono unit tests (part of normal build), test-conc-hashtable is failing to link breaking the build:
make[3]: Entering directory `/mnt/hdd/mono/mono/unit-tests'
  CCLD     test-conc-hashtable
../utils/.libs/libmonoutils.a(mono-threads.o): In function `is_thread_in_critical_region':
/mnt/hdd/mono/mono/utils/mono-threads.c:526: undefined reference to `mono_jit_info_table_find'
/mnt/hdd/mono/mono/utils/mono-threads.c:533: undefined reference to `mono_jit_info_get_method'
../utils/.libs/libmonoutils.a(mono-threads-posix.o): In function `inner_start_thread':
/mnt/hdd/mono/mono/utils/mono-threads-posix.c:71: undefined reference to `wapi_create_thread_handle'
/mnt/hdd/mono/mono/utils/mono-threads-posix.c:110: undefined reference to `wapi_thread_handle_set_exited'
../utils/.libs/libmonoutils.a(mono-threads-posix.o): In function `mono_threads_core_exit':
/mnt/hdd/mono/mono/utils/mono-threads-posix.c:310: undefined reference to `wapi_thread_handle_set_exited'
../utils/.libs/libmonoutils.a(mono-threads-posix.o): In function `mono_threads_core_unregister':
/mnt/hdd/mono/mono/utils/mono-threads-posix.c:320: undefined reference to `wapi_thread_handle_set_exited'
../utils/.libs/libmonoutils.a(mono-threads-posix.o): In function `mono_threads_core_open_handle':
/mnt/hdd/mono/mono/utils/mono-threads-posix.c:336: undefined reference to `wapi_ref_thread_handle'
/mnt/hdd/mono/mono/utils/mono-threads-posix.c:334: undefined reference to `wapi_create_thread_handle'
../utils/.libs/libmonoutils.a(mono-threads-posix.o): In function `mono_threads_core_open_thread_handle':
/mnt/hdd/mono/mono/utils/mono-threads-posix.c:357: undefined reference to `wapi_ref_thread_handle'
../utils/.libs/libmonoutils.a(mono-threads-posix.o): In function `mono_threads_init_platform':
/mnt/hdd/mono/mono/utils/mono-threads-posix.c:433: undefined reference to `mono_thread_get_abort_signal'
../utils/.libs/libmonoutils.a(mono-threads-posix.o): In function `mono_threads_core_abort_syscall':
/mnt/hdd/mono/mono/utils/mono-threads-posix.c:471: undefined reference to `mono_thread_get_abort_signal'
../utils/.libs/libmonoutils.a(mono-threads-posix.o): In function `mono_threads_core_suspend':
/mnt/hdd/mono/mono/utils/mono-threads-posix.c:484: undefined reference to `mono_thread_get_abort_signal'
../utils/.libs/libmonoutils.a(hazard-pointer.o): In function `mono_thread_smr_init':
/mnt/hdd/mono/mono/utils/hazard-pointer.c:348: undefined reference to `InitializeCriticalSection'
/usr/bin/ld: test-conc-hashtable: hidden symbol `mono_thread_get_abort_signal' isn't defined
/usr/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
make[3]: *** [test-conc-hashtable] Error 1
make[3]: Leaving directory `/mnt/hdd/mono/mono/unit-tests'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/mnt/hdd/mono/mono'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/mnt/hdd/mono'
make: *** [all] Error 2
Comment 1 Zoltan Varga 2014-07-23 12:53:26 UTC
*** Bug 21544 has been marked as a duplicate of this bug. ***
Comment 2 Zoltan Varga 2014-07-23 12:55:17 UTC
This happens because of circular dependencies between libmonoruntime/lbiwapi/libmonoutils. The osx linker can handle it, but the linux linker needs --start-group and --end-group flags to the linker to handle this. Unfortunately, its pretty hard to pass these to the linker since libtool has the habbit of reorganizing command line options.
Comment 3 Zoltan Varga 2014-07-23 13:01:41 UTC
Fixed by disabling the unit tests on linux.
Comment 4 Dylan Borg 2014-08-13 06:39:21 UTC
The build broke again because of this. Has the test been re-enabled?

  CCLD     test-conc-hashtable
../utils/.libs/libmonoutils.a(mono-threads.o): In function `is_thread_in_critical_region':
/mnt/hdd/mono/mono/utils/mono-threads.c:526: undefined reference to `mono_jit_info_table_find'
/mnt/hdd/mono/mono/utils/mono-threads.c:533: undefined reference to `mono_jit_info_get_method'
../utils/.libs/libmonoutils.a(mono-threads-posix.o): In function `inner_start_thread':
/mnt/hdd/mono/mono/utils/mono-threads-posix.c:71: undefined reference to `wapi_create_thread_handle'
/mnt/hdd/mono/mono/utils/mono-threads-posix.c:110: undefined reference to `wapi_thread_handle_set_exited'
../utils/.libs/libmonoutils.a(mono-threads-posix.o): In function `mono_threads_core_exit':
/mnt/hdd/mono/mono/utils/mono-threads-posix.c:310: undefined reference to `wapi_thread_handle_set_exited'
../utils/.libs/libmonoutils.a(mono-threads-posix.o): In function `mono_threads_core_unregister':
/mnt/hdd/mono/mono/utils/mono-threads-posix.c:320: undefined reference to `wapi_thread_handle_set_exited'
../utils/.libs/libmonoutils.a(mono-threads-posix.o): In function `mono_threads_core_open_handle':
/mnt/hdd/mono/mono/utils/mono-threads-posix.c:336: undefined reference to `wapi_ref_thread_handle'
/mnt/hdd/mono/mono/utils/mono-threads-posix.c:334: undefined reference to `wapi_create_thread_handle'
../utils/.libs/libmonoutils.a(mono-threads-posix.o): In function `mono_threads_core_open_thread_handle':
/mnt/hdd/mono/mono/utils/mono-threads-posix.c:357: undefined reference to `wapi_ref_thread_handle'
../utils/.libs/libmonoutils.a(mono-threads-posix.o): In function `mono_threads_init_platform':
/mnt/hdd/mono/mono/utils/mono-threads-posix.c:433: undefined reference to `mono_thread_get_abort_signal'
../utils/.libs/libmonoutils.a(mono-threads-posix.o): In function `mono_threads_core_abort_syscall':
/mnt/hdd/mono/mono/utils/mono-threads-posix.c:471: undefined reference to `mono_thread_get_abort_signal'
../utils/.libs/libmonoutils.a(mono-threads-posix.o): In function `mono_threads_core_suspend':
/mnt/hdd/mono/mono/utils/mono-threads-posix.c:484: undefined reference to `mono_thread_get_abort_signal'
/usr/bin/ld: test-conc-hashtable: hidden symbol `mono_thread_get_abort_signal' isn't defined
/usr/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
Comment 5 Zoltan Varga 2014-08-13 12:37:11 UTC
Could you try re-running autogen.sh ?
Comment 6 Dylan Borg 2014-08-13 14:28:13 UTC
I did:
./autogen.sh --prefix=/usr --with-tls=__thread
make

The same thing happened.
Comment 7 Zoltan Varga 2014-08-13 14:44:19 UTC
At the end of configure output, what does Host:/Target: says ?
Comment 8 Dylan Borg 2014-08-13 15:24:39 UTC
Created attachment 7679 [details]
config.log

Attaching whole config.log
Comment 9 Zoltan Varga 2014-08-13 15:34:31 UTC
Should be fixed by mono master 2ceb43d38001755b59a1bcac389eb5d3cb38c990.
Comment 10 Ben Woods 2014-09-28 12:10:35 UTC
This problem also exists on FreeBSD (since it uses the GNU ld linker).

Since the variable "PLATFORM_GNU" is only used for bypassing this test, can we instead change this to "LINKER_GNU" and test for the GNU linker instead of target_os containing GNU?

https://github.com/mono/mono/search?utf8=%E2%9C%93&q=platform_gnu
Comment 11 Anders Jensen-Waud 2015-05-19 01:47:10 UTC
Confirming that this issue still persists with HEAD on FreeBSD 10.1.
Comment 12 Marcin Cieślak 2015-06-07 17:38:51 UTC
I'd like to propose a fix in https://github.com/mono/mono/pull/1859

This should fix FreeBSD and Linux builds as well - I went ahead to create a so-called "convenience" library that solves the interdependencies between static libraries.
Comment 13 Marcin Cieślak 2015-06-15 06:59:38 UTC
The fix has been merged into master, anyone to verify?