Changeset ab8c10c8
- Timestamp:
- 03/30/2019 09:36:23 PM (4 years ago)
- Branches:
- 10.0, 10.1, 11.0, 11.1, 11.2, 11.3, 9.0, 9.1, ken/inkscape-core-mods, lazarus, plabs/python-mods, qt5new, trunk, upgradedb, xry111/intltool, xry111/soup3, xry111/test-20220226
- Children:
- ba31c2b
- Parents:
- 5a8f4f1
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
general.ent
r5a8f4f1 rab8c10c8 1 1 <!-- $LastChangedBy$ $Date$ --> 2 2 3 <!ENTITY day " 29"> <!-- Always 2 digits -->3 <!ENTITY day "30"> <!-- Always 2 digits --> 4 4 <!ENTITY month "03"> <!-- Always 2 digits --> 5 5 <!ENTITY year "2019"> … … 7 7 <!ENTITY copyholder "The BLFS Development Team"> 8 8 <!ENTITY version "&year;-&month;-&day;"> 9 <!ENTITY releasedate "March 29th, &year;">9 <!ENTITY releasedate "March 30th, &year;"> 10 10 <!ENTITY pubdate "&year;-&month;-&day;"> <!-- metadata req. by TLDP --> 11 11 <!ENTITY blfs-version "svn"> <!-- svn|[release #] --> -
introduction/important/building-notes.xml
r5a8f4f1 rab8c10c8 454 454 </sect2> 455 455 --> 456 <sect2 id="buildsystems"> 457 <title>Working with different build systems</title> 458 459 <para> 460 There are now three different build systems in common use for 461 converting C or C++ source code into compiled programs or 462 libraries, and their details (particularly, finding out about available 463 options and their default values) differ. It may be easiest to understand 464 the issues caused by some choices (typically, slow execution, or 465 unexpected use of, or omission of, optimizatons) by starting with the item 466 which drew attention to this, the CFLAGS and CXXFLAGS. 467 </para> 468 469 <para> 470 Most LFS and BLFS builders are probably aware of the basics of CFLAGS 471 and CXXFLAGS for altering how a program is compiled. Typically, some 472 form of optimization is used for a released program (-O2 or -O3), 473 sometimes with the creation of debug symbols (-g) when using -O2. 474 </para> 475 476 <para> 477 If there are contradictory flags (e.g. multiple different -O values), 478 the <emphasis>last</emphasis> value will be used. Sometimes this means 479 that flags specifiedi in environment variables will be picked up before 480 values hardcoded in the Makefile, and therefore ignored. For example, 481 where a user specifies '-O2' and that is followed by '-O3' the build will 482 use '-O3'. 483 </para> 484 485 <para> 486 There are various other things which can be passed in CFLAGS or 487 CXXFLAGS, such as forcing compilation for a specific microarchitecture 488 (e.g. -march=amdfam10, -march=native) or specifying a specific standard 489 for C or C++ (-std=c++17 for example). But one thing which has now come 490 to light is that programmers might include debug assertions in their 491 code, expecting them to be disabled in releases by using -DNDEBUG. 492 Specifically, if <xref linkend="mesa"/> is built with these assertions 493 enabled, some activities such as loading levels of games can take 494 extremely long times, even on high-class video cards. 495 </para> 496 497 <bridgehead renderas="sect3">Autotools with Make</bridgehead> 498 499 <para> 500 This combination is often described as 'CMMI' (configure, make, make 501 install) and is used here to also cover the few packages which have a 502 configure script that is not generated by autotools. 503 </para> 504 505 <para> 506 Sometimes, running <command>./configure --help</command> will produce 507 useful options about switches which might be used. At other times, 508 after looking at the output from a run of configure you may need to look 509 at the details of the script to find out what it was actually searching 510 for. 511 </para> 512 513 <para> 514 Many configure scripts will pick up any CFLAGS or CXXFLAGS from the 515 environment, but CMMI packages vary about how these will be mixed with 516 any flags which would otherwise be used (<emphasis>variously</emphasis>: 517 ignored, used to replace the programmer's suggestion, used before the 518 programmer's suggestion, used after the programmer's suggestion). 519 </para> 520 521 <para> 522 In most CMMI packages, running 'make' will list each command and run 523 it, interspersed with any warnings. But some packages try to be 'silent' 524 and only show which file they are compiling or linking instead of showing 525 the command line. If you need to inspect the command, either because of 526 an error, or just to see what options and flags are being used, adding 527 'V=1' to the make invocation may help. 528 </para> 529 530 <bridgehead renderas="sect3">CMake</bridgehead> 531 532 <para> 533 CMake works in a very different way, and it has two backends which can 534 be used on BLFS: 'make' and 'ninja'. The default backend is make, but 535 ninja can be faster on large packages with multiple processors. To 536 use ninja, specify '-G Ninja' in the cmake command. 537 </para> 538 539 <para> 540 The hardest part of using CMake is knowing what options you might wish 541 to specify. The only way to get a list of what the package knows about 542 is to run <command>cmake -LAH</command> and look at the output for that 543 default configuration. 544 </para> 545 546 <para> 547 Perhaps the most-important thing about CMake is that it has a variety 548 of CMAKE_BUILD_TYPE values, and these affect the flags. The default 549 is that this is not set and no flags are generated. Any CFLAGS or 550 CXXFLAGS in the environment will be used. If the programmer has coded 551 any debug assertions, those will be enabled unless -DNDEBUG is used. 552 The following CMAKE_BUILD_TYPE values will generate the flags shown, 553 and these will come <emphasis>after</emphasis> any flags in the 554 environment and therefore take precedence. 555 </para> 556 557 <itemizedlist> 558 <listitem> 559 <para>Debug : '-g'</para> 560 </listitem> 561 <listitem> 562 <para>Release : '-O3 -DNDEBUG'</para> 563 </listitem> 564 <listitem> 565 <para>RelWithDebInfo : '-O2 -g -DNDEBUG'</para> 566 </listitem> 567 <listitem> 568 <para>MinSizeRel : '-Os -DNDEBUG'</para> 569 </listitem> 570 </itemizedlist> 571 572 <para> 573 CMake tries to produce quiet builds. To see the details of the commands 574 which are being run, use 'make VERBOSE=1' or 'ninja -v'. 575 </para> 576 577 <bridgehead renderas="sect3">Meson</bridgehead> 578 579 <para> 580 Meson has some similarities to CMake, but many differences. To get 581 details of the definesthat you may wish to change is slightly involved 582 using meson-0.49.2: 583 </para> 584 585 <screen><userinput>meson .. 586 meson configure | less</userinput></screen> 587 588 <para> 589 After identifying what to set, meson then needs to be reconfigured: 590 </para> 591 592 <screen><userinput>meson --prefix=/usr -Dsome_option=true -Dother_option=false --reconfigure</userinput></screen> 593 594 <para> 595 Alternatively, you could remove the build directory where you did this, 596 recreate it, and then run meson with the desired switches. 597 </para> 598 599 <para> 600 Meson provides the following buildtype values, and the flags they enable 601 come <emphasis>after</emphasis> any flags supplied in the environment and 602 therefore take precedence. 603 </para> 604 605 <itemizedlist> 606 <listitem> 607 <para>plain : no added flags. This is for distributors to supply their 608 own CLFAGS, CXXFLAGS and LDFLAGS. There is no obvious reason to use 609 this in BLFS.</para> 610 </listitem> 611 <listitem> 612 <para>debug : '-g'</para> 613 </listitem> 614 <listitem> 615 <para>debugoptimized : '-O2 -g' - this is the default if nothing is 616 specified, it leaves assertions enabled.</para> 617 </listitem> 618 <listitem> 619 <para>release : '-O3 -DNDEBUG'</para> 620 </listitem> 621 </itemizedlist> 622 623 <para> 624 Although the release buildtype is described as enabling -DNDEBUG, and all 625 CMake Release builds pass that, it has so far only been observed (in 626 verbose builds) for <xref linkend="mesa"/>. That suggests that it might 627 only be used when there are debug assertions present. 628 </para> 629 630 <para> 631 The -DNDEBUG flag can also be provided by passing 632 <command>-Db_ndebug=true</command>. 633 </para> 634 635 <para> 636 To see the details of the commands which are being run in a package using 637 meson, again use 'ninja -v'. 638 </para> 639 640 </sect2> 641 456 642 </sect1> -
introduction/welcome/changelog.xml
r5a8f4f1 rab8c10c8 42 42 </listitem> 43 43 --> 44 <listitem> 45 <para>March 29th, 2019</para> 46 <itemizedlist> 47 <listitem> 48 <para>[ken] - Add "Working with different build systems" to the end of 49 "Notes on Building Software", to start to document some of the 50 differences in CMake and Meson.</para> 51 </listitem> 52 </itemizedlist> 53 </listitem> 54 44 55 <listitem> 45 56 <para>March 29th, 2019</para>
Note:
See TracChangeset
for help on using the changeset viewer.