{"action":"created","issue":{"url":"https://api.github.com/repos/InBetweenNames/gentooLTO/issues/141","repository_url":"https://api.github.com/repos/InBetweenNames/gentooLTO","labels_url":"https://api.github.com/repos/InBetweenNames/gentooLTO/issues/141/labels{/name}","comments_url":"https://api.github.com/repos/InBetweenNames/gentooLTO/issues/141/comments","events_url":"https://api.github.com/repos/InBetweenNames/gentooLTO/issues/141/events","html_url":"https://github.com/InBetweenNames/gentooLTO/issues/141","id":348424217,"node_id":"MDU6SXNzdWUzNDg0MjQyMTc=","number":141,"title":"cargo building requires --no-as-needed","user":{"login":"eugene-bright","id":39331266,"node_id":"MDQ6VXNlcjM5MzMxMjY2","avatar_url":"https://avatars1.githubusercontent.com/u/39331266?v=4","gravatar_id":"","url":"https://api.github.com/users/eugene-bright","html_url":"https://github.com/eugene-bright","followers_url":"https://api.github.com/users/eugene-bright/followers","following_url":"https://api.github.com/users/eugene-bright/following{/other_user}","gists_url":"https://api.github.com/users/eugene-bright/gists{/gist_id}","starred_url":"https://api.github.com/users/eugene-bright/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eugene-bright/subscriptions","organizations_url":"https://api.github.com/users/eugene-bright/orgs","repos_url":"https://api.github.com/users/eugene-bright/repos","events_url":"https://api.github.com/users/eugene-bright/events{/privacy}","received_events_url":"https://api.github.com/users/eugene-bright/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2018-08-07T17:51:55Z","updated_at":"2018-08-08T14:34:08Z","closed_at":null,"author_association":"NONE","body":"Compilation of cargo fails at the very late linking process if option `LDFLAGS+=\"-Wl,--as-needed\"` is enabled.\r\nAt the first glance it seems that libssh2 causes troubles but it's not. The error keeps the same if libssh2 is built without LTO.\r\n```\r\n  = note: /usr/lib/gcc/x86_64-pc-linux-gnu/7.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: /var/tmp/portage/dev-util/cargo-0.29.0/work/cargo-0.29.0/target/release/deps/liblibssh2_sys-79f68005d05542bc.rlib(libssh2_sys-79f68005d05542bc.libssh2_sys2-688af8bdebcb978a29e097a96822ec6d.rs.rcgu.o): undefined reference to symbol 'libssh2_exit'\r\n```\r\nAppending `LDFLAGS+=\"-Wl,--no-as-needed\"` is a workaround.\r\nJust be aware of it.\r\n\r\nI'm experimenting with LTO in my own way. I found [gentoo environment control](https://wiki.gentoo.org/wiki//etc/portage/package.env) mechanism to be a very powerful tool. It provides me to append arbitrary flags for any chosen package on individual basis and thus allows keeping global configuration to be the most generic (I've enabled LTO globally). Also I can stack more then one overlaying environment adjusting scripts.\r\nAs example:\r\n```\r\n$ cat /etc/portage/package.env/cargo \r\ndev-util/cargo no_lto no_as_needed\r\n```\r\n\r\n```\r\n$ cat /etc/portage/env/no_lto \r\nCFLAGS=\"$CFLAGS -fno-lto\"\r\nCXXFLAGX=\"$CFLAGS\"\r\nLDFLAGS=\"$LDFLAGS -Wl,-fno-lto\"\r\n```\r\n\r\n```\r\n$ cat /etc/portage/env/no_as_needed \r\nLDFLAGS=\"$LDFLAGS -Wl,--no-as-needed\"\r\n```"},"comment":{"url":"https://api.github.com/repos/InBetweenNames/gentooLTO/issues/comments/411427788","html_url":"https://github.com/InBetweenNames/gentooLTO/issues/141#issuecomment-411427788","issue_url":"https://api.github.com/repos/InBetweenNames/gentooLTO/issues/141","id":411427788,"node_id":"MDEyOklzc3VlQ29tbWVudDQxMTQyNzc4OA==","user":{"login":"InBetweenNames","id":7820684,"node_id":"MDQ6VXNlcjc4MjA2ODQ=","avatar_url":"https://avatars1.githubusercontent.com/u/7820684?v=4","gravatar_id":"","url":"https://api.github.com/users/InBetweenNames","html_url":"https://github.com/InBetweenNames","followers_url":"https://api.github.com/users/InBetweenNames/followers","following_url":"https://api.github.com/users/InBetweenNames/following{/other_user}","gists_url":"https://api.github.com/users/InBetweenNames/gists{/gist_id}","starred_url":"https://api.github.com/users/InBetweenNames/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/InBetweenNames/subscriptions","organizations_url":"https://api.github.com/users/InBetweenNames/orgs","repos_url":"https://api.github.com/users/InBetweenNames/repos","events_url":"https://api.github.com/users/InBetweenNames/events{/privacy}","received_events_url":"https://api.github.com/users/InBetweenNames/received_events","type":"User","site_admin":false},"created_at":"2018-08-08T14:34:08Z","updated_at":"2018-08-08T14:34:08Z","author_association":"OWNER","body":"No problem!  I agree, `flag-o-matic` needs a major overhaul.  I'd do it myself, but I know for sure it would get rejected upstream.  Ideally, we could overhaul that and switch back to `package.env`, but here we are I guess!"}}
{"actor":{"display_login":"InBetweenNames"}}