This is an archive of the discontinued LLVM Phabricator instance.

Fix build under musl
ClosedPublic

Authored by markand on Oct 11 2019, 6:46 AM.

Details

Reviewers
JDevlieghere
Summary

This fixes the build under musl because of missing definitions.

In file included from /src/vanilla/dev/lldb/lldb-9.0.0.src/source/API/SBReproducerPrivate.h:18:
/src/vanilla/dev/lldb/lldb-9.0.0.src/include/lldb/Utility/ReproducerInstrumentation.h:567:58: error: invalid application of 'sizeof'
      to an incomplete type '_IO_FILE'
      m_stream.write(reinterpret_cast<const char *>(&t), sizeof(T));
                                                         ^~~~~~~~~
/src/vanilla/dev/lldb/lldb-9.0.0.src/include/lldb/Utility/ReproducerInstrumentation.h:555:7: note: in instantiation of function
      template specialization 'lldb_private::repro::Serializer::Serialize<_IO_FILE>' requested here
      Serialize(*t);
      ^
/src/vanilla/dev/lldb/lldb-9.0.0.src/include/lldb/Utility/ReproducerInstrumentation.h:541:5: note: in instantiation of function
      template specialization 'lldb_private::repro::Serializer::Serialize<_IO_FILE>' requested here
    Serialize(head);
    ^
/src/vanilla/dev/lldb/lldb-9.0.0.src/include/lldb/Utility/ReproducerInstrumentation.h:542:5: note: in instantiation of function
      template specialization 'lldb_private::repro::Serializer::SerializeAll<_IO_FILE *>' requested here
    SerializeAll(tail...);
    ^
/src/vanilla/dev/lldb/lldb-9.0.0.src/include/lldb/Utility/ReproducerInstrumentation.h:639:16: note: in instantiation of function
      template specialization 'lldb_private::repro::Serializer::SerializeAll<lldb::SBCommandReturnObject *, _IO_FILE *>' requested
      here
    serializer.SerializeAll(args...);
               ^
/src/vanilla/dev/lldb/lldb-9.0.0.src/source/API/SBCommandReturnObject.cpp:109:3: note: in instantiation of function template
      specialization 'lldb_private::repro::Recorder::Record<unsigned long, lldb::SBCommandReturnObject *, _IO_FILE *,
      lldb::SBCommandReturnObject *, _IO_FILE *>' requested here
  LLDB_RECORD_METHOD(size_t, SBCommandReturnObject, PutOutput, (FILE *), fh);
  ^
/src/vanilla/dev/lldb/lldb-9.0.0.src/include/lldb/Utility/ReproducerInstrumentation.h:112:17: note: expanded from macro
      'LLDB_RECORD_METHOD'
    sb_recorder.Record(                                                        \
                ^
//include/bits/alltypes.h:356:16: note: forward declaration of '_IO_FILE'
typedef struct _IO_FILE FILE;
               ^
1 error generated.

Diff Detail

Repository
rLLDB LLDB

Event Timeline

markand created this revision.Oct 11 2019, 6:46 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 11 2019, 6:46 AM

Wait, actually the patch isn't working entirely.

In fact, in musl, the content of the structure FILE isn't exposed. But anyway, I don't understand why the code tries to write the content of the structure directly.

teemperor added a subscriber: teemperor.

(Adding Jonas because reproducers)

Btw, you can just upload a diff to phabricator (e.g. the output you get with git diff -U9999 > fix-build.patch when using the monorepo ) and that's how the code change here gets properly rendered.

JDevlieghere accepted this revision.Oct 14 2019, 10:06 AM

Given that the FILE struct lives in stdio.h this makes sense.

This revision is now accepted and ready to land.Oct 14 2019, 10:06 AM

Let me know if you want me to commit this for you.

MaskRay closed this revision.Dec 31 2020, 11:45 AM