c2rust icon indicating copy to clipboard operation
c2rust copied to clipboard

Fix `curl` transpilation failing in CI in `c2rust-testsuite`

Open kkysen opened this issue 6 months ago • 4 comments

kkysen avatar May 13 '25 03:05 kkysen

this is what i get when running in my system

~/c2rust-testsuite/tests/curl$ ./make.sh

...
<cut off>
...

openldap.c:82:17: error: conflicting types for 'ldap_connect'; have 'CURLcode(struct connectdata *, _Bool *)'
   82 | static CURLcode ldap_connect(struct connectdata *conn, bool *done);
      |                 ^~~~~~~~~~~~
In file included from openldap.c:39:
/usr/include/ldap.h:1555:1: note: previous declaration of 'ldap_connect' with type 'int(LDAP *)' {aka 'int(struct ldap *)'}
 1555 | ldap_connect( LDAP *ld );
      | ^~~~~~~~~~~~
  CC       libcurl_la-gopher.lo
make[2]: *** [Makefile:2096: libcurl_la-openldap.lo] Error 1

bungcip avatar May 19 '25 12:05 bungcip

this is because curl 7.64.1 cannot be compiled with latest ldap. this pull request https://github.com/curl/curl/pull/7005 already fixed it. so we can fix it either by update curl, or pin libldap2-dev to old version

bungcip avatar May 19 '25 13:05 bungcip

this is what i get when running in my system

It's annoying that the "actual useful" build log wasn't recorded in GitHub Action

shirok1 avatar May 19 '25 13:05 shirok1

after updating curl to 8.13.0 and editing configure.sh to add --with-openssl parameter. now I can run it and now get more error. At least the error is from c2rust-transpile


...
<cut off>
...

 [-Wclang-ast]
warning: Missing type 94387132983040 for node: AstNode { tag: TagTypedefDecl, children: [], loc: SrcSpan { fileid: 179, begin_line: 103, begin_column: 1, end_line: 103, end_column: 37 }, type_id: Some(94387132983040), rvalue: LValue, macro_expansions: [], macro_expansion_text: Some("__ATOMIC_SEQ_CST"), extras: [Text("atomic_long"), Bool(false)] }
Exported Clang AST was invalid. Check warnings above for unimplemented features.
--> /usr/lib/llvm-18/lib/clang/18/include/stdatomic.h:103:1
 [-Wclang-ast]
warning: Missing type 94387132982080 for node: AstNode { tag: TagTypedefDecl, children: [], loc: SrcSpan { fileid: 179, begin_line: 98, begin_column: 1, end_line: 98, end_column: 37 }, type_id: Some(94387132982080), rvalue: LValue, macro_expansions: [], macro_expansion_text: Some("__ATOMIC_SEQ_CST"), extras: [Text("atomic_uchar"), Bool(false)] }
Exported Clang AST was invalid. Check warnings above for unimplemented features.
--> /usr/lib/llvm-18/lib/clang/18/include/stdatomic.h:98:1
 [-Wclang-ast]
warning: Missing type 94387132989824 for node: AstNode { tag: TagTypedefDecl, children: [], loc: SrcSpan { fileid: 179, begin_line: 130, begin_column: 1, end_line: 130, end_column: 37 }, type_id: Some(94387132989824), rvalue: LValue, macro_expansions: [], macro_expansion_text: Some("__ATOMIC_SEQ_CST"), extras: [Text("atomic_intmax_t"), Bool(false)] }
Exported Clang AST was invalid. Check warnings above for unimplemented features.
--> /usr/lib/llvm-18/lib/clang/18/include/stdatomic.h:130:1
 [-Wclang-ast]
warning: Missing type 94387132981888 for node: AstNode { tag: TagTypedefDecl, children: [], loc: SrcSpan { fileid: 179, begin_line: 97, begin_column: 1, end_line: 97, end_column: 37 }, type_id: Some(94387132981888), rvalue: LValue, macro_expansions: [], macro_expansion_text: Some("__ATOMIC_SEQ_CST"), extras: [Text("atomic_schar"), Bool(false)] }
Exported Clang AST was invalid. Check warnings above for unimplemented features.
--> /usr/lib/llvm-18/lib/clang/18/include/stdatomic.h:97:1
 [-Wclang-ast]
warning: Missing type 94387132986080 for node: AstNode { tag: TagTypedefDecl, children: [], loc: SrcSpan { fileid: 179, begin_line: 116, begin_column: 1, end_line: 116, end_column: 37 }, type_id: Some(94387132986080), rvalue: LValue, macro_expansions: [], macro_expansion_text: Some("__ATOMIC_SEQ_CST"), extras: [Text("atomic_int_least64_t"), Bool(false)] }
Exported Clang AST was invalid. Check warnings above for unimplemented features.
--> /usr/lib/llvm-18/lib/clang/18/include/stdatomic.h:116:1
 [-Wclang-ast]
thread 'main' panicked at 'Could not find CTypeId(18680) in TypedAstContext', c2rust-transpile/src/c_ast/mod.rs:269:30
stack backtrace:
   0: rust_begin_unwind
             at /rustc/d394408fb38c4de61f765a3ed5189d2731a1da91/library/std/src/panicking.rs:584:5
   1: core::panicking::panic_fmt
             at /rustc/d394408fb38c4de61f765a3ed5189d2731a1da91/library/core/src/panicking.rs:142:14
   2: c2rust_transpile::c_ast::TypedAstContext::get_src_loc
   3: <c2rust_transpile::translator::comments::CommentLocator as c2rust_transpile::c_ast::iterators::NodeVisitor>::pre
   4: c2rust_transpile::c_ast::iterators::NodeVisitor::visit_tree
   5: c2rust_transpile::translator::comments::<impl c2rust_transpile::translator::Translation>::locate_comments
   6: c2rust_transpile::translator::translate
   7: c2rust_transpile::transpile_single
   8: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::fold
   9: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
  10: c2rust_transpile::transpile
  11: c2rust_transpile::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

bungcip avatar May 19 '25 14:05 bungcip

Fixed in https://github.com/immunant/c2rust-testsuite/pull/14

thedataking avatar Aug 13 '25 03:08 thedataking