Skip to content

Commit

Permalink
build: don't pass LDFLAGS from environment to curl
Browse files Browse the repository at this point in the history
After ea5929d ('build: fix OpenSSL
linking problems on FreeBSD') we set CFLAGS explicitly (possibly to an
empty value) when invoking a configure script for curl. When this
parameter is set the script does not use a value of environment variable
CFLAGS.

Before this commit LDFLAGS environment variable can affect build of curl
submodule. This can lead to a problem when a user or a tool set CFLAGS
and LDFLAGS both and some linker flag assumes that some compilation flag
is present. Here we set empty LDFLAGS explicitly to avoid using of the
environment variable.

A distributive build tool such as rpmbuild or emerge usually sets CFLAGS
and LDFLAGS. The problem with incompatible compiler / linker options has
been reveal under rpmbuild on CentOS 8 with hardened build enabled
(which is so when backtraces are disabled).

It is not clear whether we should follow environment variables or values
determined by CMake for CFLAGS, CPPFLAGS and LDFLAGS when building a
submodule (such as luajit and curl). Let's decide about this later.

Part of #4543.
  • Loading branch information
Totktonada committed Nov 8, 2019
1 parent ee60d31 commit 41359c8
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions cmake/BuildLibCURL.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,20 @@ macro(curl_build)

# Pass -isysroot=<SDK_PATH> option on Mac OS, see
# above.
# Note: Passing of CPPFLAGS / CFLAGS explicitly
# discards using of corresponsing environment
# variables.
CPPFLAGS=${LIBCURL_CPPFLAGS}
CFLAGS=${LIBCURL_CFLAGS}

# Pass empty LDFLAGS to discard using of
# corresponding environment variable.
# It is possible that a linker flag assumes that
# some compilation flag is set. We don't pass
# CFLAGS from environment, so we should not do it
# for LDFLAGS too.
LDFLAGS=

--prefix <INSTALL_DIR>
--enable-static
--enable-shared
Expand Down

0 comments on commit 41359c8

Please sign in to comment.