#18508 closed bug (no change required)

buildtools/gcc/libcpp/expr.c:811:35: error: format not a string literal and no format arguments

Reported by: dufresnep Owned by: nobody
Priority: normal Milestone: Unscheduled
Component: Build System Version: R1/beta4
Keywords: Cc:
Blocked By: Blocking:
Platform: All

Description

While ./configure: got:

/home/paul/haikumy/buildtools/gcc/libcpp/expr.c: In function 'unsigned int cpp_classify_number(cpp_reader*, const cpp_token*, const char**, location_t)':
/home/paul/haikumy/buildtools/gcc/libcpp/expr.c:811:35: error: format not a string literal and no format arguments [-Werror=format-security]
  811 |             cpp_warning_with_line (pfile, CPP_W_LONG_LONG, virtual_location,
      |             ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  812 |                                    0, message);
      |                                    ~~~~~~~~~~~
/home/paul/haikumy/buildtools/gcc/libcpp/expr.c:814:38: error: format not a string literal and no format arguments [-Werror=format-security]
  814 |             cpp_pedwarning_with_line (pfile, CPP_W_LONG_LONG,
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
  815 |                                       virtual_location, 0, message);
      |                                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/paul/haikumy/buildtools/gcc/libcpp/expr.c:824:33: error: format not a string literal and no format arguments [-Werror=format-security]
  824 |           cpp_warning_with_line (pfile, CPP_W_SIZE_T_LITERALS,
      |           ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  825 |                                  virtual_location, 0, message);
      |                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1plus: some warnings being treated as errors
make[2]: *** [Makefile:226: expr.o] Error 1
make[2]: Leaving directory '/home/paul/haikumy/haiku/generated/cross-tools-x86-build/gcc/build-x86_64-pc-linux-gnu/libcpp'
make[1]: *** [Makefile:2930: all-build-libcpp] Error 2
make[1]: Leaving directory '/home/paul/haikumy/haiku/generated/cross-tools-x86-build/gcc'
make: *** [Makefile:978: all] Error 2
ERROR: Building gcc failed.
[nix-shell:~/haikumy/haiku]$ ./configure --cross-tools-source ../buildtools --build-cross-tools x86

Attachments (1)

shell.nix (401 bytes ) - added by dufresnep 10 months ago.
working shell.nix (used by nix-shell before calling ./configure --cross-tools-source ../buildtools --build-cross-tools x86_64

Download all attachments as: .zip

Change History (14)

comment:1 by dufresnep, 10 months ago

[nix-shell:~/haikumy/haiku]$ gcc --version
gcc (GCC) 12.2.0

comment:2 by dufresnep, 10 months ago

With:

[nix-shell:~/haikumy/haiku]$ cat shell.nix 
with import <nixpkgs> {}; {
  qpidEnv = stdenvNoCC.mkDerivation {
    name = "my-gcc11-environment";
    buildInputs = [
        gcc11
        # libev
        #...
    ];
  };
}

I now have:

[nix-shell:~/haikumy/haiku]$ gcc --version
gcc (GCC) 11.3.0

but got the same error.

comment:3 by dufresnep, 10 months ago

x86_64 exclusively uses gcc8, this differs from our 32-bit x86_gcc2 builds which include both gcc2 (for BeOS compatibility) and gcc8 as a secondary architecture.

according to: https://www.haiku-os.org/guides/building/compiling-x86_64 (wonders if it is really up to date).

Same with gcc 13.1.0... ok will try gcc8.

Last edited 10 months ago by pulkomandy (previous) (diff)

comment:4 by dufresnep, 10 months ago

[nix-shell:~/haikumy/haiku]$ gcc --version
gcc (GCC) 8.5.0

/home/paul/haikumy/buildtools/gcc/libcpp/expr.c: In function 'unsigned int cpp_classify_number(cpp_reader*, const cpp_token*, const char**, location_t)':
/home/paul/haikumy/buildtools/gcc/libcpp/expr.c:812:18: error: format not a string literal and no format arguments [-Werror=format-security]
        0, message);
                  ^
/home/paul/haikumy/buildtools/gcc/libcpp/expr.c:815:39: error: format not a string literal and no format arguments [-Werror=format-security]
           virtual_location, 0, message);
                                       ^
/home/paul/haikumy/buildtools/gcc/libcpp/expr.c:825:34: error: format not a string literal and no format arguments [-Werror=format-security]
      virtual_location, 0, message);
                                  ^
cc1plus: some warnings being treated as errors
make[2]: *** [Makefile:226: expr.o] Error 1
make[2]: Leaving directory '/home/paul/haikumy/haiku/generated/cross-tools-x86-build/gcc/build-x86_64-pc-linux-gnu/libcpp'
make[1]: *** [Makefile:2930: all-build-libcpp] Error 2
make[1]: Leaving directory '/home/paul/haikumy/haiku/generated/cross-tools-x86-build/gcc'
make: *** [Makefile:978: all] Error 2
ERROR: Building gcc failed.

[nix-shell:~/haikumy/haiku]$ 

comment:5 by waddlesplash, 10 months ago

Why is -Werror enabled for the GCC cross-tools build?

comment:6 by dufresnep, 10 months ago

[nix-shell:~/haikumy/buildtools]$ git pull
Already up to date.

[nix-shell:~/haikumy/buildtools]$ git log
commit ef1ae536062efb3fba8e9389da934689a0c608e3 (HEAD -> master, tag: btrev43202, origin/master, origin/HEAD)
Author: X512 <danger_mail@list.ru>
Date:   Sat May 29 16:20:38 2021 +0900

    gcc11: Enable frame pointers by default for Haiku

comment:7 by pulkomandy, 10 months ago

Same with gcc 13.1.0... ok will try gcc8.

It is not, we are currently using gcc 11.3 with work in progress to switch to gcc 13.

Why is -Werror enabled for the GCC cross-tools build?

This seems to be a decision from NixOS packagers of gcc, see this issue which also explains how to disable it:

https://github.com/NixOS/nixpkgs/issues/40182

comment:8 by dufresnep, 10 months ago

Oh, sorry I was totally unaware of that!

binutils and gcc for cross compilation have been built successfully!
Configured successfully!

Attaching my shell.nix file I used

comment:9 by dufresnep, 10 months ago

I just added zstd to the buildInputsection of shell.nix needed when I build with jam, but still gets:

MkDir1 objects/linux/x86_64/release/tools/makebootable 
MkDir1 objects/linux/x86_64/release/tools/makebootable/platform 
MkDir1 objects/linux/x86_64/release/tools/makebootable/platform/bios_ia32 
C++ objects/linux/x86_64/release/tools/makebootable/platform/bios_ia32/makebootable.o 
Link objects/linux/x86_64/release/tools/create_image 
Chmod1 objects/linux/x86_64/release/tools/create_image 
AddTargetVariableToScript1 <unique!target>_target_402 
C++ objects/linux/x86_64/release/tools/makebootable/platform/bios_ia32/PartitionMap.o 
../src/bin/makebootable/platform/bios_ia32/makebootable.cpp: In function ‘void get_partition_offset(int, off_t, off_t, int, int, char*, int64&)’:
../src/bin/makebootable/platform/bios_ia32/makebootable.cpp:274:53: warning: comparison of integer expressions of different signedness: ‘int’ and ‘uint32’ {aka ‘unsigned int’} [-Wsign-compare]
  274 |                 if (error == B_OK && partitionIndex < gptHeader.EntryCount()) {
      |                                      ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
../src/bin/makebootable/platform/bios_ia32/makebootable.cpp: In function ‘int main(int, const char* const*)’:
../src/bin/makebootable/platform/bios_ia32/makebootable.cpp:377:22: warning: variable ‘noPartition’ set but not used [-Wunused-but-set-variable]
  377 |                 bool noPartition = false;
      |                      ^~~~~~~~~~~
C++ objects/linux/x86_64/release/tools/makebootable/platform/bios_ia32/PartitionMapParser.o 
C++ objects/linux/x86_64/release/tools/makebootable/platform/bios_ia32/PartitionMapWriter.o 
C++ objects/linux/x86_64/release/tools/makebootable/platform/bios_ia32/crc32.o 
C++ objects/linux/x86_64/release/tools/makebootable/platform/bios_ia32/Header.o 
C++ objects/linux/x86_64/release/tools/makebootable/platform/bios_ia32/utility.o 
../src/add-ons/kernel/partitioning_systems/gpt/Header.cpp: In member function ‘void EFI::Header::_DumpPartitions()’:
../src/add-ons/kernel/partitioning_systems/gpt/Header.cpp:425:31: warning: taking address of packed member of ‘gpt_partition_entry’ may result in an unaligned pointer value [-Waddress-of-packed-member]
  425 |                 to_utf8(entry.name, EFI_PARTITION_NAME_LENGTH, name, sizeof(name));
      |                         ~~~~~~^~~~
C++ objects/linux/x86_64/release/tools/xres.o 
MkDir1 objects/haiku 
MkDir1 objects/haiku/x86 
MkDir1 objects/haiku/x86/common 
MkDir1 objects/haiku/x86/common/bin 
MkDir1 objects/haiku/x86/common/bin/makebootable 
MkDir1 objects/haiku/x86/common/bin/makebootable/platform 
MkDir1 objects/haiku/x86/common/bin/makebootable/platform/bios_ia32 
MkDir1 objects/haiku/x86/release 
MkDir1 objects/haiku/x86/release/system 
...on 100th target...
MkDir1 objects/haiku/x86/release/system/boot 
MkDir1 objects/haiku/x86/release/system/boot/platform 
MkDir1 objects/haiku/x86/release/system/boot/platform/bios_ia32 
MkDir1 build_packages 
MkDir1 download 
MkDir1 objects/haiku/x86/packaging 
MkDir1 objects/haiku/x86/packaging/repositories 
ChecksumFileSHA256 objects/haiku/x86/packaging/repositories/HaikuPorts-checksum 
DownloadLocatedFile1 download/gcc_syslibs_devel-5.4.0_2016_06_04-4-x86.hpkg 
--2023-07-13 06:03:56--  https://eu.hpkg.haiku-os.org/haikuports/master/build-packages/6efb4aa89c1ea031aaa55b6d9925f30d61ab1c94c1450660cbd3cb9aa78d57d1/packages/gcc_syslibs_devel-5.4.0_2016_06_04-4-x86.hpkg
Resolving eu.hpkg.haiku-os.org (eu.hpkg.haiku-os.org)... 206.189.242.242
Connecting to eu.hpkg.haiku-os.org (eu.hpkg.haiku-os.org)|206.189.242.242|:443... connected.
Link objects/linux/x86_64/release/tools/xres 
HTTP request sent, awaiting response... Chmod1 objects/linux/x86_64/release/tools/xres 
MkDir1 objects/linux/x86_64/release/tools/package 
C++ objects/linux/x86_64/release/tools/package/command_add.o 
C++ objects/linux/x86_64/release/tools/package/command_checksum.o 
404 Not Found
2023-07-13 06:03:57 ERROR 404: Not Found.


source="objects/haiku/x86/packaging/repositories/HaikuPorts-checksum"
wget --retry-connrefused --timeout 30 -O "download/gcc_syslibs_devel-5.4.0_2016_06_04-4-x86.hpkg" https://eu.hpkg.haiku-os.org/haikuports/master/build-packages/`cat $source`/packages/gcc_syslibs_devel-5.4.0_2016_06_04-4-x86.hpkg || exit 1
touch "download/gcc_syslibs_devel-5.4.0_2016_06_04-4-x86.hpkg"

...failed DownloadLocatedFile1 download/gcc_syslibs_devel-5.4.0_2016_06_04-4-x86.hpkg ...
...removing download/gcc_syslibs_devel-5.4.0_2016_06_04-4-x86.hpkg
Link objects/linux/x86_64/release/tools/package/package 
/nix/store/zkjq96ik8cbv6ijh1lylnkk2bni9qvas-binutils-2.40/bin/ld: cannot find objects/linux/x86_64/release/tools/package/command_create.o: No such file or directory
/nix/store/zkjq96ik8cbv6ijh1lylnkk2bni9qvas-binutils-2.40/bin/ld: cannot find objects/linux/x86_64/release/tools/package/command_dump.o: No such file or directory
/nix/store/zkjq96ik8cbv6ijh1lylnkk2bni9qvas-binutils-2.40/bin/ld: cannot find objects/linux/x86_64/release/tools/package/command_extract.o: No such file or directory
/nix/store/zkjq96ik8cbv6ijh1lylnkk2bni9qvas-binutils-2.40/bin/ld: cannot find objects/linux/x86_64/release/tools/package/command_info.o: No such file or directory
/nix/store/zkjq96ik8cbv6ijh1lylnkk2bni9qvas-binutils-2.40/bin/ld: cannot find objects/linux/x86_64/release/tools/package/command_list.o: No such file or directory
/nix/store/zkjq96ik8cbv6ijh1lylnkk2bni9qvas-binutils-2.40/bin/ld: cannot find objects/linux/x86_64/release/tools/package/command_recompress.o: No such file or directory
/nix/store/zkjq96ik8cbv6ijh1lylnkk2bni9qvas-binutils-2.40/bin/ld: cannot find objects/linux/x86_64/release/tools/package/package.o: No such file or directory
/nix/store/zkjq96ik8cbv6ijh1lylnkk2bni9qvas-binutils-2.40/bin/ld: cannot find objects/linux/x86_64/release/tools/package/PackageWriterListener.o: No such file or directory
/nix/store/zkjq96ik8cbv6ijh1lylnkk2bni9qvas-binutils-2.40/bin/ld: cannot find objects/linux/x86_64/release/tools/package/PackageWritingUtils.o: No such file or directory
/nix/store/zkjq96ik8cbv6ijh1lylnkk2bni9qvas-binutils-2.40/bin/ld: cannot find /home/paul/haikumy/haiku/generated/objects/linux/lib/libpackage_build.so: No such file or directory
collect2: error: ld returned 1 exit status

LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/home/paul/haikumy/haiku/generated/objects/linux/lib" ../build/scripts/rm_attrs objects/linux/x86_64/release/tools/rm_attrs -f "objects/linux/x86_64/release/tools/package/package"
gcc -Xlinker --no-as-needed -Wl,--copy-dt-needed-entries -Wl,-rpath,/home/paul/haikumy/haiku/generated/objects/linux/lib -lm -ldl -lz -o "objects/linux/x86_64/release/tools/package/package"   "objects/linux/x86_64/release/tools/package/command_add.o" "objects/linux/x86_64/release/tools/package/command_checksum.o" "objects/linux/x86_64/release/tools/package/command_create.o" "objects/linux/x86_64/release/tools/package/command_dump.o" "objects/linux/x86_64/release/tools/package/command_extract.o" "objects/linux/x86_64/release/tools/package/command_info.o" "objects/linux/x86_64/release/tools/package/command_list.o" "objects/linux/x86_64/release/tools/package/command_recompress.o" "objects/linux/x86_64/release/tools/package/package.o" "objects/linux/x86_64/release/tools/package/PackageWriterListener.o" "objects/linux/x86_64/release/tools/package/PackageWritingUtils.o" \
"objects/linux/x86_64/release/build/libroot/libroot_build_function_remapper.a" "/home/paul/haikumy/haiku/generated/objects/linux/lib/libroot_build.so" "/home/paul/haikumy/haiku/generated/objects/linux/lib/libpackage_build.so" "/home/paul/haikumy/haiku/generated/objects/linux/lib/libbe_build.so" -lsupc++  \


...failed Link objects/linux/x86_64/release/tools/package/package ...

BUILD FAILURE:
...failed updating 2 target(s)...
...skipped 7 target(s)...
...updated 111 target(s)...

[nix-shell:~/haikumy/haiku/generated]$ 


but this is beyond the scope of this ticket.

Thank you guys!

comment:10 by dufresnep, 10 months ago

I did configure again, replacing x86 by x86_64.

It did gone much farther:

download/noto_sans_cjk_jp-1.004-2-any.hpk 100%[=====================================================================================>] 117.74M  8.39MB/s    in 16s     

2023-07-13 07:24:04 (7.59 MB/s) - ‘download/noto_sans_cjk_jp-1.004-2-any.hpkg’ saved [123454659/123454659]

Error while writing to file `/myfs/system/packages/noto_sans_cjk_jp-1.004-2-any.hpkg': No space left on device
Error: Command failed: No space left on device
Error: Command was:
  cp -f :download/noto_sans_cjk_jp-1.004-2-any.hpkg /myfs/system/packages

export imagePath="haiku.image"
export isImage="1"
export isVMwareImage=""
../build/scripts/build_haiku_image /home/paul/haikumy/haiku/generated/./haiku.image-init-vars /home/paul/haikumy/haiku/generated/./haiku.image-make-dirs /home/paul/haikumy/haiku/generated/./haiku.image-copy-files /home/paul/haikumy/haiku/generated/./haiku.image-extract-files

...failed BuildHaikuImage1 haiku.image ...
...removing haiku.image

BUILD FAILURE:
...failed updating 1 target(s)...
...updated 16034 target(s)...

[nix-shell:~/haikumy/haiku/generated]$ df -h
Filesystem      Size  Used Avail Use% Mounted on
devtmpfs        794M     0  794M   0% /dev
tmpfs           7.8G  427M  7.4G   6% /dev/shm
tmpfs           3.9G  6.0M  3.9G   1% /run
tmpfs           7.8G  480K  7.8G   1% /run/wrappers
/dev/sda2       292G  213G   65G  77% /
/dev/sda1       500M  420M   80M  85% /boot
tmpfs           1.6G  124K  1.6G   1% /run/user/1000
/dev/sr0        701M  701M     0 100% /run/media/paul/Mon disque

[nix-shell:~/haikumy/haiku/generated]$ 


I am confused as on which device space is missing.

comment:12 by pulkomandy, 10 months ago

Which arguments to Jam did you use? This can happen if you don't specify a build profile, as the current default is not used anymore (we should change the default).

jam @nightly-anyboot should build a nightly image (same as you can download from the website). But just "jam" will build some default settings that don't work and the generated image is too small for what it tries to put in it.

by dufresnep, 10 months ago

Attachment: shell.nix added

working shell.nix (used by nix-shell before calling ./configure --cross-tools-source ../buildtools --build-cross-tools x86_64

comment:13 by pulkomandy, 10 months ago

Resolution: no change required
Status: newclosed

I have updated the website to include your shell.nix file and add NixOS to the list of supported platforms (this will be online shortly, there seem to be some problem with the website deployment). I think we can close the ticket with that.

Note: See TracTickets for help on using tickets.