Skip to content

Commit cf7a19a

Browse files
author
Tor Didriksen
committed
Bug #18593044 COMPILE FLAGS NOT PASSED TO DTRACE, BREAKS CROSS BUILD
RHEL7/Oracle Linux 7 comes in 64 bits variants only, however at least libraries are required in 32 bits versions too. Going forward there might be need for 32 bits clients. RHEL/OL7 supports cross build of 32 bits binaries on 64 bits platform. This works just fine for MySQL server also, however when dtrace is enabled build fails. Due to the fact that dtrace on Linux is running gcc and reading CFLAGS from environment only. (Just reading last part of /usr/bin/dtrace to verify this). When cross building a 32 bits server package, flags includes -m32, however this is not passed to dtrace, which builds a 64 bits probes_mysql.o, which cause link error by mixing 32 of 64 bits object files.
1 parent ba347d2 commit cf7a19a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

cmake/dtrace.cmake

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
1+
# Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
22
#
33
# This program is free software; you can redistribute it and/or modify
44
# it under the terms of the GNU General Public License as published by
@@ -110,12 +110,16 @@ FUNCTION(DTRACE_INSTRUMENT target)
110110
WORKING_DIRECTORY ${objdir}
111111
)
112112
ELSEIF(CMAKE_SYSTEM_NAME MATCHES "Linux")
113+
# dtrace on Linux runs gcc and uses flags from environment
114+
SET(CFLAGS_SAVED $ENV{CFLAGS})
115+
SET(ENV{CFLAGS} ${CMAKE_C_FLAGS})
113116
SET(outfile "${CMAKE_BINARY_DIR}/probes_mysql.o")
114117
# Systemtap object
115118
EXECUTE_PROCESS(
116119
COMMAND ${DTRACE} -G -s ${CMAKE_SOURCE_DIR}/include/probes_mysql.d.base
117120
-o ${outfile}
118121
)
122+
SET(ENV{CFLAGS} ${CFLAGS_SAVED})
119123
ENDIF()
120124

121125
# Do not try to extend the library if we have not built the .o file

0 commit comments

Comments
 (0)