New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

openclonk-0.8 linking fails on Fedora 27 #64

Closed
martinkg opened this Issue Feb 6, 2018 · 7 comments

Comments

Projects
None yet
3 participants
@martinkg
Copy link

martinkg commented Feb 6, 2018

Hi,

compiling openclonk [1] fails with the following error message [2]:

[ 9%] Linking CXX static library liblibmisc.a
/usr/bin/cmake -P CMakeFiles/libmisc.dir/cmake_clean_target.cmake
/usr/bin/cmake -E cmake_link_script CMakeFiles/libmisc.dir/link.txt --verbose=1
/usr/bin/gcc-ar qc liblibmisc.a CMakeFiles/libmisc.dir/src/C4Include.cpp.o CMakeFiles/libmisc.dir/src/c4group/C4Group.cpp.o CMakeFiles/libmisc.dir/src/c4group/C4Update.cpp.o CMakeFiles/libmisc.dir/src/c4group/CStdFile.cpp.o CMakeFiles/libmisc.dir/src/graphics/C4BltTransform.cpp.o CMakeFiles/libmisc.dir/src/lib/C4InputValidation.cpp.o CMakeFiles/libmisc.dir/src/lib/C4Markup.cpp.o CMakeFiles/libmisc.dir/src/lib/C4Random.cpp.o CMakeFiles/libmisc.dir/src/lib/C4SimpleLog.cpp.o CMakeFiles/libmisc.dir/src/lib/Standard.cpp.o CMakeFiles/libmisc.dir/src/lib/StdBuf.cpp.o CMakeFiles/libmisc.dir/src/lib/StdCompiler.cpp.o CMakeFiles/libmisc.dir/src/lib/StdResStr2.cpp.o CMakeFiles/libmisc.dir/src/netpuncher/C4PuncherPacket.cpp.o CMakeFiles/libmisc.dir/src/network/C4NetIO.cpp.o CMakeFiles/libmisc.dir/src/network/C4Network2Address.cpp.o CMakeFiles/libmisc.dir/src/platform/StdFile.cpp.o CMakeFiles/libmisc.dir/src/platform/StdRegistry.cpp.o CMakeFiles/libmisc.dir/src/platform/StdScheduler.cpp.o CMakeFiles/libmisc.dir/src/platform/StdSchedulerWin32.cpp.o CMakeFiles/libmisc.dir/src/platform/StdSchedulerPoll.cpp.o CMakeFiles/libmisc.dir/src/platform/C4TimeMilliseconds.cpp.o CMakeFiles/libmisc.dir/src/zlib/gzio.c.o CMakeFiles/libmisc.dir/libmisc_autogen/mocs_compilation.cpp.o
Error running link command: Segmentation fault
make[2]: *** [CMakeFiles/libmisc.dir/build.make:697: liblibmisc.a] Error 1
make[2]: Leaving directory '/home/martin/rpmbuild/BUILD/openclonk-8.0/build'
make[1]: *** [CMakeFiles/Makefile2:187: CMakeFiles/libmisc.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
make[2]: Entering directory '/home/martin/rpmbuild/BUILD/openclonk-8.0/build'

[1] https://martinkg.fedorapeople.org/Packages/openclonk/openclonk.spec [2] https://martinkg.fedorapeople.org/Packages/openclonk/openclonk-build.log

@lluchs

This comment has been minimized.

Copy link
Member

lluchs commented Feb 6, 2018

Thank you for packaging openclonk!

Error running link command: Segmentation fault

I think gcc segfaulting is not exactly our bug :)

Which gcc version are you using? Does Fedora package some newer/older version you could alternatively use? For example, we're successfully building on Travis with gcc 4.9 and gcc 5.

As a workaround, you could try disabling link-time optimization (USE_GCC_STYLE_LTCG, although I'm not sure how to override this with cmake), but that obviously wouldn't be great for performance.

Please also make sure the dependency list is up-to-date, see the README. GTK+ isn't used anymore, but Qt is now a (optional) dependency. (This shouldn't make a difference regarding this issue though)

@martinkg martinkg changed the title openclonk-0.8 linking fails openclonk-0.8 linking fails on Fedora 27 Feb 6, 2018

@martinkg

This comment has been minimized.

Copy link

martinkg commented Feb 6, 2018

@sagitter

This comment has been minimized.

Copy link

sagitter commented Feb 6, 2018

@martinkg

That error is caused by flag Werror=format-security used on Fedora by default.

@lluchs

As a workaround, you could try disabling link-time optimization (USE_GCC_STYLE_LTCG, although I'm not sure how to override this with cmake), but that obviously wouldn't be great for performance.

-DUSE_GCC_STYLE_LTCG:BOOL=OFF fixes linker failure reported in this issue.

(Tested on Fedora 27)

@sagitter

This comment has been minimized.

Copy link

sagitter commented Feb 6, 2018

openclonk compiled with GCC-8: https://koji.fedoraproject.org/koji/taskinfo?taskID=24756647
openclonk compiled with GCC-7.3.1: https://koji.fedoraproject.org/koji/taskinfo?taskID=24756979

@lluchs
Can format-security errors be corrected?

openclonk-mirror pushed a commit that referenced this issue Feb 6, 2018

Enable -Wformat-security for gcc and fix one warning (GH-64)
Fedora has -Werror=format-security enabled per default, so enabling and
fixing these warnings is a good idea.
@lluchs

This comment has been minimized.

Copy link
Member

lluchs commented Feb 6, 2018

-DUSE_GCC_STYLE_LTCG:BOOL=OFF fixes linker failure reported in this issue.

Did you check whether this is actually necessary with the newer gcc version? My gcc version 7.3.0 doesn't crash while linking. Is it due to some extra build options Fedora uses?

Can format-security errors be corrected?

I fixed one of these warnings. However, I believe the other two are actually incorrect from gcc:

/home/martin/rpmbuild/BUILD/openclonk-8.0/src/script/C4AulCompiler.cpp: In instantiation of 'C4AulParseError Error(const C4ScriptHost*, const C4ScriptHost*, const char*, const C4AulScriptFunc*, const char*, T&& ...) [with T = {}]':
/home/martin/rpmbuild/BUILD/openclonk-8.0/src/script/C4AulCompiler.cpp:876:70:   required from here
/home/martin/rpmbuild/BUILD/openclonk-8.0/src/script/C4AulCompiler.cpp:101:52: error: format not a string literal and no format arguments [-Werror=format-security]
  std::string message = sizeof...(T) > 0 ? strprintf(msg, std::forward<T>(args)...) : msg;
                                           ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

In the template instantiation, T is empty, so sizeof...(T) is 0, so strprintf() is dead code, so the warning is bogus. I fear you'll have to disable -Werror=format-security until gcc can properly suppress warnings in dead code...

@martinkg

This comment has been minimized.

Copy link

martinkg commented Feb 7, 2018

issue is solved for me, i will take the rpm spec file from @sagitter packages.

akien-mga added a commit to akien-mga/openclonk that referenced this issue Feb 8, 2018

@sagitter

This comment has been minimized.

Copy link

sagitter commented Feb 8, 2018

-DUSE_GCC_STYLE_LTCG:BOOL=OFF fixes linker failure reported in this issue.

Did you check whether this is actually necessary with the newer gcc version? My gcc version 7.3.0 doesn't crash while linking. Is it due to some extra build options Fedora uses?

Disabling of USE_GCC_STYLE_LTCG is necessary with GCC > 7*, i seen.

openclonk-mirror pushed a commit that referenced this issue Feb 15, 2018

Enable -Wformat-security for gcc and fix one warning (GH-64)
Fedora has -Werror=format-security enabled per default, so enabling and
fixing these warnings is a good idea.

@martinkg martinkg closed this Oct 18, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment