Bug #43449 Undefined symbol __1cG__CrunMex_rethrow_q6F_v_ when compiling using Sun Studio
Submitted: 6 Mar 2009 10:24 Modified: 25 Oct 2018 6:38
Reporter: Sveta Smirnova Email Updates:
Status: Won't fix Impact on me:
None 
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:5.6.27 OS:Solaris
Assigned to: Daniel Fischer CPU Architecture:Any
Tags: Contribution

[6 Mar 2009 10:24] Sveta Smirnova
Description:
If compile using Sun Studion on Solaris I get errors like:

creating mysqlbinlog
source='mysqlcheck.c' object='mysqlcheck.o' libtool=no \
        DEPDIR=.deps depmode=none /bin/bash ../depcomp \
        cc -DUNDEF_THREADS_HACK -DDEFAULT_MYSQL_HOME="\"/users/ssmirnova/sol10-sparc-c/build/mysql-5.1\"" -DDATADIR="\"/users/ssmirnova/sol10-sparc-c/build/mysql-5.1/var\"" -I. -I. -I../include -I../include -I../include -I../regex     -g -DSAFE_MUTEX -DSAFEMALLOC    -DHAVE_RWLOCK_T -DUNIV_SOLARIS -c mysqlcheck.c
/bin/bash ../libtool --preserve-dup-deps --tag=CC --mode=link cc  -g -DSAFE_MUTEX -DSAFEMALLOC    -DHAVE_RWLOCK_T -DUNIV_SOLARIS   -o mysqlcheck  mysqlcheck.o -lpthread -lthread ../libmysql/libmysqlclient.la -lposix4 -lresolv -lgen -lsocket -lnsl -lm   -lz 
cc -g -DSAFE_MUTEX -DSAFEMALLOC -DHAVE_RWLOCK_T -DUNIV_SOLARIS -o .libs/mysqlcheck mysqlcheck.o  -lpthread -lthread ../libmysql/.libs/libmysqlclient.so -lpthread -lthread -lpthread -lthread -lpthread -lthread -lpthread -lthread -lpthread -lthread -lpthread -lthread -lpthread -lthread -lpthread -lthread -lposix4 -lresolv -lgen -lsocket -lnsl -lm -lz -R/users/ssmirnova/sol10-sparc-c/build/mysql-5.1/lib/mysql
Undefined                       first referenced
 symbol                             in file
__1cG__CrunMex_rethrow_q6F_v_       ../libmysql/.libs/libmysqlclient.so
ld: fatal: Symbol referencing errors. No output written to .libs/mysqlcheck
make[2]: *** [mysqlcheck] Error 1
make[2]: Leaving directory `/users/ssmirnova/src/mysql-5.1/client'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/users/ssmirnova/src/mysql-5.1/client'
make: *** [all-recursive] Error 1

How to repeat:
./configure --prefix=/users/ssmirnova/sol10-sparc-c/build/mysql-5.1 --enable-assembler --with-extra-charsets=complex --enable-thread-safe-client --with-big-tables --with-plugin-maria --with-maria-tmp-tables --with-readline --with-debug=full --with-ssl --with-plugins=max --with-embedded-server --with-libevent --enable-local-infile
make
[6 Mar 2009 11:33] Sveta Smirnova
Suggested fix:

$diff -u client/Makefile.old client/Makefile 
--- client/Makefile.old Fri Mar  6 11:54:39 2009
+++ client/Makefile     Fri Mar  6 11:55:24 2009
@@ -610,7 +610,7 @@
        $(CXXLINK) $(mysql_LDFLAGS) $(mysql_OBJECTS) $(mysql_LDADD) $(LIBS)
 mysql_upgrade$(EXEEXT): $(mysql_upgrade_OBJECTS) $(mysql_upgrade_DEPENDENCIES) 
        @rm -f mysql_upgrade$(EXEEXT)
-       $(LINK) $(mysql_upgrade_LDFLAGS) $(mysql_upgrade_OBJECTS) $(mysql_upgrade_LDADD) $(LIBS)
+       $(CXXLINK) $(mysql_upgrade_LDFLAGS) $(mysql_upgrade_OBJECTS) $(mysql_upgrade_LDADD) $(LIBS)
 mysqladmin$(EXEEXT): $(mysqladmin_OBJECTS) $(mysqladmin_DEPENDENCIES) 
        @rm -f mysqladmin$(EXEEXT)
        $(CXXLINK) $(mysqladmin_LDFLAGS) $(mysqladmin_OBJECTS) $(mysqladmin_LDADD) $(LIBS)
@@ -619,19 +619,19 @@
        $(CXXLINK) $(mysqlbinlog_LDFLAGS) $(mysqlbinlog_OBJECTS) $(mysqlbinlog_LDADD) $(LIBS)
 mysqlcheck$(EXEEXT): $(mysqlcheck_OBJECTS) $(mysqlcheck_DEPENDENCIES) 
        @rm -f mysqlcheck$(EXEEXT)
-       $(LINK) $(mysqlcheck_LDFLAGS) $(mysqlcheck_OBJECTS) $(mysqlcheck_LDADD) $(LIBS)
+       $(CXXLINK) $(mysqlcheck_LDFLAGS) $(mysqlcheck_OBJECTS) $(mysqlcheck_LDADD) $(LIBS)
 mysqldump$(EXEEXT): $(mysqldump_OBJECTS) $(mysqldump_DEPENDENCIES) 
        @rm -f mysqldump$(EXEEXT)
-       $(LINK) $(mysqldump_LDFLAGS) $(mysqldump_OBJECTS) $(mysqldump_LDADD) $(LIBS)
+       $(CXXLINK) $(mysqldump_LDFLAGS) $(mysqldump_OBJECTS) $(mysqldump_LDADD) $(LIBS)
 mysqlimport$(EXEEXT): $(mysqlimport_OBJECTS) $(mysqlimport_DEPENDENCIES) 
        @rm -f mysqlimport$(EXEEXT)
-       $(LINK) $(mysqlimport_LDFLAGS) $(mysqlimport_OBJECTS) $(mysqlimport_LDADD) $(LIBS)
+       $(CXXLINK) $(mysqlimport_LDFLAGS) $(mysqlimport_OBJECTS) $(mysqlimport_LDADD) $(LIBS)
 mysqlshow$(EXEEXT): $(mysqlshow_OBJECTS) $(mysqlshow_DEPENDENCIES) 
        @rm -f mysqlshow$(EXEEXT)
-       $(LINK) $(mysqlshow_LDFLAGS) $(mysqlshow_OBJECTS) $(mysqlshow_LDADD) $(LIBS)
+       $(CXXLINK) $(mysqlshow_LDFLAGS) $(mysqlshow_OBJECTS) $(mysqlshow_LDADD) $(LIBS)
 mysqlslap$(EXEEXT): $(mysqlslap_OBJECTS) $(mysqlslap_DEPENDENCIES) 
        @rm -f mysqlslap$(EXEEXT)
-       $(LINK) $(mysqlslap_LDFLAGS) $(mysqlslap_OBJECTS) $(mysqlslap_LDADD) $(LIBS)
+       $(CXXLINK) $(mysqlslap_LDFLAGS) $(mysqlslap_OBJECTS) $(mysqlslap_LDADD) $(LIBS)
 mysqltest$(EXEEXT): $(mysqltest_OBJECTS) $(mysqltest_DEPENDENCIES) 
        @rm -f mysqltest$(EXEEXT)
        $(CXXLINK) $(mysqltest_LDFLAGS) $(mysqltest_OBJECTS) $(mysqltest_LDADD) $(LIBS)

$diff -u tests/Makefile.old tests/Makefile
--- tests/Makefile.old  Fri Mar  6 12:17:13 2009
+++ tests/Makefile      Fri Mar  6 12:19:44 2009
@@ -111,8 +111,11 @@
        $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
        $(AM_CFLAGS) $(CFLAGS)
 CCLD = $(CC)
+CXXLD = $(CXX)
 LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
        $(AM_LDFLAGS) $(LDFLAGS) -o $@
+CXXLINK = $(LIBTOOL) --tag=CC --mode=link $(CXXLD) $(AM_CFLAGS) $(CFLAGS) \
+        $(AM_LDFLAGS) $(LDFLAGS) -o $@
 SOURCES = $(bug25714_SOURCES) $(insert_test_SOURCES) \
        $(mysql_client_test_SOURCES) $(select_test_SOURCES) \
        thread_test.c
@@ -523,19 +526,19 @@
        done
 bug25714$(EXEEXT): $(bug25714_OBJECTS) $(bug25714_DEPENDENCIES) 
        @rm -f bug25714$(EXEEXT)
-       $(LINK) $(bug25714_LDFLAGS) $(bug25714_OBJECTS) $(bug25714_LDADD) $(LIBS)
+       $(CXXLINK) $(bug25714_LDFLAGS) $(bug25714_OBJECTS) $(bug25714_LDADD) $(LIBS)
 insert_test$(EXEEXT): $(insert_test_OBJECTS) $(insert_test_DEPENDENCIES) 
        @rm -f insert_test$(EXEEXT)
-       $(LINK) $(insert_test_LDFLAGS) $(insert_test_OBJECTS) $(insert_test_LDADD) $(LIBS)
+       $(CXXLINK) $(insert_test_LDFLAGS) $(insert_test_OBJECTS) $(insert_test_LDADD) $(LIBS)
 mysql_client_test$(EXEEX mysql_client_test$(EXEEXT): $(mysql_client_test_OBJECTS) $(mysql_client_test_DEPENDENCIES) 
        @rm -f mysql_client_test$(EXEEXT)
-       $(LINK) $(mysql_client_test_LDFLAGS) $(mysql_client_test_OBJECTS) $(mysql_client_test_LDADD) $(LIBS)
+       $(CXXLINK) $(mysql_client_test_LDFLAGS) $(mysql_client_test_OBJECTS) $(mysql_client_test_LDADD) $(LIBS)
 select_test$(EXEEXT): $(select_test_OBJECTS) $(select_test_DEPENDENCIES) 
        @rm -f select_test$(EXEEXT)
-       $(LINK) $(select_test_LDFLAGS) $(select_test_OBJECTS) $(select_test_LDADD) $(LIBS)
+       $(CXXLINK) $(select_test_LDFLAGS) $(select_test_OBJECTS) $(select_test_LDADD) $(LIBS)
 thread_test$(EXEEXT): $(thread_test_OBJECTS) $(thread_test_DEPENDENCIES) 
        @rm -f thread_test$(EXEEXT)
-       $(LINK) $(thread_test_LDFLAGS) $(thread_test_OBJECTS) $(thread_test_LDADD) $(LIBS)
+       $(CXXLINK) $(thread_test_LDFLAGS) $(thread_test_OBJECTS) $(thread_test_LDADD) $(LIBS)
 
 mostlyclean-compile:
        -rm -f *.$(OBJEXT)
[6 Mar 2009 11:46] Daniel Fischer
Sveta, I can't reproduce this. Can you attach more details as to how you are building? Which version of Sun Studio are you using? Is there a log file from configure? Are you using any specific settings for CC or CXX?
[6 Apr 2009 23:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
[7 Apr 2009 6:28] Sveta Smirnova
This seems to be Sun Studio 10: Sun C++ 5.7 2005/01/07
[15 Apr 2009 11:11] Sveta Smirnova
Same with Sun Studio 12
[24 Apr 2009 0:25] John Gilbert
I've hit the same problem, Solaris 10 10/08, x86_64, Sun Studio 12, MySQL 5.1.34.
The same workaround with minor tweaks for this version works.
[24 Apr 2009 2:53] John Gilbert
I've found a second issue related to this, building DBD::mysql works with a bit of makefile editing, but when I run "make test" it errors out with this message...

Error:  Can't load '/usr/local/src/DBD-mysql-4.011/blib/arch/auto/DBD/mysql/mysql.so' for module DBD::mysql: ld.so.1: perl: fatal: relocation error: file /usr/local/src/DBD-mysql-4.011/blib/arch/auto/DBD/mysql/mysql.so: symbol __1cG__CrunMex_rethrow_q6F_v_: referenced symbol not found at /usr/local/lib/perl5/5.8.9/i86pc-solaris-thread-multi-64-ld/DynaLoader.pm line 226.

If you google the CrunMex_rethrow word and DynaLoader, you get a few hits dating back to 2006. I think all of this has to do with -fast. I'm going back to see how things behave with -xO3.
[24 Apr 2009 3:30] John Gilbert
Wicked, I just added -lCrun to the Makefile in DBD::mysql (switching over to -xO3 didn't fix anything), and the problem went away!
Looks like it's a library dependence issue. Might fix the above problem as well.
[20 May 2009 10:29] John Embretsen
I have the same issue compiling MySQL on various Solaris platforms using Sun Studio 12. My current workaround is to not include --with-ssl.

I hope the following will help for reproducing this issue:

CONFIGURE_LINE="./configure  
'CC=/usr/local/bin/ccache /opt/studio12/SUNWspro/bin/cc' 
'CXX=/usr/local/bin/ccache /opt/studio12/SUNWspro/bin/CC' 
'CFLAGS=-g -m64 -mt' 
'CXXFLAGS=-g -m64 -mt' 
'LDFLAGS=-m64' 
'ASFLAGS=-m64' 
'PKG_CONFIG_PATH=/usr/lib/64/pkgconfig' 
'--enable-dtrace' 
'--with-debug=full' 
'--with-embedded-server' 
'--with-extra-charsets=complex' 
'--with-plugins=max-no-ndb' 
'--with-ssl' 
'--with-client-ldflags=-static' 
'--with-mysqld-ldflags=-static' "
[5 Oct 2009 9:56] Jonathan Perkin
This is likely due to yaSSL requiring libCrun, will hopefully get to look at this soon.
[1 Jul 2010 20:06] Davi Arnaut
Just hit this while testing some yassl changes on solaris 32bits, building without the -noex flag.

$ dem __1cG__CrunMex_rethrow_q6F_v_
__1cG__CrunMex_rethrow_q6F_v_ == void __Crun::ex_rethrow_q()

Similar to Bug#18815, can probably be worked around by defining a no-op ex_rethrow_q, similar to what was done for pure_error.
[25 Oct 2018 6:38] Erlend Dahl
Fixed as part of the move to CMake.