Skip to content

CBMC does not build with clang on ubuntu 22.04 #7366

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
esteffin opened this issue Nov 21, 2022 · 3 comments
Closed

CBMC does not build with clang on ubuntu 22.04 #7366

esteffin opened this issue Nov 21, 2022 · 3 comments

Comments

@esteffin
Copy link
Contributor

esteffin commented Nov 21, 2022

Building CBMC with clang on ubuntu 22.04 fails.

The issue is that during the compilation of target library-check.stamp at step Checking /root/cbmc/src/ansi-c/library/stdio.c there is an error:

__libcheck.c:859:5: error: definition with same mangled name '__isoc99_fscanf' as another definition
int __isoc99_fscanf

The issue happens with clang-11, clang-12 and clang-13.

The build using gcc instead works.

CBMC version: commit d932d6f
Operating system: Ubuntu 22.04
Exact command line resulting in the issue: make
What behaviour did you expect: A correct build
What happened instead: Error during build

@esteffin esteffin added the Build label Nov 21, 2022
@esteffin
Copy link
Contributor Author

esteffin commented Nov 21, 2022

After a bit of investigation it seems that the script src/ansi-c/library_check.sh fails when checking stdio.c as clang cannot build it on Ubuntu 22.04.

On Mac the compilation with clang-12 instead is successful.

@tautschnig
Copy link
Collaborator

We should probably #ifndef the non __isoc99_ variants when __clang__ is set.

@tautschnig tautschnig self-assigned this Jan 12, 2023
@tautschnig
Copy link
Collaborator

To be fixed as part of #7496.

tautschnig added a commit to tautschnig/cbmc that referenced this issue Jan 23, 2023
We separately define __isoc99_fscanf.

Fixes: diffblue#7366
@tautschnig tautschnig removed their assignment Jan 23, 2023
tautschnig added a commit to tautschnig/cbmc that referenced this issue Jan 23, 2023
glibc headers define C99 variants via asm renaming. Library checks
(rightly) failed when using clang 14, reporting duplicate definitions.

Fixes: diffblue#7366
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants