LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Using gcc (https://www.linuxquestions.org/questions/linux-software-2/using-gcc-711570/)

J_Szucs 03-14-2009 08:08 AM

Using gcc
 
I tried to compile this small c program: http://durendal.org:8080/twiki/pub/D...bHome/deskew.c with gcc:

gcc -I/usr/include/liblept/ -I/usr/include/ deskew.c -o deskew

but I got errors:
Code:

deskew.c:(.text+0x26): undefined reference to `returnErrorPtr'
deskew.c:(.text+0x39): undefined reference to `pixGetDepth'
deskew.c:(.text+0x49): undefined reference to `pixGetDepth'
deskew.c:(.text+0x74): undefined reference to `pixConvertRGBToGray'
deskew.c:(.text+0x92): undefined reference to `pixThresholdToBinary'
deskew.c:(.text+0xa8): undefined reference to `pixDestroy'
deskew.c:(.text+0xde): undefined reference to `returnErrorPtr'
deskew.c:(.text+0x135): undefined reference to `pixFindSkewSweepAndSearch'
deskew.c:(.text+0x144): undefined reference to `pixClone'
deskew.c:(.text+0x1a2): undefined reference to `pixClone'
deskew.c:(.text+0x1b5): undefined reference to `pixGetDepth'
deskew.c:(.text+0x1e7): undefined reference to `pixRotateShear'
deskew.c:(.text+0x1fb): undefined reference to `pixClone'
deskew.c:(.text+0x21d): undefined reference to `pixRotateAM'
deskew.c:(.text+0x231): undefined reference to `pixClone'
deskew.c:(.text+0x247): undefined reference to `pixDestroy'
/tmp/cckHI9gm.o: In function `main':
deskew.c:(.text+0x28f): undefined reference to `returnErrorInt'
deskew.c:(.text+0x2c6): undefined reference to `pixRead'
deskew.c:(.text+0x2ec): undefined reference to `returnErrorInt'
deskew.c:(.text+0x324): undefined reference to `pixWrite'
deskew.c:(.text+0x32f): undefined reference to `pixDestroy'
deskew.c:(.text+0x33a): undefined reference to `pixDestroy'
collect2: ld returned 1 exit status

The Leptonica include files are in /usr/include/liblept:
Code:

kwaigon:/data_r/tesseract.training # grep -R -E "returnErrorPtr" /usr/include/liblept/*
/usr/include/liblept/environ.h:#define ERROR_PTR(a,b,c)            returnErrorPtr((a),(b),(c))
/usr/include/liblept/leptprotos.h:extern void * returnErrorPtr ( const char *msg, const char *procname, void *pval );

I am totally ignorant as regards gcc. What am I doing wrong?

johnsfine 03-14-2009 08:45 AM

You are getting a link time error, not a compile time error.

The .h file provides the information needed at compile time. There is then some .a or .so file that provides corresponding information at link time. I didn't look at any specifics of your project to see which .a or .so might be needed.

By default gcc does both the compile and link from one command. In complicated projects there may be good reason to do the compile in one command (using the -c option to tell gcc to just compile and not link) and do the link in a later command. But I doubt your project is that complicated.

If you are using just one gcc command, I think you can simply list whatever extra .a or .so file(s) are needed on the same command line where you specify the .c file. (I always use separate link commands myself, so I'm not 100% sure of this).

I've never tried installing Leptonica, but since you said the .h file was in /usr/include/liblept/ there is a good chance the .a or .so file(s) are in /usr/lib/ with names starting with liblept so try
ls /usr/lib/liblept*
or maybe
ls /usr/lib/lept*

J_Szucs 03-14-2009 09:35 AM

It is probably liblept.a:
Code:

kwaigon:/data_r/tesseract.training # find /usr/lib -name "*lept*"
/usr/lib/liblept.a

But I still get errors:
Code:

kwaigon:/data_r/tesseract.training # gcc -I/usr/include/liblept -I/usr/include -L/usr/lib -l lept deskew.c -o deskew
/tmp/ccuED3YZ.o: In function `main':
deskew.c:(.text+0x25b): multiple definition of `main'
/usr/lib/liblept.a(endiantest.o):endiantest.c:(.text+0x0): first defined here
/usr/lib/gcc/i586-suse-linux/4.1.0/../../../../i586-suse-linux/bin/ld: Warning: size of symbol `main' changed from 96 in /usr/lib/liblept.a(endiantest.o) to 239 in /tmp/ccuED3YZ.o
/tmp/ccuED3YZ.o: In function `deskew':
deskew.c:(.text+0x26): undefined reference to `returnErrorPtr'
deskew.c:(.text+0x39): undefined reference to `pixGetDepth'
deskew.c:(.text+0x49): undefined reference to `pixGetDepth'
deskew.c:(.text+0x74): undefined reference to `pixConvertRGBToGray'
deskew.c:(.text+0x92): undefined reference to `pixThresholdToBinary'
deskew.c:(.text+0xa8): undefined reference to `pixDestroy'
deskew.c:(.text+0xde): undefined reference to `returnErrorPtr'
deskew.c:(.text+0x135): undefined reference to `pixFindSkewSweepAndSearch'
deskew.c:(.text+0x144): undefined reference to `pixClone'
deskew.c:(.text+0x1a2): undefined reference to `pixClone'
deskew.c:(.text+0x1b5): undefined reference to `pixGetDepth'
deskew.c:(.text+0x1e7): undefined reference to `pixRotateShear'
deskew.c:(.text+0x1fb): undefined reference to `pixClone'
deskew.c:(.text+0x21d): undefined reference to `pixRotateAM'
deskew.c:(.text+0x231): undefined reference to `pixClone'
deskew.c:(.text+0x247): undefined reference to `pixDestroy'
/tmp/ccuED3YZ.o: In function `main':
deskew.c:(.text+0x28f): undefined reference to `returnErrorInt'
deskew.c:(.text+0x2c6): undefined reference to `pixRead'
deskew.c:(.text+0x2ec): undefined reference to `returnErrorInt'
deskew.c:(.text+0x324): undefined reference to `pixWrite'
deskew.c:(.text+0x32f): undefined reference to `pixDestroy'
deskew.c:(.text+0x33a): undefined reference to `pixDestroy'
collect2: ld returned 1 exit status


johnsfine 03-14-2009 09:45 AM

The sequence on the command line apparently matters.

The error message says the linker processed the .a file before it processed the .o file (that resulted from your .c file).

That .o file has to be processed by the linker before the .a file.

Maybe you need the .c file to be earlier on the command line (before the library stuff) to get gcc to tell the linker to put the .o before the .a

J_Szucs 03-14-2009 10:02 AM

If I put deskew.c before the library staff, then I just get three times as many similar errors :(

johnsfine 03-14-2009 10:17 AM

What are the first few of those new errors?

I am quite sure the linker needs to process the .o before the .a and pretty sure the errors you showed in post #3 of this thread are the result of processing the .a before the .o (just as the errors in post #1 are from not processing the .a at all).

The errors you get with the correct sequence may look "similar" to you, but might mean that you solved the original problem and revealed an addition problem (that can be solved by adding another .a or .so file to the command line).

J_Szucs 03-14-2009 10:22 AM

Code:

kwaigon:/data_r/tesseract.training # gcc deskew.c -I/usr/include/liblept -I/usr/include -L/usr/lib -l lept -o deskew
/usr/lib/liblept.a(grayquant.o): In function `makeGrayQuantColormapArb':
grayquant.c:(.text+0x7d3): undefined reference to `sqrt'
/usr/lib/liblept.a(kernel.o): In function `makeDoGKernel':
kernel.c:(.text+0xe70): undefined reference to `expf'
kernel.c:(.text+0xe83): undefined reference to `expf'
/usr/lib/liblept.a(kernel.o): In function `makeGaussianKernel':
kernel.c:(.text+0xfc2): undefined reference to `expf'
/usr/lib/liblept.a(pix4.o): In function `pixGetAverageTiled':
pix4.c:(.text+0x2625): undefined reference to `sqrt'
/usr/lib/liblept.a(pix4.o): In function `pixGetAverageMasked':
pix4.c:(.text+0x2daf): undefined reference to `sqrt'
/usr/lib/liblept.a(pixconv.o): In function `pixConvertGrayToFalseColor':
pixconv.c:(.text+0x5192): undefined reference to `powf'
/usr/lib/liblept.a(pngio.o): In function `pixWriteStreamPng':
pngio.c:(.text+0x4f): undefined reference to `png_create_write_struct'
pngio.c:(.text+0x62): undefined reference to `png_create_info_struct'
pngio.c:(.text+0x8e): undefined reference to `png_destroy_write_struct'
pngio.c:(.text+0xcb): undefined reference to `png_init_io'
pngio.c:(.text+0x166): undefined reference to `png_destroy_write_struct'
pngio.c:(.text+0x1eb): undefined reference to `png_set_IHDR'
pngio.c:(.text+0x2a7): undefined reference to `png_set_pHYs'
pngio.c:(.text+0x2dd): undefined reference to `png_set_gAMA'
pngio.c:(.text+0x32d): undefined reference to `png_set_text'
pngio.c:(.text+0x33f): undefined reference to `png_write_info'
pngio.c:(.text+0x3ff): undefined reference to `png_set_rows'
pngio.c:(.text+0x40e): undefined reference to `png_write_image'
pngio.c:(.text+0x420): undefined reference to `png_write_end'
pngio.c:(.text+0x453): undefined reference to `png_destroy_write_struct'
pngio.c:(.text+0x534): undefined reference to `png_write_rows'
pngio.c:(.text+0x54e): undefined reference to `png_write_end'
pngio.c:(.text+0x65a): undefined reference to `png_set_PLTE'
pngio.c:(.text+0x75b): undefined reference to `png_write_rows'
pngio.c:(.text+0x7a6): undefined reference to `png_destroy_write_struct'
/usr/lib/liblept.a(pngio.o): In function `pixReadStreamPng':
pngio.c:(.text+0xee4): undefined reference to `png_create_read_struct'
pngio.c:(.text+0xef7): undefined reference to `png_create_info_struct'
pngio.c:(.text+0xf0d): undefined reference to `png_create_info_struct'
pngio.c:(.text+0xf40): undefined reference to `png_destroy_read_struct'
pngio.c:(.text+0xf83): undefined reference to `png_init_io'
pngio.c:(.text+0xfa5): undefined reference to `png_read_png'
pngio.c:(.text+0xfb7): undefined reference to `png_get_rows'
pngio.c:(.text+0xfcc): undefined reference to `png_get_image_width'
pngio.c:(.text+0xfe1): undefined reference to `png_get_image_height'
pngio.c:(.text+0xff6): undefined reference to `png_get_bit_depth'
pngio.c:(.text+0x100a): undefined reference to `png_get_rowbytes'
pngio.c:(.text+0x101f): undefined reference to `png_get_color_type'
pngio.c:(.text+0x1033): undefined reference to `png_get_channels'
pngio.c:(.text+0x1171): undefined reference to `png_get_x_pixels_per_meter'
pngio.c:(.text+0x1185): undefined reference to `png_get_y_pixels_per_meter'
pngio.c:(.text+0x1227): undefined reference to `png_get_text'
pngio.c:(.text+0x1260): undefined reference to `png_destroy_read_struct'
pngio.c:(.text+0x1288): undefined reference to `png_destroy_read_struct'
pngio.c:(.text+0x1343): undefined reference to `png_destroy_read_struct'
pngio.c:(.text+0x1394): undefined reference to `png_get_PLTE'
pngio.c:(.text+0x14f9): undefined reference to `png_destroy_read_struct'
/usr/lib/liblept.a(rotateamlow.o): In function `rotateAMGrayCornerLow':
rotateamlow.c:(.text+0x34): undefined reference to `sin'
rotateamlow.c:(.text+0x4f): undefined reference to `cos'
/usr/lib/liblept.a(rotateamlow.o): In function `rotateAMGrayLow':
rotateamlow.c:(.text+0x280): undefined reference to `sin'
rotateamlow.c:(.text+0x29b): undefined reference to `cos'
/usr/lib/liblept.a(rotateamlow.o): In function `rotateAMColorFastLow':
rotateamlow.c:(.text+0x4f8): undefined reference to `sin'
rotateamlow.c:(.text+0x519): undefined reference to `cos'
/usr/lib/liblept.a(rotateamlow.o): In function `rotateAMColorCornerLow':
rotateamlow.c:(.text+0x11c0): undefined reference to `sin'
rotateamlow.c:(.text+0x11db): undefined reference to `cos'
/usr/lib/liblept.a(rotateamlow.o): In function `rotateAMColorLow':
rotateamlow.c:(.text+0x144c): undefined reference to `sin'
rotateamlow.c:(.text+0x146a): undefined reference to `cos'
/usr/lib/liblept.a(rotateshear.o): In function `pixRotateEuclidean':
rotateshear.c:(.text+0x10e): undefined reference to `sinf'
rotateshear.c:(.text+0x11c): undefined reference to `cosf'
/usr/lib/liblept.a(rotateshear.o): In function `pixRotateShearIP':
rotateshear.c:(.text+0x382): undefined reference to `sin'
rotateshear.c:(.text+0x38a): undefined reference to `atan'
/usr/lib/liblept.a(rotateshear.o): In function `pixRotate3Shear':
rotateshear.c:(.text+0x55d): undefined reference to `sin'
rotateshear.c:(.text+0x565): undefined reference to `atan'
/usr/lib/liblept.a(shear.o): In function `pixVShearIP':
shear.c:(.text+0x74): undefined reference to `tan'
shear.c:(.text+0xc6): undefined reference to `tanf'
/usr/lib/liblept.a(shear.o): In function `pixHShearIP':
shear.c:(.text+0x314): undefined reference to `tan'
shear.c:(.text+0x366): undefined reference to `tanf'
/usr/lib/liblept.a(shear.o): In function `pixVShear':
shear.c:(.text+0x5d7): undefined reference to `tan'
shear.c:(.text+0x6e5): undefined reference to `tanf'
/usr/lib/liblept.a(shear.o): In function `pixHShear':
shear.c:(.text+0xab7): undefined reference to `tan'
shear.c:(.text+0xbc5): undefined reference to `tanf'
/usr/lib/liblept.a(tiffio.o): In function `fopenTiffMemstream':
tiffio.c:(.text+0x1a9): undefined reference to `TIFFClientOpen'
/usr/lib/liblept.a(tiffio.o): In function `pixWriteToTiffStream':
tiffio.c:(.text+0x4d8): undefined reference to `TIFFSetField'
tiffio.c:(.text+0x4f8): undefined reference to `TIFFSetField'
tiffio.c:(.text+0x518): undefined reference to `TIFFSetField'
tiffio.c:(.text+0x535): undefined reference to `TIFFSetField'
tiffio.c:(.text+0x552): undefined reference to `TIFFSetField'
/usr/lib/liblept.a(tiffio.o):tiffio.c:(.text+0x570): more undefined references to `TIFFSetField' follow
/usr/lib/liblept.a(tiffio.o): In function `pixWriteToTiffStream':
tiffio.c:(.text+0x9a7): undefined reference to `TIFFScanlineSize'
tiffio.c:(.text+0xa11): undefined reference to `TIFFSetField'
tiffio.c:(.text+0xaaa): undefined reference to `TIFFWriteScanline'
tiffio.c:(.text+0xbfc): undefined reference to `TIFFWriteScanline'
tiffio.c:(.text+0xced): undefined reference to `TIFFWriteScanline'
tiffio.c:(.text+0xd30): undefined reference to `TIFFSetField'
tiffio.c:(.text+0xd53): undefined reference to `TIFFSetField'
tiffio.c:(.text+0xd76): undefined reference to `TIFFSetField'
tiffio.c:(.text+0xdd4): undefined reference to `TIFFSetField'
tiffio.c:(.text+0xdf7): undefined reference to `TIFFSetField'
/usr/lib/liblept.a(tiffio.o):tiffio.c:(.text+0xe1a): more undefined references to `TIFFSetField' follow
/usr/lib/liblept.a(tiffio.o): In function `pixWriteMemTiffCustom':
tiffio.c:(.text+0x14fa): undefined reference to `TIFFClose'
/usr/lib/liblept.a(tiffio.o): In function `tiffGetResolution':
tiffio.c:(.text+0x1675): undefined reference to `TIFFGetFieldDefaulted'
tiffio.c:(.text+0x168c): undefined reference to `TIFFGetField'
tiffio.c:(.text+0x16a5): undefined reference to `TIFFGetField'
/usr/lib/liblept.a(tiffio.o): In function `tiffReadHeaderTiff':
tiffio.c:(.text+0x1806): undefined reference to `TIFFGetField'
tiffio.c:(.text+0x1822): undefined reference to `TIFFGetField'
tiffio.c:(.text+0x1841): undefined reference to `TIFFGetFieldDefaulted'
tiffio.c:(.text+0x1861): undefined reference to `TIFFGetFieldDefaulted'
tiffio.c:(.text+0x18c0): undefined reference to `TIFFGetField'
/usr/lib/liblept.a(tiffio.o): In function `readHeaderMemTiff':
tiffio.c:(.text+0x1a01): undefined reference to `TIFFReadDirectory'
tiffio.c:(.text+0x1a0d): undefined reference to `TIFFClose'
tiffio.c:(.text+0x1a9a): undefined reference to `TIFFClose'
/usr/lib/liblept.a(tiffio.o): In function `pixReadFromTiffStream':
tiffio.c:(.text+0x1b35): undefined reference to `TIFFGetFieldDefaulted'
tiffio.c:(.text+0x1b4f): undefined reference to `TIFFGetFieldDefaulted'
tiffio.c:(.text+0x1bc1): undefined reference to `TIFFGetField'
tiffio.c:(.text+0x1bdb): undefined reference to `TIFFGetField'
tiffio.c:(.text+0x1be6): undefined reference to `TIFFScanlineSize'
tiffio.c:(.text+0x1c9a): undefined reference to `TIFFReadScanline'
tiffio.c:(.text+0x1d77): undefined reference to `TIFFReadScanline'
tiffio.c:(.text+0x1e35): undefined reference to `TIFFGetField'
tiffio.c:(.text+0x1ed0): undefined reference to `TIFFGetField'
tiffio.c:(.text+0x1f7f): undefined reference to `TIFFGetField'
/usr/lib/liblept.a(tiffio.o): In function `pixReadMemTiff':
tiffio.c:(.text+0x20f6): undefined reference to `TIFFReadDirectory'
tiffio.c:(.text+0x2123): undefined reference to `TIFFClose'
tiffio.c:(.text+0x21a4): undefined reference to `TIFFClose'
/usr/lib/liblept.a(tiffio.o): In function `extractTiffG4DataFromFile':
tiffio.c:(.text+0x2281): undefined reference to `TIFFOpen'
tiffio.c:(.text+0x22a2): undefined reference to `TIFFGetField'
tiffio.c:(.text+0x22bd): undefined reference to `TIFFClose'
tiffio.c:(.text+0x23c2): undefined reference to `TIFFGetField'
tiffio.c:(.text+0x23d9): undefined reference to `TIFFGetField'
tiffio.c:(.text+0x23f0): undefined reference to `TIFFGetField'
tiffio.c:(.text+0x2427): undefined reference to `TIFFGetField'
tiffio.c:(.text+0x242f): undefined reference to `TIFFClose'
/usr/lib/liblept.a(tiffio.o): In function `pixWriteTiffCustom':
tiffio.c:(.text+0x25a7): undefined reference to `TIFFOpen'
tiffio.c:(.text+0x25de): undefined reference to `TIFFClose'
/usr/lib/liblept.a(tiffio.o): In function `fopenTiff':
tiffio.c:(.text+0x2720): undefined reference to `TIFFFdOpen'
/usr/lib/liblept.a(tiffio.o): In function `findTiffCompression':
tiffio.c:(.text+0x27fe): undefined reference to `TIFFGetFieldDefaulted'
tiffio.c:(.text+0x2854): undefined reference to `TIFFCleanup'
/usr/lib/liblept.a(tiffio.o): In function `tiffGetCount':
tiffio.c:(.text+0x2945): undefined reference to `TIFFReadDirectory'
tiffio.c:(.text+0x2961): undefined reference to `TIFFCleanup'
/usr/lib/liblept.a(tiffio.o): In function `pixWriteStreamTiff':
tiffio.c:(.text+0x2a9c): undefined reference to `TIFFCleanup'
tiffio.c:(.text+0x2ad4): undefined reference to `TIFFCleanup'
/usr/lib/liblept.a(tiffio.o): In function `pixReadStreamTiff':
tiffio.c:(.text+0x2ba6): undefined reference to `TIFFReadDirectory'
tiffio.c:(.text+0x2bd3): undefined reference to `TIFFCleanup'
tiffio.c:(.text+0x2c02): undefined reference to `TIFFCleanup'
tiffio.c:(.text+0x2c67): undefined reference to `TIFFCleanup'
/usr/lib/liblept.a(tiffio.o): In function `freadHeaderTiff':
tiffio.c:(.text+0x2df1): undefined reference to `TIFFReadDirectory'
tiffio.c:(.text+0x2e53): undefined reference to `TIFFCleanup'
/usr/lib/liblept.a(tiffio.o): In function `fprintTiffInfo':
tiffio.c:(.text+0x317a): undefined reference to `TIFFOpen'
tiffio.c:(.text+0x3194): undefined reference to `TIFFPrintDirectory'
tiffio.c:(.text+0x319c): undefined reference to `TIFFClose'
/usr/lib/liblept.a(boxfunc2.o): In function `boxTransformOrdered':
boxfunc2.c:(.text+0x1af4): undefined reference to `sinf'
boxfunc2.c:(.text+0x1b02): undefined reference to `cosf'
/usr/lib/liblept.a(enhance.o): In function `numaContrastTRC':
enhance.c:(.text+0x1800): undefined reference to `atan'
enhance.c:(.text+0x181c): undefined reference to `atan'
enhance.c:(.text+0x1851): undefined reference to `atan'
/usr/lib/liblept.a(enhance.o): In function `numaGammaTRC':
enhance.c:(.text+0x1d0d): undefined reference to `powf'
/usr/lib/liblept.a(jpegio.o): In function `pixWriteStreamJpeg':
jpegio.c:(.text+0x643): undefined reference to `jpeg_std_error'
jpegio.c:(.text+0x66d): undefined reference to `jpeg_CreateCompress'
jpegio.c:(.text+0x67c): undefined reference to `jpeg_stdio_dest'
jpegio.c:(.text+0x6b6): undefined reference to `jpeg_set_defaults'
jpegio.c:(.text+0x712): undefined reference to `jpeg_set_quality'
jpegio.c:(.text+0x72d): undefined reference to `jpeg_start_compress'
jpegio.c:(.text+0x75e): undefined reference to `jpeg_write_marker'
jpegio.c:(.text+0x854): undefined reference to `jpeg_finish_compress'
jpegio.c:(.text+0x874): undefined reference to `jpeg_destroy_compress'
jpegio.c:(.text+0x982): undefined reference to `jpeg_write_scanlines'
jpegio.c:(.text+0x9fd): undefined reference to `jpeg_write_scanlines'
jpegio.c:(.text+0xa5a): undefined reference to `jpeg_simple_progression'
jpegio.c:(.text+0xaf6): undefined reference to `jpeg_std_error'
jpegio.c:(.text+0xb20): undefined reference to `jpeg_CreateCompress'
jpegio.c:(.text+0xb2f): undefined reference to `jpeg_stdio_dest'
/usr/lib/liblept.a(jpegio.o): In function `jpeg_error_do_not_exit':
jpegio.c:(.text+0xdd6): undefined reference to `jpeg_destroy'
/usr/lib/liblept.a(jpegio.o): In function `pixReadStreamJpeg':
jpegio.c:(.text+0xefc): undefined reference to `jpeg_std_error'
jpegio.c:(.text+0xf26): undefined reference to `jpeg_CreateDecompress'
jpegio.c:(.text+0xf49): undefined reference to `jpeg_set_marker_processor'
jpegio.c:(.text+0xf58): undefined reference to `jpeg_stdio_src'
jpegio.c:(.text+0xf68): undefined reference to `jpeg_read_header'
jpegio.c:(.text+0xf86): undefined reference to `jpeg_calc_output_dimensions'
jpegio.c:(.text+0x1135): undefined reference to `jpeg_start_decompress'
jpegio.c:(.text+0x11a0): undefined reference to `jpeg_read_scanlines'
jpegio.c:(.text+0x1221): undefined reference to `jpeg_finish_decompress'
jpegio.c:(.text+0x1229): undefined reference to `jpeg_destroy_decompress'
jpegio.c:(.text+0x12bb): undefined reference to `jpeg_read_scanlines'
jpegio.c:(.text+0x15bc): undefined reference to `jpeg_start_decompress'
/usr/lib/liblept.a(morph.o): In function `selectComposableSizes':
morph.c:(.text+0x178): undefined reference to `sqrt'
/usr/lib/liblept.a(pixarith.o): In function `makeLogBase2Tab':
pixarith.c:(.text+0xe8): undefined reference to `logf'
pixarith.c:(.text+0xfb): undefined reference to `logf'
/usr/lib/liblept.a(pixafunc.o): In function `pixaDisplayOnLattice':
pixafunc.c:(.text+0x19df): undefined reference to `sqrt'
collect2: ld returned 1 exit status


johnsfine 03-14-2009 10:34 AM

As I expected, that shows you need more libraries and they need to be after liblept on the command line.

Did you find any examples on the Leptonica site with makefiles or other build instructions showing which libraries you need.

I think I recall some of the references in your list are from libm. I'm not sure how you specify libm on a gcc line. I looked in /lib on my own system and found a soft link from libm.so.6 to the current version of libm. But I don't know if that gets found with just -l m or whether you need to specify the .6 somewhere.

The rest of those undefined symbols might need some google searches to identify the right .a or .so files if you can't find that in the Leptonica documentation or examples.

On my own system there are several different libpng*.so.? links in /usr/lib to several different files that define the png_ symbols in your list. I wouldn't know which is correct nor whether it matters.

I did a google for "fopenTiffMemstream" from your error message list and found only a reference to "leptonlib". Is that something you installed or need to install? And is it a .a or .so file somewhere in your /usr/lib/? Maybe you should look for *lepton*


I was surprised you put the .c file before the -I options, and surprised that didn't cause a problem. I thought the .c had to be after the -I's. (But before you posted your errors, I didn't know the .c had to be before the -l).

J_Szucs 03-14-2009 10:55 AM

Thank you, it works now!:

gcc deskew.c -I/usr/include/liblept -I/usr/include -L/usr/lib -l lept -l png -l jpeg -l tiff -o deskew

Libpng, libtiff and jpeglib were missing.

alan_ri 03-14-2009 11:18 AM

Readme.


All times are GMT -5. The time now is 06:18 AM.