1

Using Meson build and GCC on a personal C11 project with GLib on Linux Fedora, I keep randomly getting the following error when compiling :

movie.s: Assembler messages:
movie.s:6916: Error: no such instruction: `te.gnu-stack,"",@progbits'
ninja: build stopped: subcommand failed.

After inspecting the faulty file, the generated ASM ending is malformed (the last instruction look ill-copied ?)

Incorrect version :

.LASF52:
    .string "GClassInitFunc"
    .ident  "GCC: (GNU) 10.3.1 20210422 (Red Hat 10.3.1-1)"
    .section    .note.GNU-stack,"",@progbits
te.GNU-stack,"",@progbits

Correct version :

.LASF52:
    .string "GClassInitFunc"
    .ident  "GCC: (GNU) 10.3.1 20210422 (Red Hat 10.3.1-1)"
    .section    .note.GNU-stack,"",@progbits

As you can see on the last line of the faulty ASM, this output line is appended :

te.GNU-stack,"",@progbits

When this error occur, I basically relaunch the compilation process, and sometimes it just 'magically' work (without any modifications to any files).

My compiler versions :

  • Linux Fedora release 33 (Thirty Three)
  • (GCC) 10.3.1 20210422 (Red Hat 10.3.1-1) (April 8, 2021)
  • meson --buildtype=debug : without optimizations

Does anyone have any idea what could be causing this?


EDIT:
Solved the issue : Posted the issue on Meson Github : github.com/mesonbuild/meson/issues/8862 ; it was "save-temps" causing the harm, because ninja use parallel compilation which caused the intermediate files to be overwritten on the same time. You could either disable "-save-temps" or use "-j1" option to limit to one process

In summary : save-temps is not full parallel-safe when building multiple objects/executable with a common source file.

Jason Aller
  • 3,541
  • 28
  • 38
  • 38
Spidery
  • 43
  • 5

1 Answers1

2

Meson build here ; basically I have two "executable" target with a shared source, and it seems the first overlap the second for some reason although it should be sequentially.

Example :

executable('app',
    sources: [
        'main.c',
        'movie.c',
    ],
    dependencies: [depglib, depgtk, deplibcurl],
)

executable('convert',
    sources: [
        'convert.c',
        'movie.c',
    ],
    dependencies: [depglib, depgio],
)

This answer suggest linking against a shared library : https://stackoverflow.com/a/47725711/7776411 ; I'll try that!

Thanks!

Spidery
  • 43
  • 5
  • 1
    Solved the issue : Posted the issue on Meson Github : https://github.com/mesonbuild/meson/issues/8862 ; it was "save-temps" causing the harm, because ninja use parallel compilation wich caused the intermediate files to be overwritten on the same time. You could either disable "-save-temps" or use "-j1" option to limit to one process. – Spidery Jun 09 '21 at 22:26
  • You might want to edit that last comment into your answer, about save-temps not being parallel-safe. (if you build the same source file multiple times? Or if the temp files are all in some parent directory, not in the subdirs.) – Peter Cordes Jun 10 '21 at 00:55