Difference between revisions of "Building"

From Syslinux Wiki
Jump to: navigation, search
(Add "relocate protected-mode code" patch that might solve booting some Chromebooks using Syslinux 6.03.)
(Mention some of the patches from opensuse (lzo) and gentoo (gcc 10). Wiki formatting. Update links.)
 
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
* '''NASM 2.11.06''' has a bug which prevents Syslinux from building <!--  
+
<!-- -->
   --> correctly. Use other version of NASM <!--  
+
* '''gcc-10''' linker failure: "''multiple definition of...''". <!--
   --> (e.g. 2.11.05, 2.11.08, among others).
+
  -->  <p>  syslinux-6.04_pre1 fails to build on gcc-10 due to {{nowrap|1=<tt>-fno-common</tt>}} change. <!--
* '''binutils 2.26''', as originally released upstream, has a <!--  
+
  --> {{nowrap|1=<tt>gcc-10</tt>}} and above flipped a default from <!--  
   --> [https://sourceware.org/bugzilla/show_bug.cgi?id=19538 bug] <!--  
+
   --> {{nowrap|1=<tt>-fcommon</tt>}} to {{nowrap|1=<tt>-fno-common</tt>.}} </p>  <!--  
   --> preventing Syslinux from building correctly. The bug in <!--  
+
   --><!-- <p>  This changed <tt>gcc</tt> code generator to emit globals without explicit initializer --><!--
   --> bintuils 2.26 was resolved in a later commit.
+
  --><!-- 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 <!--
 +
  --> {{nowrap|1='<tt>--no-dynamic-linker</tt>'}} to the linker command line(s). <!--  
 +
   --> Seen with '''binutils 2.27+'''. <!--
 +
  -->  There might be other / better solutions / work-around methods. <!--
 +
  --><!--
 +
  --><!-- References:
 +
  --><!--  http://www.syslinux.org/archives/2017-February/025531.html
 +
  --><!--  http://bugs.debian.org/846679#10
 +
  --><!--  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 13: Line 67:
 
   --> Please note that not only Syslinux is affected by this change in glibc.
 
   --> Please note that not only Syslinux is affected by this change in glibc.
 
<!-- -->
 
<!-- -->
<!-- -->
+
 
* Building Syslinux 6.03 with '''gcc5+''': <!-- 
+
<br />
  --> <p> These patches related to gcc5+ are included in Syslinux 6.04-pre1 (released 2016Mar). </p>  <!--
+
Patches already included in Syslinux 6.04-pre1 (released 2016Mar):
  --><!-- -->
+
 
 +
* 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]
 
** [http://repo.or.cz/syslinux.git/patch/8dc6d758b564a1ccc44c3ae11f265d43628219ce?hp=9e0926bb338deb5c634ccb4ee29eb4577158cfdc ldlinux: Fix return pointer to local data]
 
** [http://repo.or.cz/syslinux.git/patch/8dc6d758b564a1ccc44c3ae11f265d43628219ce?hp=9e0926bb338deb5c634ccb4ee29eb4577158cfdc ldlinux: Fix return pointer to local data]
 
<!-- -->
 
<!-- -->
* Use [http://repo.or.cz/syslinux.git/patch/7d70885d22e4474407637026c1af12a253281407?hp=2d14923c02aa343f650a5bee128e9ea383a0ed59 -mno-red-zone for EFI] <!-- 
+
* Use [http://repo.or.cz/syslinux.git/patch/7d70885d22e4474407637026c1af12a253281407?hp=2d14923c02aa343f650a5bee128e9ea383a0ed59 -mno-red-zone for EFI]
  --> <p> The patch related to the so-called "red zone" is included in Syslinux 6.04-pre1 (released 2016Mar). </p>  <!--
+
  --><!-- -->
+
 
* Syslinux 6.03 might fail to boot in some hardware (e.g. some Chromebooks). <!--   
 
* Syslinux 6.03 might fail to boot in some hardware (e.g. some Chromebooks). <!--   
 
   --> The patch [http://repo.or.cz/syslinux.git/patch/0a2dbb3392ee710838bea6bda80d4daad6b54780?hp=f1e95ca49902b5eda4c02275a69152d4834882d6 "relocate protected-mode code as intended"], <!--   
 
   --> The patch [http://repo.or.cz/syslinux.git/patch/0a2dbb3392ee710838bea6bda80d4daad6b54780?hp=f1e95ca49902b5eda4c02275a69152d4834882d6 "relocate protected-mode code as intended"], <!--   
Line 32: 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 ==
 +
* '''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 <!--
 +
  --> [https://sourceware.org/bugzilla/show_bug.cgi?id=19538 bug] <!--
 +
  --> preventing Syslinux from building correctly. The bug in <!--
 +
  --> bintuils 2.26 was resolved in a later commit.
  
 
<!--  Keywords / terms to help search engines: -->
 
<!--  Keywords / terms to help search engines: -->
Line 45: 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