Linux Standard Base Specification 1.0.0 | ||
---|---|---|
Prev | Appendix B. How To Create An LSB Compliant Application |
Create a simple "domain name" program.
cat > dn.c << FILE &include <stdio.h> &include <unistd.h> int main(int argc, char *argv[]) { char domain[BUFSIZ]; int rc; rc = call_my_non_lsb_getdomainname((char *)&domain, BUFSIZ); if (0 == rc) { printf("domainname is: %s\n", domain); } } FILE |
Compile the "domain name" program and link it with the LSB loader and libraries.
$ gcc -o dn -Wall dn.c -L/usr/lib/lsb -Wl,--dynamic-linker=/lib/ld-lsb.so.1 domain.c: In function `main': domain.c:14: warning: control reaches end of non-void function /tmp/ccHpOeFD.o: In function `main': /tmp/ccHpOeFD.o(.text+0x16): undefined reference to `call_my_non_lsb_getdomainname' collect2: ld returned 1 exit status |
The dn.c failed to link with the LSB filters libraries, because the API call_my_non_lsb_getdomainname is not defined.
Let's assume that we were able to compile & link some libraries, and be using the correct LSB loader. Test to verify with lsbappchk if the domain name application is using only LSB specified APIs.
$ lsbappchk hw call_my_non_lsb_getdomainname |
The LSB's lsbappchk outputed call_my_non_lsb_getdomainname, so it detected an API call that is not specified by the LSB. To correct this, the application should discontinue the use of those APIs, or a trouble report should be sent to the LSB.