Codegen emits function declaration twice with different linkages
Nobody has claimed this yet.
- Dominant language
- Lean
- Stars
- 9.2k
- Forks
- 990
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 175
Description
Description
I tried to compile Lean from sources using Visual C++.
When compiling stage0 stdlib the compiler spits (among others) the following 2 error messages:
C:\G\sources2\LEAN\lean\lean4\stage0\stdlib\Lean\Meta\ExprDefEq.c(219): error C2375: 'lean_is_expr_def_eq': redefinition; different linkage
C:\G\sources2\LEAN\lean\lean4\stage0\stdlib\Lean\Meta\ExprDefEq.c(123): note: see declaration of 'lean_is_expr_def_eq'
and
C:\G\sources2\LEAN\lean\lean4\stage0\stdlib\Lean\Meta\LevelDefEq.c(53): error C2375: 'lean_is_level_def_eq': redefinition; different linkage
C:\G\sources2\LEAN\lean\lean4\stage0\stdlib\Lean\Meta\LevelDefEq.c(42): note: see declaration of 'lean_is_level_def_eq'
And indeed, lean_is_expr_def_eq is first declared as
lean_object* lean_is_expr_def_eq(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
and a bit later redeclared (in the same file) as
LEAN_EXPORT lean_object* lean_is_expr_def_eq(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
(same for lean_is_level_def_eq)
Versions
2022-05-09 GMT 05:15
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the generated stage0/stdlib/Lean/Meta/ExprDefEq.c and LevelDefEq.c files, comparing the first declarations with the later LEAN_EXPORT declarations. Trace the code-generation entry point that produces these declarations and reproduce the build with Visual C++; done means the generated files compile without different-linkage redefinition errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, cpp
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100