[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Handle-info] compile c client library
Dear Laurence,
Please find inline.
On 21 August 2012 11:23, Finston, Laurence <laurence.finston@gwdg.de> wrote:
>> hscreate.o -L /home/peng/hcc5_c_version/lib -lhdl
>
> Please try getting rid of the space after -L. I just checked the man page for `ld' (the actual linker, called by `gcc') and it appears that a space is permitted, but please try anyway.
>
It makes no difference.
> Have you checked /home/peng/hcc5_c_version/lib to see that the library file is there?
>
> My version looks like this:
>
> /home/lfinsto/hcc5_c_version/lib64:
>
> libhdl -> libhdl-5.3.3 --- symbolic link to the shared library
> libhdl-5.3.3 --- The shared library
> libhdl.a --- A static library
> libhdl.la --- A libtool library file
>
Mine looks almost the same
lrwxrwxrwx 1 root root 12 Aug 21 11:05 libhdl -> libhdl-5.3.3
-rwxr-xr-x 1 root root 157631 Aug 21 11:05 libhdl-5.3.3
-rw-r--r-- 1 root root 193582 Aug 21 11:05 libhdl.a
-rwxr-xr-x 1 root root 732 Aug 21 11:05 libhdl.la
drwxr-xr-x 3 root root 4096 Aug 21 10:58 perl
> If -L/home/peng/hcc5_c_version/lib (without a space) didn't work, please try copying all the files from
> /home/peng/hcc5_c_version/lib to hcc5/test and try `-L.'. If it doesn't work, please post the error.
>
The content of /home/peng/hcc5/test is now:
Makefile hsaddvals.c hsdelete.c hshome_unhome.c libhdl.a
Makefile.am hscreate.c hsdelvals.c hsmodvals.c libhdl.la
Makefile.in hscreate.o hsgetsiteinfo.c libhdl-5.3.3
And the result of running "gcc -o hscreate hscreate.o -L. -lhdl" is:
hscreate.o: In function `main':
hscreate.c:(.text+0x2c7): undefined reference to `HDLCreate'
collect2: ld returned 1 exit status
So pretty much the same. The error is just so stubborn.
Best regards,
Peng
>
> ________________________________________
>
> From: Peng Du [eddy.pdu@gmail.com]
> Sent: Tuesday, August 21, 2012 12:11 PM
> To: Finston, Laurence
> Cc: handle-info@cnri.reston.va.us
> Subject: Re: [Handle-info] compile c client library
>
> Hello Laurence,
>
> Thank you so much for following it up.
>
> It is strange that there is no complaint during configure, make or
> make install, yet the problem of linker is always reported.
>
> After I run make install, the following message is printed:
>
> ----------------------------------------------------------------------
> Libraries have been installed in:
> /home/peng/hcc5_c_version/lib
>
> If you ever happen to want to link against installed libraries
> in a given directory, LIBDIR, you must either use libtool, and
> specify the full pathname of the library, or use the `-LLIBDIR'
> flag during linking and do at least one of the following:
> - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
> during execution
> - add LIBDIR to the `LD_RUN_PATH' environment variable
> during linking
> - use the `-Wl,--rpath -Wl,LIBDIR' linker flag
> - have your system administrator add LIBDIR to `/etc/ld.so.conf'
>
> See any operating system documentation about shared libraries for
> more information, such as the ld(1) and ld.so(8) manual pages.
> ----------------------------------------------------------------------
>
> Which is similar to yours. But if I try gcc -fPIC -o hscreate
> hscreate.o -L /home/peng/hcc5_c_version/lib -lhdl , the same old
> error appears again:
>
> hscreate.o: In function `main':
> hscreate.c:(.text+0x2c7): undefined reference to `HDLCreate'
> collect2: ld returned 1 exit status
>
> But I noticed if I add -lcrypto to the command it would return
> "/usr/bin/ld: cannot find -lcrypto" - I am not sure if this is a
> useful hint.
>
> Best wishes,
>
> Peng
>
> On 21 August 2012 09:15, Finston, Laurence <laurence.finston@gwdg.de> wrote:
>> Hello,
>>
>> I've now successfully installed the C API for the Handle library. I had a couple of problems, which were not quite the same as yours. However, my solutions may be helpful to you, anyway. Perhaps the problems you were having started at an earlier stage, although in that case, I think the build process should have broken off.
>>
>> The first error I got was this:
>>
>> gcc -DHAVE_CONFIG_H -I. -I. -I. -g -O2 -MT hdl_crypto.lo -MD -MP -MF .deps/hdl_crypto.Tpo -c hdl_crypto.c -fPIC -DPIC -DPIC -o hdl_crypto.o
>> hdl_crypto.c:52:12: error: static declaration of 'x' follows non-static declaration
>> hdl_crypto.h:145:12: note: previous declaration of 'x' was here
>> [...]
>> make[2]: *** [hdl_crypto.lo] Error 1
>> make[2]: Leaving directory `/home/lfinsto/hcc5'
>>
>> I commented out the `static' keyword in hdl_crypto.c.
>>
>> This was the next error:
>>
>> /usr/lib64/gcc/x86_64-suse-linux/4.6/../../../../x86_64-suse-linux/bin/ld: ../hslookup.o: relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a shared object; recompile with -fPIC
>> ../hslookup.o: could not read symbols: Bad value
>> collect2: ld returned 1 exit status
>> make[3]: *** [blib/arch/auto/hdllib/hdllib.so] Error 1
>>
>> -fPIC is for generating "position-independent" object code, which is needed for a shared library.
>> I added CFLAGS=-fPIC to the call to configure, i.e.,
>>
>> ./configure CFLAGS=-fPIC --prefix=/home/lfinsto/hcc5_c_version
>>
>> I don't like this particularly, because it will probably be used where it's not needed, but at present the important thing is to get the package built.
>>
>> If I recall correctly, `make' worked at this point, but `make install' failed with this error:
>>
>> Files found in blib/arch: installing files in blib/lib into architecture dependent library tree
>> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
>> ERROR: Can't create '/usr/lib/perl5/5.14.2/x86_64-linux-thread-multi'
>> Do not have write permissions on '/usr/lib/perl5/5.14.2/x86_64-linux-thread-multi'
>>
>> I don't know why anything needs to be installed in this directory, but it means that one has to be root, even if one uses the `--prefix' option to `configure'. So, I logged myself in as root, ran configure as above, make and make install. This worked.
>>
>> Then, I tried to build the programs in hcc5/test and get this familiar error:
>>
>> gcc -fPIC -o hscreate hscreate.o -lhdl -lcrypto
>> /usr/lib64/gcc/x86_64-suse-linux/4.6/../../../../x86_64-suse-linux/bin/ld: cannot find -lhdl
>>
>> After make install, this message is output:
>> ----------------------------------------------------------------------
>> Libraries have been installed in:
>> /home/lfinsto/hcc5_c_version/lib64
>>
>> If you ever happen to want to link against installed libraries
>> in a given directory, LIBDIR, you must either use libtool, and
>> specify the full pathname of the library, or use the `-LLIBDIR'
>> flag during linking and do at least one of the following:
>> - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
>> during execution
>> - add LIBDIR to the `LD_RUN_PATH' environment variable
>> during linking
>> - use the `-Wl,--rpath -Wl,LIBDIR' linker flag
>> - have your system administrator add LIBDIR to `/etc/ld.so.conf'
>>
>> See any operating system documentation about shared libraries for
>> more information, such as the ld(1) and ld.so(8) manual pages.
>> ----------------------------------------------------------------------
>>
>> Adding `-L/home/lfinsto/hcc5_c_version/lib64' to the linking command actually works:
>>
>> gcc -fPIC -o hscreate hscreate.o -L/home/lfinsto/hcc5_c_version/lib64 -lhdl -lcrypto
>>
>> Success!
>>
>> However, I don't want to do the same thing for each of the other programs, so I add
>> `LDFLAGS=-L/home/lfinsto/hcc5_c_version/lib64' to the call to configure, i.e.,
>>
>> ./configure CFLAGS=-fPIC LDFLAGS=-L/home/lfinsto/hcc5_c_version/lib64 --prefix=/home/lfinsto/hcc5_c_version
>>
>> I don't like this either, particularly, but it shouldn't do any harm. To make sure that this is so, I call `make clean' before running configure, make and make install, to make sure everything is rebuilt. Of course, I can't really be sure, without examining what `make clean' does, but again, at this point, the important thing is to get the package built.
>>
>> Now, when I go into hcc5/test, this works:
>>
>> make hscreate
>>
>> And this also works:
>>
>> make hsdelete hsaddvals hsdelvals hsgetsiteinfo hshome_unhome hsmodvals
>>
>> I can call hscreate. I get an error, but I don't know how it's supposed to be used and it have to do with my handle server. I apparently don't have to set `LD_LIBRARY_PATH', but I don't know why not.
>>
>> I hope this helps.
>>
>> Laurence
>>
>>
>>
>>
>>
>>
>>
>> ________________________________________
>> From: Peng Du [eddy.pdu@gmail.com]
>> Sent: Monday, August 20, 2012 3:50 PM
>> To: Finston, Laurence
>> Cc: handle-info@cnri.reston.va.us
>> Subject: Re: [Handle-info] compile c client library
>>
>> Dear Laurence,
>>
>> Your kind help and useful advice are very much appreciated and I got a
>> lot of insight from your comments.
>>
>> It is indeed very strange that the definitions of the test
>> applications cannot be recognised. I will keep thinking about it and
>> hopefully there could be an explanation sometime soon.
>>
>> Best wishes,
>>
>> Peng
>>
>> On 20 August 2012 14:42, Finston, Laurence <laurence.finston@gwdg.de> wrote:
>>> I don't know why the definition of HDLCreate isn't being found. I'll try installing the library when I get a chance and see if it works for me.
>>>
>>> Perhaps someone more knowledgeable about this library could help you sooner, though.
>>>
>>> I'm sorry that my suggestions didn't work.
>>>
>>> Laurence
>>> ________________________________________
>>> From: Peng Du [eddy.pdu@gmail.com]
>>> Sent: Monday, August 20, 2012 3:29 PM
>>> To: Finston, Laurence
>>> Cc: handle-info@cnri.reston.va.us
>>> Subject: Re: [Handle-info] compile c client library
>>>
>>> Yes I do have root privileges. Just tried without -prefix but the same
>>> error still happens.
>>>
>>> /bin/sh ../libtool --mode=link gcc -g -O2 -lhdl -L/usr/local/lib
>>> -o hscreate hscreate.o
>>> gcc -g -O2 -o hscreate hscreate.o /usr/local/lib/libhdl
>>> -L/usr/local/lib/libhdl -Wl,--rpath -Wl,/usr/local/lib -Wl,--rpath
>>> -Wl,/usr/local/lib
>>> hscreate.o: In function `main':
>>> /home/peng/hcc5/test/hscreate.c:85: undefined reference to `HDLCreate'
>>> collect2: ld returned 1 exit status
>>> make: *** [hscreate] Error 1
>>>
>>> Many thanks.
>>>
>>> Peng
>>>
>>> On 20 August 2012 13:58, Finston, Laurence <laurence.finston@gwdg.de> wrote:
>>>>> I tried both, but it makes no difference.
>>>>
>>>> If you have root privileges, it might be worth trying to run configure without the --prefix argument. Then the library will be installed in /usr/local/lib.
>>>>
>>>>> it reports "gcc: libhdl: No such file or directory" which is
>>>>> understandable since the file is not in hcc5/test directory. And if I
>>>>> try
>>>>> gcc -g -O2 -o hscreate hscreate.o /home/peng/hcc5/lib/libhdl
>>>>> -L/home/peng/hcc5/lib -Wl,--rpath -Wl,/usr/local/lib -Wl,--rpath
>>>>> -Wl,/usr/local/lib
>>>>> then the same old error occurs again.
>>>>
>>>> Sorry, it should be -lhdl. It is possible to link using the actual path of a library file, but one doesn't normally do this.
>>>> -lhdl to tell the linker to link with the the handle library and -L<path> to tell the linker where to find it should work.
>>>>
>>>> Laurence
>>>>
>>>>
>>>> ________________________________________
>>>> From: Peng Du [eddy.pdu@gmail.com]
>>>> Sent: Monday, August 20, 2012 2:50 PM
>>>> To: Finston, Laurence
>>>> Cc: handle-info@cnri.reston.va.us
>>>> Subject: Re: [Handle-info] compile c client library
>>>>
>>>> Hi Laurence,
>>>>
>>>> Please see inline.
>>>>
>>>> On 20 August 2012 13:39, Finston, Laurence <laurence.finston@gwdg.de> wrote:
>>>>>
>>>>>> gcc -g -O2 -o hscreate hscreate.o /usr/local/lib/libhdl
>>>>>
>>>>> This is wrong. libhdl isn't in /usr/local/lib/libhdl. Of course, if you have root privileges, you could just copy it there or
>>>>> create a symbolic link in that directory.
>>>>
>>>> I tried both, but it makes no difference.
>>>>
>>>>>
>>>>>> gcc -g -O2 -o hscreate hscreate.o /usr/local/lib/libhdl
>>>>>> -L/home/peng/hcc5/lib -Wl,--rpath -Wl,/usr/local/lib -Wl,--rpath
>>>>>> -Wl,/usr/local/lib
>>>>>
>>>>> I suggest just replacing /usr/local/lib/libhdl with libhdl in the first line of this command and running it from the shell. If it doesn't work, please post the error.
>>>>>
>>>> If I just run
>>>> gcc -g -O2 -o hscreate hscreate.o libhdl -L/home/peng/hcc5/lib
>>>> -Wl,--rpath -Wl,/usr/local/lib -Wl,--rpath -Wl,/usr/local/lib
>>>>
>>>> it reports "gcc: libhdl: No such file or directory" which is
>>>> understandable since the file is not in hcc5/test directory. And if I
>>>> try
>>>> gcc -g -O2 -o hscreate hscreate.o /home/peng/hcc5/lib/libhdl
>>>> -L/home/peng/hcc5/lib -Wl,--rpath -Wl,/usr/local/lib -Wl,--rpath
>>>> -Wl,/usr/local/lib
>>>> then the same old error occurs again.
>>>>
>>>> Best regards,
>>>>
>>>> Peng
>>>>
>>>>>
>>>>>
>>>>>
>>>>> ________________________________________
>>>>> From: Peng Du [eddy.pdu@gmail.com]
>>>>> Sent: Monday, August 20, 2012 2:25 PM
>>>>> To: Finston, Laurence
>>>>> Cc: handle-info@cnri.reston.va.us
>>>>> Subject: Re: [Handle-info] compile c client library
>>>>>
>>>>> Thanks for the tips. I think the reason why LDFLAGS is not used is
>>>>> there is a line in the Makefile "LDFLAGS = ". As a result no matter
>>>>> how LDFLAGS is defined outside it will be set to blank when the
>>>>> Makefile is used.
>>>>>
>>>>> After passing LDFLAGS to configure the flag appears indeed used but
>>>>> the error remains:
>>>>>
>>>>> /bin/sh ../libtool --mode=link gcc -g -O2 -lhdl -L/home/peng/hcc5/lib
>>>>> -o hscreate hscreate.o
>>>>> gcc -g -O2 -o hscreate hscreate.o /usr/local/lib/libhdl
>>>>> -L/home/peng/hcc5/lib -Wl,--rpath -Wl,/usr/local/lib -Wl,--rpath
>>>>> -Wl,/usr/local/lib
>>>>> hscreate.o: In function `main':
>>>>> /home/peng/hcc5/test/hscreate.c:85: undefined reference to `HDLCreate'
>>>>> collect2: ld returned 1 exit status
>>>>> make: *** [hscreate] Error 1
>>>>>
>>>>> Best regards,
>>>>>
>>>>> Peng
>>>>>
>>>>> On 20 August 2012 13:16, Finston, Laurence <laurence.finston@gwdg.de> wrote:
>>>>>> It must be set to "-L<path>", e.g., -L/home/peng/hcc5/lib
>>>>>>
>>>>>> If you need more paths, they should be separated with colons, e.g.,
>>>>>> -L/home/peng/hcc5/lib:/home/xxx/lib
>>>>>>
>>>>>>> /bin/sh ../libtool --mode=link gcc -g -O2 -lhdl -o hscreate hscreate.o
>>>>>>> gcc -g -O2 -o hscreate hscreate.o /usr/local/lib/libhdl -Wl,--rpath
>>>>>>> -Wl,/usr/local/lib -Wl,--rpath -Wl,/usr/local/lib
>>>>>>
>>>>>> However, it would seem that LDFLAGS is not being used at all here. Perhaps it would help to run
>>>>>> configure again and pass LDFLAGS to it, e.g.,
>>>>>>
>>>>>> ./configure LDFLAGS="-L/home/peng/hcc5/lib" --prefix (etc.)
>>>>>>
>>>>>>
>>>>>> Laurence
>>>>>>
>>>>>> ________________________________________
>>>>>>
>>>>>> From: Peng Du [eddy.pdu@gmail.com]
>>>>>> Sent: Monday, August 20, 2012 2:01 PM
>>>>>> To: Finston, Laurence
>>>>>> Cc: handle-info@cnri.reston.va.us
>>>>>> Subject: Re: [Handle-info] compile c client library
>>>>>>
>>>>>> Dear Laurence,
>>>>>>
>>>>>> Thanks very much. Setting LDFLAGS outside the Makefile does not solve
>>>>>> the problem either. Below I am summarising the problem again:
>>>>>>
>>>>>> I unzipped the c client library to /home/peng/hcc5. Then in the
>>>>>> directory I ran ./configure -prefix=$PWD , make and make install, one
>>>>>> by one as advised in the install.txt.
>>>>>>
>>>>>> After setting the environment variable LDFLAGS as /home/peng/hcc5/lib
>>>>>> , I tried to compile the example code hscreate.c in hcc5/test by
>>>>>> entering the directory and executing "make hscreate". But I got the
>>>>>> following error message:
>>>>>>
>>>>>> /bin/sh ../libtool --mode=link gcc -g -O2 -lhdl -o hscreate hscreate.o
>>>>>> gcc -g -O2 -o hscreate hscreate.o /usr/local/lib/libhdl -Wl,--rpath
>>>>>> -Wl,/usr/local/lib -Wl,--rpath -Wl,/usr/local/lib
>>>>>> hscreate.o: In function `main':
>>>>>> /home/peng/hcc5/test/hscreate.c:85: undefined reference to `HDLCreate'
>>>>>> collect2: ld returned 1 exit status
>>>>>> make: *** [hscreate] Error 1
>>>>>>
>>>>>> Best wishes,
>>>>>>
>>>>>> Peng
>>>>>>
>>>>>> On 20 August 2012 12:48, Finston, Laurence <laurence.finston@gwdg.de> wrote:
>>>>>>> Please leave the handle-info mailing list on the "cc".
>>>>>>>
>>>>>>>> I found LDFLAGS in the Makefile which was blank and set it as
>>>>>>>> "-L/home/peng/hcc5/lib" where the libhdl file can be found. But it
>>>>>>>> does not seem to solve the problem.
>>>>>>>
>>>>>>> I don't quite understand this. The path to the library must be set with the -L option when you link the programs
>>>>>>> in `hcc5/test'. I don't recommend changing the Makefile in that directory, it was generated using Automake and isn't intended to be modified by hand. Setting LDFLAGS in the environment should work. If it doesn't, please post the output from make to this list and perhaps someone will be able to see what the problem is.
>>>>>>>
>>>>>>> Laurence
>>>>>>> ________________________________________
>>>>>>> From: Peng Du [eddy.pdu@gmail.com]
>>>>>>> Sent: Monday, August 20, 2012 12:42 PM
>>>>>>> To: Finston, Laurence
>>>>>>> Subject: Re: [Handle-info] compile c client library
>>>>>>>
>>>>>>> Thanks Laurence,
>>>>>>>
>>>>>>> I found LDFLAGS in the Makefile which was blank and set it as
>>>>>>> "-L/home/peng/hcc5/lib" where the libhdl file can be found. But it
>>>>>>> does not seem to solve the problem.
>>>>>>>
>>>>>>> Best wishes,
>>>>>>>
>>>>>>> Peng
>>>>>>>
>>>>>>> On 20 August 2012 07:54, Finston, Laurence <laurence.finston@gwdg.de> wrote:
>>>>>>>>> And last item, i.e. -lhdl, does the linking. So I don't quite
>>>>>>>>> understand why it is not working.
>>>>>>>>
>>>>>>>> The linker requires the path to the library, which you can pass to it using the -L option, the LDFLAGS environment variable or setting the default path (in /etc/ld.so.conf or whatever your system uses).
>>>>>>>>
>>>>>>>> Laurence
>>>>>>>>
>>>>>>>> ________________________________________
>>>>>>>> From: Peng Du [eddy.pdu@gmail.com]
>>>>>>>> Sent: Sunday, August 19, 2012 6:14 PM
>>>>>>>> To: Finston, Laurence
>>>>>>>> Subject: Re: [Handle-info] compile c client library
>>>>>>>>
>>>>>>>> Hello Laurence,
>>>>>>>>
>>>>>>>> I had a look at the directory and libhdl is located under hcc5/lib . I
>>>>>>>> think the Makefile in hcc5/test already include the linking to the
>>>>>>>> library as the following can been seen from the command line when I
>>>>>>>> type "make hscreate".
>>>>>>>>
>>>>>>>> /bin/bash ../libtool --mode=link gcc -g -O2 -lhdl -o hsaddvals hsaddvals.o
>>>>>>>> gcc -g -O2 -o hsaddvals hsaddvals.o -lhdl
>>>>>>>>
>>>>>>>> And last item, i.e. -lhdl, does the linking. So I don't quite
>>>>>>>> understand why it is not working.
>>>>>>>>
>>>>>>>> Thanks very much.
>>>>>>>>
>>>>>>>> Regards,
>>>>>>>>
>>>>>>>> Peng
>>>>>>>>
>>>>>>>>
>>>>>>>> On 17 August 2012 15:37, Finston, Laurence <laurence.finston@gwdg.de> wrote:
>>>>>>>>> The client library itself, i.e., `libhdl', which is built by the targets in the top-level Makefile. The general idea is, if one wants to write an application that accesses a Handle Server, one writes a program in C or C++, includes the header files from the handle library (presumably in an include/ subdirectory) for the declarations (needed at compile-time), and links to the library using the -l and -L flags to the linker at link-time in order to access the definitions. At run-time, the run-time system needs to be able to find the library in order to execute the functions, therefore LD_LIBRARY_PATH must include the path to the library.
>>>>>>>>>
>>>>>>>>> I have now downloaded the package and see that it does indeed use Autoconf and Automake to generate the configure script and Makefiles.
>>>>>>>>>
>>>>>>>>> I assume that the programs in the test/ subdirectory link are meant to link to libhdl, a cursory look at the Makefile.am in that directory seems to confirm this, and it's what I would expect with most packages.
>>>>>>>>>
>>>>>>>>> So, when you build the programs in test/, you need to link to the hdl library, either with the appropriate flags passed to the linker, or via the corresponding environment variables. Regarding the default path to libraries, there's also the possibility of setting it using /etc/ld.so.conf or whatever your system uses. I just mention this for the sake of completeness; I wouldn't bother with this at the moment.
>>>>>>>>>
>>>>>>>>> Laurence
>>>>>>>>> ________________________________________
>>>>>>>>> From: Peng Du [eddy.pdu@gmail.com]
>>>>>>>>> Sent: Friday, August 17, 2012 4:10 PM
>>>>>>>>> To: Finston, Laurence
>>>>>>>>> Cc: handle-info@cnri.reston.va.us
>>>>>>>>> Subject: Re: [Handle-info] compile c client library
>>>>>>>>>
>>>>>>>>> Hi Laurence,
>>>>>>>>>
>>>>>>>>> Many thanks for the detailed answers and suggestions.
>>>>>>>>>
>>>>>>>>> However I do not quite follow why I need to link any library in the
>>>>>>>>> first place? And what library do I need to link? Since it is not
>>>>>>>>> mentioned in the source code.
>>>>>>>>>
>>>>>>>>> Regards,
>>>>>>>>>
>>>>>>>>> Peng
>>>>>>>>>
>>>>>>>>> On 17 August 2012 14:39, Finston, Laurence <laurence.finston@gwdg.de> wrote:
>>>>>>>>>> LD_LIBRARY_PATH is used at run-time, while LDFLAGS is used at link-time. In other words, LD_LIBRARY_PATH won't do you any good until you've successfully linked your program. You'll also need to set LIBS for linking, as below. If you set them before calling configure, rather than setting them as part of the call to configure, be sure they've been exported. Sorry if that's obvious, but I thought it best to mention it, just in case.
>>>>>>>>>>
>>>>>>>>>> If this still doesn't work, you could just try linking by hand. You should see the command that's used when you run `make' and you could just run it from the shell, adding the appropriate flags with their arguments. If the makefile was generated using Automake, `make -n <target>' will show you what would be run for <target> without actually running it.
>>>>>>>>>>
>>>>>>>>>> If this doesn't work, I could try installing the library myself next week. I won't be able to do it sooner. Probably someone else will be able to help you in the meantime, though.
>>>>>>>>>>
>>>>>>>>>> However, I think the C library may be somewhat out-of-date compared to the Java library. It might actually make more sense to use JNI to call the functions from the Java API from a C or C++ program rather than using the C API, but I don't know this for sure.
>>>>>>>>>>
>>>>>>>>>> Laurence
>>>>>>>>>>
>>>>>>>>>> ________________________________________
>>>>>>>>>> From: Peng Du [eddy.pdu@gmail.com]
>>>>>>>>>> Sent: Friday, August 17, 2012 3:23 PM
>>>>>>>>>> To: Finston, Laurence
>>>>>>>>>> Cc: handle-info@cnri.reston.va.us
>>>>>>>>>> Subject: Re: [Handle-info] compile c client library
>>>>>>>>>>
>>>>>>>>>> Dear Laurence,
>>>>>>>>>>
>>>>>>>>>> Thanks very much for your reply!
>>>>>>>>>>
>>>>>>>>>> I did try to set environment variables, as required by install.txt.
>>>>>>>>>> Specifically, I used "./configure --prefix=$PWD" and accordingly I set
>>>>>>>>>> LD_LIBRARY_PATH=$PWD/lib/perl/5.10/auto/hdllib/ . But the problem
>>>>>>>>>> still remains.
>>>>>>>>>>
>>>>>>>>>> Best wishes,
>>>>>>>>>>
>>>>>>>>>> Peng
>>>>>>>>>>
>>>>>>>>>> On 17 August 2012 14:06, Finston, Laurence <laurence.finston@gwdg.de> wrote:
>>>>>>>>>>> Hello,
>>>>>>>>>>>
>>>>>>>>>>>> I have installed (configure - make - make install) the c version
>>>>>>>>>>>> client libraries. But when I tried to make the programs in hcc5/test,
>>>>>>>>>>>> it keeps reporting "undefined reference to HDLCreate" or "undefined
>>>>>>>>>>>> reference to HDLDelete", depending on the specific program to build.
>>>>>>>>>>>
>>>>>>>>>>>> Would anyone kindly advise me on this? Thanks very much!
>>>>>>>>>>>
>>>>>>>>>>> This is just general information, since it's been a couple of years since I installed the C client library (with some help from one or more people on this mailing list). I was, however, encouraged to use the Java library instead at the time.
>>>>>>>>>>>
>>>>>>>>>>> You have to make sure that the library is found when linking. You can do this with the -l and -L flags.
>>>>>>>>>>> -l is for the name of the library, without the prepended `lib', e.g., `-lpcat' for the library `libpcap'.
>>>>>>>>>>> -L is for the search path for libraries. So, if you've installed a library in a non-standard location, you can add directories (separated by the `:' character) to the search path with this linker option.
>>>>>>>>>>>
>>>>>>>>>>> Alternatively, you could set the appropriate environment variables.
>>>>>>>>>>>
>>>>>>>>>>> If you type `configure --help', you may get something like this (if the configure script was generated by Autoconf):
>>>>>>>>>>>
>>>>>>>>>>> [...]
>>>>>>>>>>> Some influential environment variables:
>>>>>>>>>>> CXX C++ compiler command
>>>>>>>>>>> CXXFLAGS C++ compiler flags
>>>>>>>>>>> LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
>>>>>>>>>>> nonstandard directory <lib dir>
>>>>>>>>>>> LIBS libraries to pass to the linker, e.g. -l<library>
>>>>>>>>>>> CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
>>>>>>>>>>> you have headers in a nonstandard directory <include dir>
>>>>>>>>>>> CC C compiler command
>>>>>>>>>>> CFLAGS C compiler flags
>>>>>>>>>>> [...]
>>>>>>>>>>>
>>>>>>>>>>> On my (Linux) system, the default search path for libraries is set in `/etc/ld.so.conf'.
>>>>>>>>>>>
>>>>>>>>>>> I hope this helps.
>>>>>>>>>>>
>>>>>>>>>>> Laurence Finston
>>>>>>>>>>> ________________________________________
>>>>>>>>>>> From: handle-info-admin@cnri.reston.va.us [handle-info-admin@cnri.reston.va.us] on behalf of Peng Du [eddy.pdu@gmail.com]
>>>>>>>>>>> Sent: Friday, August 17, 2012 2:20 PM
>>>>>>>>>>> To: handle-info@cnri.reston.va.us
>>>>>>>>>>> Subject: [Handle-info] compile c client library
>>>>>>>>>>>
>>>>>>>>>>> Hello there,
>>>>>>>>>>>
>>>>>>>>>>> I have installed (configure - make - make install) the c version
>>>>>>>>>>> client libraries. But when I tried to make the programs in hcc5/test,
>>>>>>>>>>> it keeps reporting "undefined reference to HDLCreate" or "undefined
>>>>>>>>>>> reference to HDLDelete", depending on the specific program to build.
>>>>>>>>>>>
>>>>>>>>>>> Would anyone kindly advise me on this? Thanks very much!
>>>>>>>>>>>
>>>>>>>>>>> Best regards,
>>>>>>>>>>>
>>>>>>>>>>> Peng
>>>>>>>>>>>
>>>>>>>>>>> _______________________________________________
>>>>>>>>>>> Handle-Info mailing list
>>>>>>>>>>> Handle-Info@cnri.reston.va.us
>>>>>>>>>>> http://www.handle.net/mailman/listinfo/handle-info
_______________________________________________
Handle-Info mailing list
Handle-Info@cnri.reston.va.us
http://www.handle.net/mailman/listinfo/handle-info