zig build-lib -dynamic --c-source hello.cpp -lc++ -lc -target mipsel-linux-musl
It outputs this error many times. Here are the first 3:
lld: error: can't create dynamic relocation R_MIPS_32 against symbol: DW.ref.__gxx_personality_v0 in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output
>>> defined in zig-cache/o/wBiI-p6eCZdmTuXt5tRTRWO2FhNemqh2pP_OHQZkLg3tpaS7QxKY8XE-koliaV8r/hello.o
>>> referenced by hello.cpp
>>> zig-cache/o/wBiI-p6eCZdmTuXt5tRTRWO2FhNemqh2pP_OHQZkLg3tpaS7QxKY8XE-koliaV8r/hello.o:(.eh_frame+0xAB0B)
lld: error: can't create dynamic relocation R_MIPS_32 against local symbol in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output
>>> defined in zig-cache/o/wBiI-p6eCZdmTuXt5tRTRWO2FhNemqh2pP_OHQZkLg3tpaS7QxKY8XE-koliaV8r/hello.o
>>> referenced by hello.cpp
>>> zig-cache/o/wBiI-p6eCZdmTuXt5tRTRWO2FhNemqh2pP_OHQZkLg3tpaS7QxKY8XE-koliaV8r/hello.o:(.eh_frame+0xAB25)
lld: error: can't create dynamic relocation R_MIPS_32 against local symbol in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output
>>> defined in zig-cache/o/wBiI-p6eCZdmTuXt5tRTRWO2FhNemqh2pP_OHQZkLg3tpaS7QxKY8XE-koliaV8r/hello.o
>>> referenced by hello.cpp
>>> zig-cache/o/wBiI-p6eCZdmTuXt5tRTRWO2FhNemqh2pP_OHQZkLg3tpaS7QxKY8XE-koliaV8r/hello.o:(.eh_frame+0xAB55)