Bug #12324 Building with YaSSL does not honour the --with-pic configuration flag
Description:
Creating the shared mysqlclient libraries on Linux/AMD64 requires compiling the source by using the --with-pic configure option. This will add "-fPIC" to the compiler flags that will allow the creation of position-independent code. However, it seems like the YaSSL makefiles don't honor this option, the creation of the shared library still fails with the following error:
gcc -shared .libs/libmysql.o .libs/password.o .libs/manager.o .libs/get_password.o .libs/errmsg.o .libs/my_init.o .libs/my_static.o .libs/my_malloc.o .libs/my_realloc.o .libs/my_create.o .libs/my_delete.o .libs/mf_tempfile.o .libs/my_open.o .libs/my_file.o .libs/my_read.o .libs/my_write.o .libs/errors.o .libs/my_error.o .libs/my_getwd.o .libs/my_div.o .libs/mf_pack.o .libs/my_messnc.o .libs/mf_dirname.o .libs/mf_fn_ext.o .libs/mf_wcomp.o .libs/typelib.o .libs/safemalloc.o .libs/my_alloc.o .libs/mf_format.o .libs/mf_path.o .libs/mf_unixpath.o .libs/my_fopen.o .libs/my_symlink.o .libs/my_fstream.o .libs/mf_loadpath.o .libs/my_pthread.o .libs/my_thr_init.o .libs/thr_mutex.o .libs/mulalloc.o .libs/string.o .libs/default.o .libs/default_modify.o .libs/my_compress.o .libs/array.o .libs/my_once.o .libs/list.o .libs/my_net.o .libs/charset.o .libs/charset-def.o .libs/hash.o .libs/mf_iocache.o .libs/mf_iocache2.o .libs/my_seek.o .libs/my_sleep.o .libs/my_pread.o .libs/mf_cache.o .libs/md5.o .libs/sha1.o .libs/my_getopt.o .libs/my_gethostbyname.o .libs/my_port.o .libs/my_rename.o .libs/my_chsize.o .libs/my_lib.o .libs/strmov.o .libs/strxmov.o .libs/strxnmov.o .libs/strnmov.o .libs/strmake.o .libs/strend.o .libs/strtod.o .libs/strnlen.o .libs/strfill.o .libs/is_prefix.o .libs/int2str.o .libs/str2int.o .libs/strinstr.o .libs/strcont.o .libs/strcend.o .libs/bcmp.o .libs/ctype-latin1.o .libs/bchange.o .libs/bmove.o .libs/bmove_upp.o .libs/longlong2str.o .libs/strtoull.o .libs/strtoll.o .libs/llstr.o .libs/my_vsnprintf.o .libs/ctype.o .libs/ctype-simple.o .libs/ctype-bin.o .libs/ctype-mb.o .libs/ctype-big5.o .libs/ctype-czech.o .libs/ctype-cp932.o .libs/ctype-eucjpms.o .libs/ctype-euc_kr.o .libs/ctype-win1250ch.o .libs/ctype-utf8.o .libs/ctype-extra.o .libs/ctype-ucs2.o .libs/ctype-gb2312.o .libs/ctype-gbk.o .libs/ctype-sjis.o .libs/ctype-tis620.o .libs/ctype-ujis.o .libs/ctype-uca.o .libs/xml.o .libs/my_strtoll10.o .libs/dbug.o .libs/pack.o .libs/client.o .libs/my_time.o .libs/vio.o .libs/viosocket.o .libs/viossl.o .libs/viosslfactories.o .libs/net.o -lpthread -lcrypt -lnsl -lm -lpthread -lz -L/home/mysqldev/rpm/BUILD/mysql-5.0.10-beta/extra/yassl/src -lyassl -L/home/mysqldev/rpm/BUILD/mysql-5.0.10-beta/extra/yassl/taocrypt/src -ltaocrypt -Wl,-soname -Wl,libmysqlclient_r.so.15 -o .libs/libmysqlclient_r.so.15.0.0
/usr/bin/ld: /home/mysqldev/rpm/BUILD/mysql-5.0.10-beta/extra/yassl/src/libyassl.a(ssl.o): relocation R_X86_64_32 can not be used when making a shared object; recompile with -fPIC
/home/mysqldev/rpm/BUILD/mysql-5.0.10-beta/extra/yassl/src/libyassl.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
make[2]: *** [libmysqlclient_r.la] Error 1
make[2]: Leaving directory `/home/mysqldev/rpm/BUILD/mysql-5.0.10-beta/libmysql_r'
Looking at the YaSSL compile lines, it indeed does not look like as if "-fPIC" is passed to the compiler - see the attached log file.
How to repeat:
Try to compile MySQL 5.0 with the following compile options "--with-yassl --with-pic --enable-shared" and observe the error during the creation of the shared lib.
Suggested fix:
Make sure the YaSSL builds take these compile options into account
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.056 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders.
It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.