Skip to content

Conversation

@quark17
Copy link
Collaborator

@quark17 quark17 commented Oct 7, 2025

I have a design that uses imported C functions, and they depend on dynamic libraries, which therefore needs -l flags to be passed to the linker. When I tried using BSC to generate a Verilator simulation executable (with bsc -vsim verilator -e), Verilator failed with errors about missing references, because it was not including those libraries. I discovered that the bsc_build_vsim_verilator script wasn't passing those linker flags to Verilator.

I patched the script to pass BSC_C_LIB_PATH, BSC_CLINK_OPTS, and BSC_C_LIBS as LDFLAGS. This fixed my situation, although I was only using BSC_C_LIBS, so I haven't tested on an example that has the other two kinds of flags.

@quark17 quark17 merged commit 902302f into B-Lang-org:main Oct 22, 2025
73 checks passed
@quark17 quark17 deleted the verilator-ldflags branch October 22, 2025 20:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant