{"action":"created","issue":{"url":"https://api.github.com/repos/PCSX2/pcsx2/issues/1671","repository_url":"https://api.github.com/repos/PCSX2/pcsx2","labels_url":"https://api.github.com/repos/PCSX2/pcsx2/issues/1671/labels{/name}","comments_url":"https://api.github.com/repos/PCSX2/pcsx2/issues/1671/comments","events_url":"https://api.github.com/repos/PCSX2/pcsx2/issues/1671/events","html_url":"https://github.com/PCSX2/pcsx2/issues/1671","id":191026971,"number":1671,"title":"CMake doesn't properly generate when LTO is used","user":{"login":"np511","id":10342579,"avatar_url":"https://avatars.githubusercontent.com/u/10342579?v=3","gravatar_id":"","url":"https://api.github.com/users/np511","html_url":"https://github.com/np511","followers_url":"https://api.github.com/users/np511/followers","following_url":"https://api.github.com/users/np511/following{/other_user}","gists_url":"https://api.github.com/users/np511/gists{/gist_id}","starred_url":"https://api.github.com/users/np511/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/np511/subscriptions","organizations_url":"https://api.github.com/users/np511/orgs","repos_url":"https://api.github.com/users/np511/repos","events_url":"https://api.github.com/users/np511/events{/privacy}","received_events_url":"https://api.github.com/users/np511/received_events","type":"User","site_admin":false},"labels":[{"id":100270773,"url":"https://api.github.com/repos/PCSX2/pcsx2/labels/Build%20%7C%20Project%20System","name":"Build | Project System","color":"0052cc","default":false},{"id":88860180,"url":"https://api.github.com/repos/PCSX2/pcsx2/labels/Low%20Priority","name":"Low Priority","color":"bfdadc","default":false},{"id":88826696,"url":"https://api.github.com/repos/PCSX2/pcsx2/labels/OS:%20Linux","name":"OS: Linux","color":"fef2c0","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-11-22T14:48:21Z","updated_at":"2016-11-22T17:08:48Z","closed_at":null,"body":"***PCSX2 version:*** development build 1.5.0-dev-1638-g0d27586\r\n\r\n***PCSX2 options:***\r\nN/A\r\n\r\n***Plugins used:***\r\nN/A\r\n\r\n***Description of the issue:***\r\nWhen the USE_LTO option is selected, compilation fails. After doing some testing, I found that the problem is actually multiple problems:\r\n\r\n* For some odd reason, the generated link.txt files have \"--plugin /usr/lib/gcc/x86_64-linux-gnu/4.9/\" and then something along the lines of \"lto_plugin.so\". I manually fixed the problem so I can't say for certain. This might be acceptable - if GCC 4.9 was installed on my computer (it's not). I had to carefully run an find -exec sed type command to fix the problem without causing CMake to regenerate the files.\r\n* Even when I specify gcc-ar or /usr/bin/gcc-ar under CMAKE-AR, /usr/bin/ar is used. LTO does *not* work with the regular ar program. gcc-ar is needed.\r\n* As with ar, ranlib had to be manually adjusted to gcc-ranlib with sed and find. I did the same for nm just in case it was used somewhere since I do not actually  know what nm does.\r\n* The SPU2x, ZZogl, and LilyPad (and possibly others) fail to compile when both LTO and the \"gold\" linker are used. I am not entirely certain why, but there was some message about a relocation. Oddly, removing \"-fuse-ld=gold\" for these plugins (both under link.txt and flags.make) resulted in successful compilation. I did not try removing gold only from the link.txt. I did not try removing gold only from the flags.make. \r\n* Additionally, -flto=4 is used by default. On my computer, -flto=2 would probably run faster. If there was a way to specify this in CMake, it would make the process easier as well.\r\n\r\n***How to reproduce the issue:***\r\n\r\n\r\n***Last known version to work:***\r\nI was unable to use LTO either in stable or development at any time without manual modification of the files generated by CMake.\r\n\r\n***PC specifications:***\r\nCPU: Intel Celeron N3050 @1.60 GHz  Dual-Core  OS: Debian Linux 64-bit (It's not caused by multi-arch issues, it compiles fine with the supplied toolchain file when LTO is disabled).\r\n\r\nGoing overboard here, but the output of \"cat /proc/cpuinfo\":\r\n\r\nprocessor       : 0\r\nvendor_id       : GenuineIntel\r\ncpu family      : 6\r\nmodel           : 76\r\nmodel name      : Intel(R) Celeron(R) CPU  N3050  @ 1.60GHz\r\nstepping        : 3\r\nmicrocode       : 0x35e\r\ncpu MHz         : 479.980\r\ncache size      : 1024 KB\r\nphysical id     : 0\r\nsiblings        : 2\r\ncore id         : 0\r\ncpu cores       : 2\r\napicid          : 0\r\ninitial apicid  : 0\r\nfpu             : yes\r\nfpu_exception   : yes\r\ncpuid level     : 11\r\nwp              : yes\r\nflags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm sse4_1 sse4_2 movbe popcnt tsc_deadline_timer aes rdrand lahf_lm 3dnowprefetch epb tpr_shadow vnmi flexpriority ept vpid tsc_adjust smep erms dtherm ida arat\r\nbugs            :\r\nbogomips        : 3200.00\r\nclflush size    : 64\r\ncache_alignment : 64\r\naddress sizes   : 36 bits physical, 48 bits virtual\r\npower management:\r\n\r\nprocessor       : 1\r\nvendor_id       : GenuineIntel\r\ncpu family      : 6\r\nmodel           : 76\r\nmodel name      : Intel(R) Celeron(R) CPU  N3050  @ 1.60GHz\r\nstepping        : 3\r\nmicrocode       : 0x35e\r\ncpu MHz         : 479.980\r\ncache size      : 1024 KB\r\nphysical id     : 0\r\nsiblings        : 2\r\ncore id         : 2\r\ncpu cores       : 2\r\napicid          : 4\r\ninitial apicid  : 4\r\nfpu             : yes\r\nfpu_exception   : yes\r\ncpuid level     : 11\r\nwp              : yes\r\nflags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm sse4_1 sse4_2 movbe popcnt tsc_deadline_timer aes rdrand lahf_lm 3dnowprefetch epb tpr_shadow vnmi flexpriority ept vpid tsc_adjust smep erms dtherm ida arat\r\nbugs            :\r\nbogomips        : 3202.57\r\nclflush size    : 64\r\ncache_alignment : 64\r\naddress sizes   : 36 bits physical, 48 bits virtual\r\npower management:\r\n"},"comment":{"url":"https://api.github.com/repos/PCSX2/pcsx2/issues/comments/262301612","html_url":"https://github.com/PCSX2/pcsx2/issues/1671#issuecomment-262301612","issue_url":"https://api.github.com/repos/PCSX2/pcsx2/issues/1671","id":262301612,"user":{"login":"np511","id":10342579,"avatar_url":"https://avatars.githubusercontent.com/u/10342579?v=3","gravatar_id":"","url":"https://api.github.com/users/np511","html_url":"https://github.com/np511","followers_url":"https://api.github.com/users/np511/followers","following_url":"https://api.github.com/users/np511/following{/other_user}","gists_url":"https://api.github.com/users/np511/gists{/gist_id}","starred_url":"https://api.github.com/users/np511/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/np511/subscriptions","organizations_url":"https://api.github.com/users/np511/orgs","repos_url":"https://api.github.com/users/np511/repos","events_url":"https://api.github.com/users/np511/events{/privacy}","received_events_url":"https://api.github.com/users/np511/received_events","type":"User","site_admin":false},"created_at":"2016-11-22T17:08:48Z","updated_at":"2016-11-22T17:08:48Z","body":"On Tuesday, November 22, 2016 8:06:07 AM EST Gregory Hainaut wrote:\n> You might need to edit those lines\n> https://github.com/PCSX2/pcsx2/blob/master/cmake/BuildParameters.cmake#L334\n> \n> Feel free to post any working update.\nThank you! I've been meaning to learn CMake for a while now, but haven't \ngotten around to it yet. This is exactly what I needed!\n\n\n"}}
{"actor":{"display_login":"np511"}}