[MDEV-7293] Compilation on FreeBSD 10.1 fails building mroonga storage engine Created: 2014-12-08  Updated: 2015-03-05  Resolved: 2015-03-05

Status: Closed
Project: MariaDB Server
Component/s: Compiling, Storage Engine - Mroonga
Affects Version/s: 10.0.15
Fix Version/s: 10.0.17

Type: Bug Priority: Major
Reporter: Thomas Hays Assignee: Kentoku Shiba (Inactive)
Resolution: Fixed Votes: 1
Labels: None
Environment:

FreeBSD 10.1-RELEASE AMD64.



 Description   

Noticed compile failure building from the Official 10.1 source (not PORTS) on FreeBSD 10.1.

cmake . -DBUILD_CONFIG=mysql_release
gmake VERBOSE=1

Linking CXX shared module ha_mroonga.so
cd /root/src/a/mariadb-10.0.15/storage/mroonga && /usr/local/bin/cmake -E cmake_link_script CMakeFiles/mroonga.dir/link.txt --verbose=1
/usr/bin/CC  -fPIC -O2 -g -DNDEBUG -DDBUG_OFF   -shared -Wl,-soname,ha_mroonga.so -o ha_mroonga.so CMakeFiles/mroonga.dir/ha_mroonga.cpp.o CMakeFiles/mroonga.dir/mrn_table.cpp.o CMakeFiles/mroonga.dir/udf/mrn_udf_last_insert_grn_id.cpp.o CMakeFiles/mroonga.dir/udf/mrn_udf_snippet.cpp.o CMakeFiles/mroonga.dir/udf/mrn_udf_command.cpp.o CMakeFiles/mroonga.dir/udf/mrn_udf_escape.cpp.o CMakeFiles/mroonga.dir/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/normalizers/mysql.c.o CMakeFiles/mroonga.dir/lib/mrn_index_table_name.cpp.o CMakeFiles/mroonga.dir/lib/mrn_index_column_name.cpp.o CMakeFiles/mroonga.dir/lib/mrn_debug_column_access.cpp.o CMakeFiles/mroonga.dir/lib/mrn_auto_increment_value_lock.cpp.o CMakeFiles/mroonga.dir/lib/mrn_external_lock.cpp.o CMakeFiles/mroonga.dir/lib/mrn_multiple_column_key_codec.cpp.o CMakeFiles/mroonga.dir/lib/mrn_field_normalizer.cpp.o CMakeFiles/mroonga.dir/lib/mrn_encoding.cpp.o CMakeFiles/mroonga.dir/lib/mrn_parameters_parser.cpp.o CMakeFiles/mroonga.dir/lib/mrn_lock.cpp.o CMakeFiles/mroonga.dir/lib/mrn_condition_converter.cpp.o CMakeFiles/mroonga.dir/lib/mrn_time_converter.cpp.o CMakeFiles/mroonga.dir/lib/mrn_database_manager.cpp.o CMakeFiles/mroonga.dir/lib/mrn_match_escalation_threshold_scope.cpp.o CMakeFiles/mroonga.dir/lib/mrn_path_mapper.cpp.o CMakeFiles/mroonga.dir/lib/mrn_smart_grn_obj.cpp.o  -L/root/src/a/mariadb-10.0.15/storage/mroonga/vendor/groonga/lib  -L/root/src/a/mariadb-10.0.15/libservices -lpthread ../../libservices/libmysqlservices.a vendor/groonga/lib/libgroonga.a vendor/groonga/lib/libgroonga.a -lpthread -lexecinfo -lrt -lpthread -lm -lstdc++ -Wl,-rpath,/root/src/a/mariadb-10.0.15/storage/mroonga/vendor/groonga/lib:/root/src/a/mariadb-10.0.15/libservices:
/usr/bin/ld: vendor/groonga/lib/libgroonga.a(ctx.c.o): relocation R_X86_64_32S against `a local symbol' can not be used when making a shared object; recompile with -fPIC
vendor/groonga/lib/libgroonga.a: could not read symbols: Bad value
CC: error: linker command failed with exit code 1 (use -v to see invocation)
storage/mroonga/CMakeFiles/mroonga.dir/build.make:639: recipe for target 'storage/mroonga/ha_mroonga.so' failed
gmake[2]: *** [storage/mroonga/ha_mroonga.so] Error 1
gmake[2]: Leaving directory '/root/src/a/mariadb-10.0.15'
CMakeFiles/Makefile2:2727: recipe for target 'storage/mroonga/CMakeFiles/mroonga.dir/all' failed
gmake[1]: *** [storage/mroonga/CMakeFiles/mroonga.dir/all] Error 2
gmake[1]: Leaving directory '/root/src/a/mariadb-10.0.15'
Makefile:147: recipe for target 'all' failed
gmake: *** [all] Error 2

Platform information:

uname -a
FreeBSD SV-0560 10.1-RELEASE FreeBSD 10.1-RELEASE #0 r274401: Tue Nov 11 21:02:49 UTC 2014     root@releng1.nyi.freebsd.org:/usr/obj/usr/src/sys/GENERIC  amd64
 
cc -v
FreeBSD clang version 3.4.1 (tags/RELEASE_34/dot1-final 208032) 20140512
Target: x86_64-unknown-freebsd10.1



 Comments   
Comment by Bernard Spil [ 2014-12-31 ]

This is probably consuming all your memory. I believe the port fixes that (or PR is still open) by forcing GCC if built with mroonga or oqgraph.

Comment by Jeff Wommer [ 2015-01-29 ]

I get this same error with 10.0.15 and I'm also seeing it with the recently released 10.0.16.

Comment by Kouhei Sutou [ 2015-02-03 ]

I've fixed it at master in the Groonga repository. So the problem will be fixed when the latest Groonga is merged into MariaDB.

Here is a backport patch for MariaDB 10.0.16 as a workaround:

diff -ru mariadb-10.0.16.orig/storage/mroonga/vendor/groonga/CMakeLists.txt mariadb-10.0.16/storage/mroonga/vendor/groonga/CMakeLists.txt
--- mariadb-10.0.16.orig/storage/mroonga/vendor/groonga/CMakeLists.txt	2015-01-25 15:21:37.000000000 +0000
+++ mariadb-10.0.16/storage/mroonga/vendor/groonga/CMakeLists.txt	2015-02-03 12:30:52.672805056 +0000
@@ -137,7 +137,10 @@
   check_cxxflag("-fexceptions")
   check_cxxflag("-fimplicit-templates")
   check_build_flag("-Wno-clobbered")
-  if(MRN_GROONGA_BUNDLED)
+endif()
+
+if(MRN_GROONGA_BUNDLED)
+  if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
     check_build_flag("-fPIC")
   endif()
 endif()

Comment by Bernard Spil [ 2015-02-03 ]

Thanks for the patch Kouhei.

Just applied the patch and there's no change as far as I can see. Bailed out of the build when cc was using ca 5.6GB memory.

Comment by Kouhei Sutou [ 2015-02-04 ]

Thanks for trying it.

It's not related memory usage. It just fixes the following build error:

Linking CXX shared module ha_mroonga.so
cd /root/src/a/mariadb-10.0.15/storage/mroonga && /usr/local/bin/cmake -E cmake_link_script CMakeFiles/mroonga.dir/link.txt --verbose=1
/usr/bin/CC  -fPIC -O2 -g -DNDEBUG -DDBUG_OFF   -shared -Wl,-soname,ha_mroonga.so -o ha_mroonga.so CMakeFiles/mroonga.dir/ha_mroonga.cpp.o CMakeFiles/mroonga.dir/mrn_table.cpp.o CMakeFiles/mroonga.dir/udf/mrn_udf_last_insert_grn_id.cpp.o CMakeFiles/mroonga.dir/udf/mrn_udf_snippet.cpp.o CMakeFiles/mroonga.dir/udf/mrn_udf_command.cpp.o CMakeFiles/mroonga.dir/udf/mrn_udf_escape.cpp.o CMakeFiles/mroonga.dir/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/normalizers/mysql.c.o CMakeFiles/mroonga.dir/lib/mrn_index_table_name.cpp.o CMakeFiles/mroonga.dir/lib/mrn_index_column_name.cpp.o CMakeFiles/mroonga.dir/lib/mrn_debug_column_access.cpp.o CMakeFiles/mroonga.dir/lib/mrn_auto_increment_value_lock.cpp.o CMakeFiles/mroonga.dir/lib/mrn_external_lock.cpp.o CMakeFiles/mroonga.dir/lib/mrn_multiple_column_key_codec.cpp.o CMakeFiles/mroonga.dir/lib/mrn_field_normalizer.cpp.o CMakeFiles/mroonga.dir/lib/mrn_encoding.cpp.o CMakeFiles/mroonga.dir/lib/mrn_parameters_parser.cpp.o CMakeFiles/mroonga.dir/lib/mrn_lock.cpp.o CMakeFiles/mroonga.dir/lib/mrn_condition_converter.cpp.o CMakeFiles/mroonga.dir/lib/mrn_time_converter.cpp.o CMakeFiles/mroonga.dir/lib/mrn_database_manager.cpp.o CMakeFiles/mroonga.dir/lib/mrn_match_escalation_threshold_scope.cpp.o CMakeFiles/mroonga.dir/lib/mrn_path_mapper.cpp.o CMakeFiles/mroonga.dir/lib/mrn_smart_grn_obj.cpp.o  -L/root/src/a/mariadb-10.0.15/storage/mroonga/vendor/groonga/lib  -L/root/src/a/mariadb-10.0.15/libservices -lpthread ../../libservices/libmysqlservices.a vendor/groonga/lib/libgroonga.a vendor/groonga/lib/libgroonga.a -lpthread -lexecinfo -lrt -lpthread -lm -lstdc++ -Wl,-rpath,/root/src/a/mariadb-10.0.15/storage/mroonga/vendor/groonga/lib:/root/src/a/mariadb-10.0.15/libservices:
/usr/bin/ld: vendor/groonga/lib/libgroonga.a(ctx.c.o): relocation R_X86_64_32S against `a local symbol' can not be used when making a shared object; recompile with -fPIC
vendor/groonga/lib/libgroonga.a: could not read symbols: Bad value
CC: error: linker command failed with exit code 1 (use -v to see invocation)
storage/mroonga/CMakeFiles/mroonga.dir/build.make:639: recipe for target 'storage/mroonga/ha_mroonga.so' failed
gmake[2]: *** [storage/mroonga/ha_mroonga.so] Error 1
gmake[2]: Leaving directory '/root/src/a/mariadb-10.0.15'
CMakeFiles/Makefile2:2727: recipe for target 'storage/mroonga/CMakeFiles/mroonga.dir/all' failed
gmake[1]: *** [storage/mroonga/CMakeFiles/mroonga.dir/all] Error 2
gmake[1]: Leaving directory '/root/src/a/mariadb-10.0.15'
Makefile:147: recipe for target 'all' failed
gmake: *** [all] Error 2

Did you sitll get the error?

Comment by Jeff Wommer [ 2015-02-04 ]

Thanks for the patch Kouhei.

I applied it to 10.0.16 and had a successful build and install. The cc process did consume 100% of a CPU and just short of 5GB of memory, but it was successful. Thanks again!

Comment by Bernard Spil [ 2015-03-05 ]

Just built MariaDB 10.0.17 without error on FreeBSD 10.1 using clang. Could just be that I added 1GB memory but I'm taking a chance! 10.0.17 comes with a newer mroonga engine as well...
FreeBSD Port now defaults back to Clang.

Thanks!

Comment by Sergei Golubchik [ 2015-03-05 ]

Thanks, spil. Then I'll assume that the newer Mroonga fixed it and close the bug.
It can always be reopened later, if needed.

Generated at Thu Feb 08 07:18:29 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.