Difference between revisions of "Building"

From Syslinux Wiki
Jump to: navigation, search
m (Re-order (sort). Wiki formatting.)
(Mention some of the patches from opensuse (lzo) and gentoo (gcc 10). Wiki formatting. Update links.)
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
<!-- -->
 
<!-- -->
 +
* '''gcc-10''' linker failure: "''multiple definition of...''". <!--
 +
  -->  <p>  syslinux-6.04_pre1 fails to build on gcc-10 due to {{nowrap|1=<tt>-fno-common</tt>}} change. <!--
 +
  --> {{nowrap|1=<tt>gcc-10</tt>}} and above flipped a default from <!--
 +
  --> {{nowrap|1=<tt>-fcommon</tt>}} to {{nowrap|1=<tt>-fno-common</tt>.}} </p>  <!--
 +
  --><!-- <p>  This changed <tt>gcc</tt> code generator to emit globals without explicit initializer --><!--
 +
  --><!-- from {{nowrap|.bss}} (via COMMON symbol type) to {{nowrap|.data}} (via DEFAULT symbol type). </p>  --><!--
 +
  -->  <p>  {{nowrap|1=<tt>gcc-10</tt>}} will reject multiple definitions of global variables. <!--
 +
  --> Possible/potential <u>workaround</u>: {{nowrap|add/append}} {{nowrap|1=<tt>-f-common</tt>}} to CFLAGS. <!--
 +
  --> Other workarounds and better solutions are available too. <!--
 +
  --> Ideally, the code would need a few {{nowrap|1='<tt>extern</tt>'}} additions and maybe moving variable definitions. <!--
 +
  --><!--
 +
  --><!-- References:
 +
  --><!--  https://bugs.gentoo.org/705730
 +
  --><!--  https://wiki.gentoo.org/wiki/Gcc_10_porting_notes/fno_common
 +
  --><!--  https://bugs.gentoo.org/705764
 +
  --><!-- 
 +
  --><!--  https://bugzilla.suse.com/1160244
 +
  --><!-- 
 +
  --><!--  https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html
 +
  --><!--  https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#index-fcommon
 +
  --><!-- 
 +
  --><!--  https://gcc.gnu.org/PR85678
 +
  --> </p>  <!--
 +
  --><!-- -->
 +
* <code>internal error - lzo_init() failed!</code> (inconsistent/sporadic error) <!--
 +
  -->  <p>  Syslinux fails to build due to aliasing bugs in lzo. <!--
 +
  --> Add {{nowrap|1=<tt>-fno-strict-aliasing</tt>}} to {{nowrap|1=<tt>lzo/Makefile</tt>.}} </p>  <!--
 +
  -->  References:
 +
**  <p>  [https://bugzilla.suse.com/1125616] <!--
 +
  --><!--  [https://build.opensuse.org/package/view_file/system:install:head/syslinux6/18_lzo.diff?expand=1]
 +
  --><!--  [https://build.opensuse.org/package/view_file/openSUSE:Factory/syslinux/syslinux-4.04-lzo.diff?rev=f8bf3fec929e35b8b983d749c1f14511]
 +
  --> </p>  <!--
 +
  --><!-- -->
 +
* Fix broken efi binaries with '''binutils 2.31+''' <!--
 +
  -->  <p>  "Binutils >= 2.31 writes two PT_LOAD segements by default. <!--
 +
  -->  This is not supported by the <tt>wrapper.c</tt> script used to convert the shared object into an elf binary." </p>  <!--
 +
  --> References:
 +
** [https://salsa.debian.org/images-team/syslinux/commit/012e1dd312eb8c1f9a52239966e0be0169d7af98 "Patches from Debian"] ( Lukas Schwaighofer <!-- (irc: lus) --> )
 +
** [https://www.syslinux.org/archives/2018-August/026168.html Discard .note.gnu.property section to fix build failure (patch)]
 +
** [https://www.syslinux.org/archives/2018-August/026167.html Patch: fix syslinux.efi (Re: Unable to get syslinux.efi to work, grub2 boots tho)]  <!--
 +
  --><!--
 +
  --><!-- -->
 
* If getting "'''''Not enough room for program headers'''''", try adding <!--  
 
* If getting "'''''Not enough room for program headers'''''", try adding <!--  
 
   --> {{nowrap|1='<tt>--no-dynamic-linker</tt>'}} to the linker command line(s). <!--  
 
   --> {{nowrap|1='<tt>--no-dynamic-linker</tt>'}} to the linker command line(s). <!--  
 
   -->  Seen with '''binutils 2.27+'''. <!--  
 
   -->  Seen with '''binutils 2.27+'''. <!--  
 
   -->  There might be other / better solutions / work-around methods. <!--  
 
   -->  There might be other / better solutions / work-around methods. <!--  
  -->  [[Contact|Feedback]] is appreciated. <!--
 
 
   --><!--  
 
   --><!--  
   --><!-- References:
+
   --><!-- References:  
 
   --><!--  http://www.syslinux.org/archives/2017-February/025531.html  
 
   --><!--  http://www.syslinux.org/archives/2017-February/025531.html  
 
   --><!--  http://bugs.debian.org/846679#10  
 
   --><!--  http://bugs.debian.org/846679#10  
 
   --><!--  http://www.syslinux.org/archives/2017-April/025748.html "Cross-compilation patches" (Benoît Allard (irc: benallard))  
 
   --><!--  http://www.syslinux.org/archives/2017-April/025748.html "Cross-compilation patches" (Benoît Allard (irc: benallard))  
 +
  --><!--
 +
  -->  <p>  Note: 6.04-pre1+ should not be affected by this issue. </p>  <!--
 +
  --><!--
 +
  --><!-- References:
 +
  --><!--  http://www.syslinux.org/archives/2017-October/025948.html "Patches from Debian" (Lukas Schwaighofer (irc: lus))
 +
  --><!--
 +
  -->  <p>  [[Contact|Feedback]] is appreciated. </p>  <!--
 +
  --><!--
 
   --><!-- -->
 
   --><!-- -->
<!--  -->
 
<!--  -->
 
 
* When building with '''glibc 2.23+''', the "major", "minor" and "makedev" <!--  
 
* When building with '''glibc 2.23+''', the "major", "minor" and "makedev" <!--  
 
   --> functions are defined in {{nowrap|"<tt>sys/sysmacros.h</tt>"}}. <!--  
 
   --> functions are defined in {{nowrap|"<tt>sys/sysmacros.h</tt>"}}. <!--  
Line 24: Line 71:
 
Patches already included in Syslinux 6.04-pre1 (released 2016Mar):
 
Patches already included in Syslinux 6.04-pre1 (released 2016Mar):
  
* Building Syslinux 6.03 with '''gcc5+''':
+
* Building Syslinux 6.03 with '''gcc5+''':  
 
** [http://repo.or.cz/syslinux.git/patch/e5f2b577ded109291c9632dacb6eaa621d8a59fe?hp=8dc6d758b564a1ccc44c3ae11f265d43628219ce gcc fix alignment]
 
** [http://repo.or.cz/syslinux.git/patch/e5f2b577ded109291c9632dacb6eaa621d8a59fe?hp=8dc6d758b564a1ccc44c3ae11f265d43628219ce gcc fix alignment]
 
** [http://repo.or.cz/syslinux.git/patch/0cc9a99e560a2f52bcf052fd85b1efae35ee812f?hp=e5f2b577ded109291c9632dacb6eaa621d8a59fe don't guess sections' alignment]
 
** [http://repo.or.cz/syslinux.git/patch/0cc9a99e560a2f52bcf052fd85b1efae35ee812f?hp=e5f2b577ded109291c9632dacb6eaa621d8a59fe don't guess sections' alignment]
Line 38: Line 85:
 
   --><!-- https://bugzilla.redhat.com/show_bug.cgi?id=1135793#c21 -->  <!--  
 
   --><!-- https://bugzilla.redhat.com/show_bug.cgi?id=1135793#c21 -->  <!--  
 
   --><!-- Another possibly-related commit might be [http://repo.or.cz/syslinux.git/commit/83aad4f69065509ba5b1c080edccfed316a4cff0 "correct a type"] -->  <!--  
 
   --><!-- Another possibly-related commit might be [http://repo.or.cz/syslinux.git/commit/83aad4f69065509ba5b1c080edccfed316a4cff0 "correct a type"] -->  <!--  
   --><!--  also from Scot Doyle. <--
+
   --><!--  also from Scot Doyle. -->  <!--  
  --> <p> Testing Syslinux {{nowrap|6.04-pre1}} (or later) is recommended. </p>  <!--  
+
 
   --><!-- -->
 
   --><!-- -->
 +
<!-- -->
 +
 +
<br />
 +
Testing Syslinux {{nowrap|6.04-pre1}} (or later) is recommended.
  
 
== Other ==
 
== Other ==
Line 60: Line 110:
 
  --> {{nowrap|1="<code><nowiki>CFLAGS += -fno-pie</nowiki></code>"}} or <!--   
 
  --> {{nowrap|1="<code><nowiki>CFLAGS += -fno-pie</nowiki></code>"}} or <!--   
 
  --> {{nowrap|1="<code><nowiki>CFLAGS := -fno-pie</nowiki></code>".}} <!--   
 
  --> {{nowrap|1="<code><nowiki>CFLAGS := -fno-pie</nowiki></code>".}} <!--   
  --> Examples:
+
  --> Examples:  
 
<!--  ArchLinux  -->
 
<!--  ArchLinux  -->
 
** [http://bugzilla.syslinux.org/show_bug.cgi?id=70]
 
** [http://bugzilla.syslinux.org/show_bug.cgi?id=70]
 
<!--  Ubuntu and Debian  -->
 
<!--  Ubuntu and Debian  -->
 
** [https://bugs.launchpad.net/bugs/1579023] and <!--   
 
** [https://bugs.launchpad.net/bugs/1579023] and <!--   
  --> [https://anonscm.debian.org/git/collab-maint/syslinux.git/commit/?id=9faf103f53ba4094cdce153a223239a62aa48ac5]
+
  --><!-- prior/old url: [https://anonscm.debian.org/git/collab-maint/syslinux.git/commit/?id=9faf103f53ba4094cdce153a223239a62aa48ac5] --><!--
 +
--> [https://salsa.debian.org/images-team/syslinux/commit/9faf103f53ba4094cdce153a223239a62aa48ac5]
  
  

Latest revision as of 14:21, 15 February 2020

  • gcc-10 linker failure: "multiple definition of...".

    syslinux-6.04_pre1 fails to build on gcc-10 due to -fno-common change. gcc-10 and above flipped a default from -fcommon to -fno-common.

    gcc-10 will reject multiple definitions of global variables. Possible/potential workaround: add/append -f-common to CFLAGS. Other workarounds and better solutions are available too. Ideally, the code would need a few 'extern' additions and maybe moving variable definitions.

  • internal error - lzo_init() failed! (inconsistent/sporadic error)

    Syslinux fails to build due to aliasing bugs in lzo. Add -fno-strict-aliasing to lzo/Makefile.

    References:
  • Fix broken efi binaries with binutils 2.31+

    "Binutils >= 2.31 writes two PT_LOAD segements by default. This is not supported by the wrapper.c script used to convert the shared object into an elf binary."

    References:
  • If getting "Not enough room for program headers", try adding '--no-dynamic-linker' to the linker command line(s). Seen with binutils 2.27+. There might be other / better solutions / work-around methods.

    Note: 6.04-pre1+ should not be affected by this issue.

    Feedback is appreciated.

  • When building with glibc 2.23+, the "major", "minor" and "makedev" functions are defined in "sys/sysmacros.h". The patch "extlinux: pull in sys/sysmacros.h for major/minor/makedev", applied to Syslinux during 2016Apr, should help. Please note that not only Syslinux is affected by this change in glibc.


Patches already included in Syslinux 6.04-pre1 (released 2016Mar):


Testing Syslinux 6.04-pre1 (or later) is recommended.

Other

  • NASM 2.11.06 has a bug which prevents Syslinux from building correctly. Use other version of NASM (e.g. 2.11.05, 2.11.08+, among others).
  • binutils 2.26, as originally released upstream, has a bug preventing Syslinux from building correctly. The bug in bintuils 2.26 was resolved in a later commit.
  • "error: impossible constraint in asm". When gcc5+ is configured with --enable-default-pie, in some cases there might be a need to use custom flags in some makefile(s), similar to either "CFLAGS += -fno-pie" or "CFLAGS := -fno-pie". Examples:


See also