Skip to content

Improve native-lib experience with shared linking #4741

@woodsmc

Description

@woodsmc

Is your feature request related to a problem? Please describe.
When loading a native-lib, the native-lib will usually need to invoke WAMR functions, for instance for translating between linear memory and physical host memory. However this will fail. The iwasm linux binary is built with symbols hidden, this means that at shared object load time the linker cannot link function calls from the native library to the code in iwasm.

Describe the solution you'd like
A clear and concise description of what you want to happen.

build iwasm by default with shared symbols, allowing linking.
Line 170, of wasm-micro-runtime/product-mini/platforms/linux/CMakeLists.txt

from:

add_library (vmlib  ${WAMR_RUNTIME_LIB_SOURCE})

to:

add_library (vmlib SHARED ${WAMR_RUNTIME_LIB_SOURCE})

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

  1. Linking the native-lib against vmlib, but we shouldn't need to.
  2. Manually asking the user to update the runtime.

Additional context
Add any other context or screenshots about the feature request here.

This can be enabled by hand. Turning this by default means that for developers creating their first native-lib, this is an easier, and better experience.

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions