[Lustre-discuss] building example taken from manual page, api, 1.8.1.1

DT Piotr Wadas pwadas at dtpw.pl
Sat Jan 30 12:51:19 PST 2010


Hello,
I'm trying to build test program found in manual page 
llapi_file_create(3).

Lustre suite, including server, client, utils and liblustre was 
configured, source-build and installed by me, machine is booted with 
lustre-enabled kernel, and lustre filesystem is mounted from remote 
server. I use gcc 4.1, machine is x86 (Xeon)

configure options used to build lustre were as follows 

./configure --with-linux=/usr/src/linux-2.6.27.29-0.1_lustre.1.8.1.1 
 --enable-server --enable-client --enable-utils --enable-tests 
--enable-liblustre --enable-quota --enable-modules --enable-snmp

The example I pasted from manualpage is ( extern definition added by hand 
same effect, like I wouldn't have done it ).

-------------
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
#include <stdio.h>
#include <liblustre.h>
#include <lustre/lustre_idl.h>
#include <lustre/liblustreapi.h>
#include <lustre/lustre_user.h>

extern int llapi_file_create(const char *name, unsigned long long 
stripe_size,
                             int stripe_offset, int stripe_count,
                             int stripe_pattern);

int main(int argc, char *argv[])
{      
       int rc;
       
       if (argc != 2)
               return -1;

       rc = llapi_file_create(argv[1], 1048576, 0, 2, LOV_PATTERN_RAID0);
       if (rc < 0) {
               fprintf(stderr, "file creation has failed, %s\n", 
strerror(-rc));
               return -1;
       }
       printf("%s with stripe size 1048576, striped across 2 OSTs,"
              " has been created!\n", argv[1]);
       return 0;
}
--------------------

To build I use command:

#!/bin/bash
gcc -Wall -g -O2 \
        -include /usr/src/modules/lustre/config.h \
        -I/usr/include/lustre \
        -I/usr/src/modules/lustre/lnet/include \
        -I/usr/src/modules/lustre/lustre/include \
        -I/usr/src/modules/lustre/lustre/include/lustre \
        -L/usr/src/modules/lustre/lnet/utils \
        -llustre -llustreapi -lncurses -lreadline \
	-lnetsnmpagent -lnetsnmphelpers -lnetsnmpmibs -lnetsnmp \
        -o lopenex lopenex.c

Result:

lclient:~/LUSTRE_CTEST# ./build.sh 
/tmp/cc6DdTCe.o: In function `main':
lopenex.c:(.text+0x5f): undefined reference to `llapi_file_create'
collect2: ld returned 1 exit status
/tmp/cc6DdTCe.o: In function `main':
lopenex.c:(.text+0x5f): undefined reference to `llapi_file_create'
collect2: ld returned 1 exit status
lclient:~/LUSTRE_CTEST# 

What is I've missed? :)

Regards,
DT



More information about the lustre-discuss mailing list