Subj : Re: tcc - how do I specify the library paths ? To : alt.comp.linux,alt.comp.os.linux,comp.os.linux From : moma Date : Sun Oct 31 2004 04:03 pm Hello Mark, (1) You have already DL and installed "argtable". (2) Download also the source package w/ samples $ wget http://prdownloads.sourceforge.net/argtable/argtable-2.3.tar.gz; tar -xvzf $(basename http://prdownloads.sourceforge.net/argtable/argtable-2.3.tar.gz) $ cd argt*/exam* $ pwd /home/moma/tmp/argtable2/example There are a working "Makefile" that shows how to compile the samples. ------------ $ ls echo.c ls.c Makefile Makefile.in Makefile.nmake mv.c myprog.c myprog_C89.c README.txt rm.c uname.c ---------------- Type 'make' to compile the samples $ make gcc -I/usr/local/include -g -Wall -L/usr/local/lib uname.c -largtable2 -o uname gcc -I/usr/local/include -g -Wall -L/usr/local/lib rm.c -largtable2 -o rm gcc -I/usr/local/include -g -Wall -L/usr/local/lib mv.c -largtable2 -o mv gcc -I/usr/local/include -g -Wall -L/usr/local/lib echo.c -largtable2 -o echo gcc -I/usr/local/include -g -Wall -L/usr/local/lib ls.c -largtable2 -o ls gcc -I/usr/local/include -g -Wall -L/usr/local/lib myprog.c -largtable2 -o myprog gcc -I/usr/local/include -g -Wall -L/usr/local/lib myprog_C89.c -largtable2 -o myprog_C89 ---------------- Study how the -L and -l options are used. ---------------- 3) Possible errors after compilation. Run ./mv $ ./mv "./mv: error while loading shared libraries: libargtable2.so: cannot open shared object file: No such file or directory" --- The system does not know where to load "libargtable2.so". So we need to help. Do as 'root' user. # cat /etc/ld.so.conf And add "/usr/local/lib" into library list if it's missing. # echo "/usr/local/lib" >> /etc/ld.so.conf Update library cache # ldconfig ---------------- 4) Rerun ./mv ../mv --help Usage: mv [-bfiuv] [--backup=[CONTROL]] [--reply={yes,no,query}] [--strip-trailing-slashes] [-S SUFFIX] [--target-directory=DIRECTORY] [--help] [--version] SOURCE [SOURCE]... DEST|DIRECTORY Rename SOURCE to DEST, or move SOURCE(s) to DIRECTORY. .... ok. //moma (( http://www.futuredesktop.org/OpenOffice.html http://www.futuredesktop.org/how2burn.html http://home.online.no/~osmoma/g++stl.html.html :: Some C++ samples )) Mark Hobley wrote: > I am using Debian, and I have installed the package "argtable" from source. > I have the following files on my system: > > /usr/local/lib/libargtable2.a > /usr/local/lib/libargtable2.so > /usr/local/lib/libargtable2.so.3 > > I have downloaded the example file mv.c, from the argtable website at: > http://argtable.sourceforge.net/ > > On compilation, I get errors as follows: > > $ cc mv.c > tcc: undefined symbol 'arg_str0' > tcc: undefined symbol 'arg_lit0' > tcc: undefined symbol 'arg_rem' > tcc: undefined symbol 'arg_filen' > tcc: undefined symbol 'arg_end' > tcc: undefined symbol 'arg_nullcheck' > tcc: undefined symbol 'arg_parse' > tcc: undefined symbol 'arg_print_syntax' > tcc: undefined symbol 'arg_print_glossary' > tcc: undefined symbol 'arg_print_errors' > tcc: undefined symbol 'arg_freetable' > > I can produce an object file, as follows: > > $ cc -c mv.c > > This works ok and produces mv.o. (I don't know how to link this) > > $ gcc mv.c > > This errors as follows (some output has been lost off the top of the screen): > /tmp/ccSgX617.o(.text+0x393): In function `main': > : undefined reference to `arg_lit0' > /tmp/ccSgX617.o(.text+0x3b2): In function `main': > : undefined reference to `arg_lit0' > /tmp/ccSgX617.o(.text+0x3eb): In function `main': > : undefined reference to `arg_filen' > /tmp/ccSgX617.o(.text+0x402): In function `main': > : undefined reference to `arg_rem' > /tmp/ccSgX617.o(.text+0x411): In function `main': > : undefined reference to `arg_end' > /tmp/ccSgX617.o(.text+0x4ce): In function `main': > : undefined reference to `arg_nullcheck' > /tmp/ccSgX617.o(.text+0x540): In function `main': > : undefined reference to `arg_parse' > /tmp/ccSgX617.o(.text+0x581): In function `main': > : undefined reference to `arg_print_syntax' > /tmp/ccSgX617.o(.text+0x5ac): In function `main': > : undefined reference to `arg_print_glossary' > /tmp/ccSgX617.o(.text+0x622): In function `main': > : undefined reference to `arg_print_errors' > /tmp/ccSgX617.o(.text+0x6e4): In function `main': > : undefined reference to `arg_freetable' > collect2: ld returned 1 exit status > > I think maybe some environment variables need setting, or a config file needs > changing for the libraries to be located. > > Thanks in advance to anyone who can help. > > Regards, > > Mark. > .