[MDEV-17009] PIE issue on FreeBSD after 10.3.9 update Created: 2018-08-17  Updated: 2018-09-21  Resolved: 2018-09-21

Status: Closed
Project: MariaDB Server
Component/s: Compiling
Affects Version/s: 10.3.9
Fix Version/s: 10.3.10

Type: Bug Priority: Blocker
Reporter: Bernard Spil Assignee: Sergei Golubchik
Resolution: Fixed Votes: 0
Labels: regression
Environment:

FreeBSD 11.2 GENERIC
FreeBSD clang version 6.0.0 (tags/RELEASE_600/final 326565) (based on LLVM 6.0.0)
CMake 3.12.0



 Description   

After the update of MariaDB 10.3 to 10.3.9, it fails to build due to missing `-fPIC` in CFLAGS and CXXFLAGS. Some components are built without `-fPIC` resulting in linking issues.

Haven't been able to trace down the change in cmake files that leads to this.



 Comments   
Comment by Bernard Spil [ 2018-08-17 ]

Build error:

[ 49%] Linking CXX shared module ha_archive.so
cd /usr/ports/databases/mariadb103-server/work/mariadb-10.3.9/storage/archive && /usr/local/bin/cmake -E cmake_link_script CMakeFiles/archive.dir/link.txt --verbose=1
/usr/bin/c++ -fPIC -O2 -pipe -fstack-protector -isystem /usr/local/include -fno-strict-aliasing  -isystem /usr/local/include -Wl,-z,relro,-z,now -fstack-protector --param=ssp-buffer-size=4 -fno-rtti -O2 -pipe -fstack-protector -isystem /usr/local/include -fno-strict-aliasing  -isystem /usr/local/include -D_FORTIFY_SOURCE=2 -DDBUG_OFF   -fstack-protector -shared  -o ha_archive.so CMakeFiles/archive.dir/azio.c.o CMakeFiles/archive.dir/ha_archive.cc.o -pthread ../../libservices/libmysqlservices.a -lz ../../sql/libsql.a ../csv/libcsv.a ../heap/libheap.a ../innobase/libinnobase.a -llzma -lbz2 ../maria/libaria.a ../myisam/libmyisam.a ../myisammrg/libmyisammrg.a ../perfschema/libperfschema.a ../sequence/libsequence.a ../../plugin/feedback/libfeedback.a ../../plugin/user_variables/libuser_variables.a ../../plugin/userstat/libuserstat.a ../../sql/libpartition.a ../../sql/libsql_sequence.a ../../mysys/libmysys.a ../../mysys_ssl/libmysys_ssl.a ../../dbug/libdbug.a ../../mysys/libmysys.a ../../mysys_ssl/libmysys_ssl.a ../../dbug/libdbug.a -lz -lm -lexecinfo ../../strings/libstrings.a ../../vio/libvio.a ../../pcre/libpcre.a -lwrap -lcrypt -lssl -lcrypto ../../wsrep/libwsrep.a -pthread
/usr/bin/ld: ../../sql/libsql.a(field.cc.o): relocation R_X86_64_32S against `a local symbol' can not be used when making a shared object; recompile with -fPIC
../../sql/libsql.a: could not read symbols: Bad value
c++: error: linker command failed with exit code 1 (use -v to see invocation)
*** Error code 1

Comment by Sergei Golubchik [ 2018-08-20 ]

What CMake version do you have?

Comment by Bernard Spil [ 2018-08-20 ]

We're at 3.12.0 according to my build logs
> Installing cmake-3.12.0_1...

Generated at Thu Feb 08 08:33:13 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.