Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 567050 - net-analyzer/icinga2-2.4.0-r1 adds "-g" to *FLAGS
Summary: net-analyzer/icinga2-2.4.0-r1 adds "-g" to *FLAGS
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Matthew Thode ( prometheanfire )
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-11-28 22:13 UTC by Marcin Mirosław
Modified: 2016-01-18 16:20 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marcin Mirosław 2015-11-28 22:13:49 UTC
Icinga2 adds "-g" to compiler flags, this makes building much more CPU and RAM intensive (and its problematic to compile it on vps).

-- <<< Gentoo configuration >>>
Build type      Gentoo
Install path    /usr
Compiler flags:
C               -O1 -march=native -s  -g
C++             -O1 -march=native -s  -g -std=c++11 -Wno-inconsistent-missing-override
Linker flags:
Executable       -Wl,-O1 -Wl,--as-needed -Wl,--sort-common -Wl,--gc-sections -Wl,--no-export-dynamic -Bsymbolic-functions -Wl,--dynamic-list-cpp-typeinfo -Wl,
--dynamic-list-data
Module           -Wl,-O1 -Wl,--as-needed -Wl,--sort-common
Shared           -Wl,-O1 -Wl,--as-needed -Wl,--sort-common -Wl,--gc-sections -Wl,--no-export-dynamic -Bsymbolic-functions -Wl,--dynamic-list-cpp-typeinfo -Wl,
--dynamic-list-data



This comes from CMakeLists.txt:
if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
  if(CMAKE_SYSTEM_NAME MATCHES AIX)
    set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -g -lpthread")
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -lpthread")
  elseif(CMAKE_SYSTEM_NAME MATCHES "kOpenBSD.*|OpenBSD.*")
    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -pthread")
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -pthread")
    set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lpthread")
    set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -lpthread")
  else()
    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g")
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g")
  endif()
... 

Reproducible: Always



Expected Results:  
remove "-g" from CXXFLAGS 

Installed sets: @ # emerge --info
Portage 2.2.20.1 (python 3.4.3-final-0, hardened/linux/amd64/no-multilib, gcc-4.9.3, glibc-2.21-r1, 4.1.7-hardened-r1 x86_64)
=================================================================
System uname: Linux-4.1.7-hardened-r1-x86_64-Intel-R-_Xeon-R-_CPU_E5-2630_v2_@_2.60GHz-with-gentoo-2.2
KiB Mem:     1018476 total,     25748 free
KiB Swap:     819196 total,    536216 free
Timestamp of repository gentoo: Sat, 28 Nov 2015 14:30:01 +0000
sh bash 4.3_p39
ld GNU gold (Gentoo 2.25.1 p1.1 2.25.1) 1.11
ccache version 3.1.9 [enabled]
app-shells/bash:          4.3_p39::gentoo
dev-lang/perl:            5.20.2::gentoo
dev-lang/python:          2.7.10-r1::gentoo, 3.3.5-r1::gentoo, 3.4.3::gentoo
dev-util/ccache:          3.1.9-r4::gentoo
dev-util/cmake:           3.3.1-r1::gentoo
dev-util/pkgconfig:       0.28-r2::gentoo
sys-apps/baselayout:      2.2::gentoo
sys-apps/openrc:          0.17::gentoo
sys-apps/sandbox:         2.6-r1::gentoo
sys-devel/autoconf:       2.69::gentoo
sys-devel/automake:       1.13.4::gentoo, 1.14.1::gentoo, 1.15::gentoo
sys-devel/binutils:       2.25.1-r1::gentoo
sys-devel/gcc:            4.8.5::gentoo, 4.9.3::gentoo
sys-devel/gcc-config:     1.7.3::gentoo
sys-devel/libtool:        2.4.6::gentoo
sys-devel/make:           4.1-r1::gentoo
sys-kernel/linux-headers: 3.18::gentoo (virtual/os-headers)
sys-libs/glibc:           2.21-r1::gentoo
Repositories:

gentoo
    location: /usr/portage
    sync-type: rsync
    sync-uri: rsync://rsync.gentoo.org/gentoo-portage
    priority: -1000

Installed sets: nagios-plugins, @sheepdog
ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O1 -march=native -s"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/easy-rsa /usr/share/gnupg/qualified.txt /var/bind"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5.6/ext-active/ /etc/php/cgi-php5.6/ext-active/ /etc/php/cli-php5.6/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O1 -march=native -s"
DISTDIR="/usr/portage/distfiles"
FCFLAGS="-O1 -march=native -s"
FEATURES="assume-digests binpkg-logs ccache cgroup collision-protect compressdebug config-protect-if-modified distlocks ebuild-locks fixlafiles news parallel-fetch parallel-install preserve-libs protect-owned sandbox sfperms strict unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O1 -march=native -s"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="pl_PL.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,--sort-common"
MAKEOPTS="-j1"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_EXTRA_OPTS="-O"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
USE="acl aio amd64 apache2 bash-completion bzip2 caps cli cracklib crypt cxx dri hardened iconv idn ipv6 justify lto mmx mmxext modules ncurses nls nptl openmp pax_kernel pcre pie readline seccomp session smp sse sse2 ssl ssp threads unicode urandom vhosts vim-syntax xattr xtpax zlib" ABI_X86="64" APACHE2_MODULES="alias auth_basic authn_alias authn_anon auth_digest authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cgi dav dav_fs dav_lock dir env expires ext_filter filter headers include info log_config logio mime mime_magic negotiation rewrite setenvif status unique_id usertrack vhost_alias" APACHE2_MPMS="itk" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" COLLECTD_PLUGINS="apache aggregation bind cgroups conntrack contextswitch cpu curl curl_json df disk dns email entropy ethstat exec filecount interface iptables irq lvm match_regex mysql netlink load memory network nginx notify_email ntpd openvpn ping postgresql processes protocols rrdcached rrdtool snmp statsd swap syslog tail tcpconns unixsock uptime vmem" CPU_FLAGS_X86="mmx mmxext sse sse2 sse3 sse4 sse4.1 ssse3" ELIBC="glibc" KERNEL="linux" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="en" NGINX_MODULES_HTTP="access browser charset gzip map limit_zone proxy rewrite spdy stub_status gzip_static" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-6" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_4" USERLAND="GNU" XTABLES_ADDONS="fuzzy geoip lscan psd sysrq tarpit"
Unset:  CC, CPPFLAGS, CTARGET, CXX, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, USE_PYTHON
Comment 1 Marcin Mirosław 2015-11-30 09:52:41 UTC
I'm also getting compilation error due to missing "-lpthread":

[ 94%] Linking CXX executable ../Bin/Gentoo/icinga2
cd /var/tmp/portage/net-analyzer/icinga2-2.4.1/work/icinga2-2.4.1_build/icinga-app && /usr/bin/cmake -E cmake_link_script CMakeFiles/icinga-app.dir/link.txt --verbose=1
/usr/lib64/ccache/bin/x86_64-pc-linux-gnu-g++   -O2 -pipe -march=corei7 -mtune=native         -fno-unwind-tables -fno-asynchronous-unwind-tables -fuse-linker-plugin -s        -fexpensive-optimizations -fgraphite-identity -floop-interchange         -ftree-loop-linear -floop-block -floop-strip-mine -fira-loop-pressure        -fpredictive-commoning -freorder-blocks-and-partition -ftracer -ftree-vectorize        -fuse-ld=gold -fvar-tracking-assignments  -g -flto -fno-fat-lto-objects -std=c++11 -Wno-inconsistent-missing-override   -Wl,-O1 -Wl,--as-needed -Wl,--sort-common -Wl,--gc-sections -Wl,--no-export-dynamic -Bsymbolic-functions -Wl,--dynamic-list-cpp-typeinfo -Wl,--dynamic-list-data -flto CMakeFiles/icinga-app.dir/icinga.cpp.o  -o ../Bin/Gentoo/icinga2 -rdynamic -lboost_thread-mt -lboost_system-mt -lboost_program_options-mt -lboost_regex-mt ../Bin/Gentoo/libcli.so ../Bin/Gentoo/libremote.so ../Bin/Gentoo/libconfig.so ../Bin/Gentoo/libbase.so -ldl -lboost_thread-mt -lboost_system-mt -lboost_program_options-mt -lboost_regex-mt -lssl -lcrypto -lyajl ../Bin/Gentoo/libmmatch.so ../Bin/Gentoo/libsocketpair.so ../Bin/Gentoo/libexecvpe.so -ledit -lncurses -Wl,-rpath,/var/tmp/portage/net-analyzer/icinga2-2.4.1/work/icinga2-2.4.1_build/Bin/Gentoo: 
../Bin/Gentoo/libbase.so: error: undefined reference to 'pthread_mutexattr_destroy'
../Bin/Gentoo/libbase.so: error: undefined reference to 'pthread_mutexattr_settype'
../Bin/Gentoo/libbase.so: error: undefined reference to 'pthread_mutexattr_init'
collect2: error: ld returned 1 exit status
Comment 2 Matthew Thode ( prometheanfire ) archtester Gentoo Infrastructure gentoo-dev Security 2015-12-25 20:21:09 UTC
fixed in 2.4.1-r1
Comment 3 Marcin Mirosław 2015-12-26 20:00:07 UTC
Thanks but you missed bug from comment #1.
Comment 4 Matthew Thode ( prometheanfire ) archtester Gentoo Infrastructure gentoo-dev Security 2015-12-26 22:49:54 UTC
and what was it?  I don't see it.
Comment 5 Marcin Mirosław 2015-12-27 08:54:40 UTC
In comment #1 I wrote that linking fails due to missing "-lpthread" flag. This bug still exists.
Comment 6 Matthew Thode ( prometheanfire ) archtester Gentoo Infrastructure gentoo-dev Security 2016-01-05 15:10:29 UTC
Are you saying that -lpthread needs to be added to the flags?

This seems like two bugs in one report.
Comment 7 Marcin Mirosław 2016-01-05 15:20:16 UTC
Yes and yes:)
Comment 8 Matthew Thode ( prometheanfire ) archtester Gentoo Infrastructure gentoo-dev Security 2016-01-05 15:22:59 UTC
 src_configure() {
-	sed -i 's/FLAGS\}\ \-g/FLAGS\}\ /g' CMakeLists.txt || die
+	sed -i 's/FLAGS\}\ \-g/FLAGS\}\ \-lpthread\ /g' CMakeLists.txt || die


that's the edit I'm making then
Comment 9 Marcin Mirosław 2016-01-05 15:39:18 UTC
I can't test it now (I'm going away from box) but it looks it would be better to add "-lpthread" to CMAKE_MODULE_LINKER_FLAGS. But I'm not sure if it can be done in ebuild or by seding CMakeLists.txt.
Comment 10 Matthew Thode ( prometheanfire ) archtester Gentoo Infrastructure gentoo-dev Security 2016-01-05 15:45:28 UTC
if you can test it I'll update the ebuild if it works (since I can't reproduce the bug locally)
Comment 11 Marcin Mirosław 2016-01-05 19:29:44 UTC
(In reply to Matthew Thode ( prometheanfire ) from comment #10)
> (since I can't reproduce the bug locally)

This is interesting. Could you tell me if you have dev-libs/boost compiled with or without threads?
Comment 12 Matthew Thode ( prometheanfire ) archtester Gentoo Infrastructure gentoo-dev Security 2016-01-05 19:31:08 UTC
with threads, I could just as that as a use flag constraint on the boost dep
Comment 13 Marcin Mirosław 2016-01-05 19:37:05 UTC
I'm looking what is the difference beetwen my OS and yours. On my box even with USE="-* minimal" icinga fails to link with error "undefined reference ...".
Comment 14 Matthew Thode ( prometheanfire ) archtester Gentoo Infrastructure gentoo-dev Security 2016-01-05 19:41:18 UTC
iirc -* isn't supported in use flags
Comment 15 Marcin Mirosław 2016-01-05 19:46:04 UTC
I was talking only about icinga and reproducing problem with lining:)
Comment 16 Matthew Thode ( prometheanfire ) archtester Gentoo Infrastructure gentoo-dev Security 2016-01-18 01:03:17 UTC
were you able to test with CMAKE_MODULE_LINKER_FLAGS?
Comment 17 Marcin Mirosław 2016-01-18 16:10:28 UTC
I thought you forgot about this closed bug;)
I didn't tested CMAKE_MODULE_LINKER_FLAGS because I found in meantime why you can't reproduce problem. It's because you don't use gold linker. So it is either bug in gold linker or underlinking. It deserves for new bug but I'm not sure if you are willing to spend time and look deeper into this.
Comment 18 Matthew Thode ( prometheanfire ) archtester Gentoo Infrastructure gentoo-dev Security 2016-01-18 16:20:13 UTC
I probably wouldn't care about it as a icinga2 bug at least