Building illumos on a Solaris 11.2 build host resulted in several instances of this error:
Undefined first referenced
symbol in file
ld: fatal: symbol referencing errors
collect2: error: ld returned 1 exit status
The symbol contract_init_fork_template is not defined in illumos, but only on the build host, in /lib/libcmdutils.so.1 and /lib/libcontract.so.1 . The error happened because some of the illumos libraries had an indirect requirement for libxml2.so.2 . This library is not available on illumos, but only on the build host. Here's an interesting example, from usr/src/lib/libpool/Makefile.com:@
- Adding -lxml2 to LDLIBS would cause lint to complain as there is no .ln file
- for libxml2, so add it to DYNFLAGS
DYNFLAGS += -lxml2
LIBS = $(DYNLIB) $(LINTLIB)
LDLIBS += -lscf -lnvpair -lexacct -lc
Other than adding libxml2.so.2 to illumos, there is no solution. The problem is that illumos is not self-contained.
Updated by Robert Mustacchi about 6 years ago
Alternatively, you should use the adjunct proto area and build those external dependencies and that way you'll have the exact versions that illumos requires and not just end up with the arbitrary version that's on the build system. For an example of setting this up, take a look at illumos-extra and how the smartos build deals with exactly this problem.