Skip to content

[Bug]: Debug flags responsible for CppInterOp's emscripten build #419

Open
@anutosh491

Description

@anutosh491

Description of bug

Currently this is how CppInterOp's emscripten build is conducted.

  set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS TRUE)
  set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-s SIDE_MODULE=1")
  set(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "-s SIDE_MODULE=1")
  set(CMAKE_STRIP FALSE)

  add_llvm_library(clangCppInterOp
    SHARED

    CppInterOp.cpp
    CXCppInterOp.cpp
    DynamicLibraryManager.cpp
    DynamicLibraryManagerSymbol.cpp
    Paths.cpp

    # Additional libraries from Clang and LLD
    LINK_LIBS
    clangInterpreter
  )

The first 4 lines are necessary to build SHARED objects through cmake using emscripten. Check comment (emscripten-core/emscripten#15276 (comment)). This is followed by add_llvm_library (more like a wrapper over add_library and target_link_libraries). We could even do something as simple as

  add_library(clangCppInterOp SHARED
    CppInterOp.cpp
    CXCppInterOp.cpp
    DynamicLibraryManager.cpp
    DynamicLibraryManagerSymbol.cpp
    Paths.cpp
  )

  target_link_libraries(clangCppInterOp clangInterpreter)

What operating system was you using when the bug occured?

MacOS

What is the architechture of the cpu on your system?

ARM

What did you build CppInterOp against?

Clang-repl (LLVM19)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingstale

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions