Coding has become far simpler these days as compared to what it used to be with languages like C and even Assembly requiring programmers to put in a lot of time and study to get up to speed. However, as easy as programming has become with modern languages, there are still random bugs and glitches that keep popping up from time to time.
In this article, we’re talking about the “error adding symbols: DSO missing from command line” issue, the reasons behind it and what you can do to fix the problem.
What causes the error adding symbols: DSO missing from command line issue?
The issue generally occurs when the linker can’t find the required symbol with its normal search but the symbol is otherwise available in one or more dependencies of a mentioned dynamic library. This means that mentioning a specific library before the object doesn’t allow the system to initiate the intended command as the entity doesn’t have a library for the data.
Other common causes include:
- Syntax issues or other bugs in code
- Library isn’t included in compilation steps
How to fix the error adding symbols: DSO missing from command line issue?
Based on whether you’re a maintainer or just trying to compile or run the software, there are different approaches to the problem.
If you’re a software maintainer
Really the only thing you can do in such scenarios is to ensure that all libraries required to successfully compile the program are directly specified in the linker command line or are bundled with the package otherwise. Do keep in mind that the order in which the libraries are mentioned can also matter here.
If you’re trying to compile or run a program
If you’re just trying to compile or run a program, the first step is checking the program dependencies and making sure that you have the compilation environment set up properly. Once again, the order in which the libraries are mentioned can also come into play here so you might have to experiment with different orders based on when you’re referencing the library in your code.
Another common way of injecting this into a build is to either use lpthreads or ldflags before building the program as follows.
The aforementioned command can allow for a more permissive view of what symbols or libraries are available to the compiler and hence avoid the issue.