LINUX.ORG.RU

не линкуется либа


0

0

собрал статическую либу:

[localhost libpixops]$ cat build
#!/bin/sh

gcc -g -c -O2 -Wall -DUSE_MMX composite_line_22_4a4_mmx.S
gcc -g -c -O2 -Wall -DUSE_MMX composite_line_color_22_4a4_mmx.S
gcc -g -c -O2 -Wall -DUSE_MMX have_mmx.S
gcc -g -c -O2 -Wall -DUSE_MMX pixops.c
gcc -g -c -O2 -Wall -DUSE_MMX scale_line_22_33_mmx.S

ar cru libpixops.a composite_line_22_4a4_mmx.o composite_line_color_22_4a4_mmx.o have_mmx.o pixops.o scale_line_22_33_mmx.o
ranlib libpixops.a

[localhost libpixops]$ nm libpixops.a

composite_line_22_4a4_mmx.o:
00000000 t gcc2_compiled.
00000090 t .loop
0000011e t .newx
0000018a t .out
00000000 T pixops_composite_line_22_4a4_mmx

composite_line_color_22_4a4_mmx.o:
00000000 t gcc2_compiled.
00000090 t .loop
0000012a t .newx
00000199 t .out
00000000 T pixops_composite_line_color_22_4a4_mmx

have_mmx.o:
00000000 t gcc2_compiled.
00000028 t .notfound
0000002d t .out
00000000 T pixops_have_mmx

pixops.o:
00002120 t bilinear_make_fast_weights
000026b0 t bilinear_make_weights
000025b0 t bilinear_quadrant
U calloc
00000970 t composite_line
00000bc0 t composite_line_22_4a4
00000d70 t composite_line_22_4a4_mmx_stub
00000ee0 t composite_line_color
00001100 t composite_line_color_22_4a4_mmx_stub
00000850 t composite_pixel
00000e30 t composite_pixel_color
00001d50 t correct_total
U free
00000000 t get_check_shift
00002d60 T pixops_composite
00002a90 T pixops_composite_color
00000500 t pixops_composite_color_nearest
U pixops_composite_line_22_4a4_mmx
U pixops_composite_line_color_22_4a4_mmx
00000240 t pixops_composite_nearest
U pixops_have_mmx
00001880 t pixops_process
00003020 T pixops_scale
U pixops_scale_line_22_33_mmx
00000030 t pixops_scale_nearest
00001750 t process_pixel
000012d0 t scale_line
000015f0 t scale_line_22_33
00001530 t scale_line_22_33_mmx_stub
00001240 t scale_pixel
00001dc0 t tile_make_weights

scale_line_22_33_mmx.o:
00000000 t gcc2_compiled.
00000060 t .loop
000000cb t .newx
0000010d t .out
00000000 T pixops_scale_line_22_33_mmx

---------------------------------------------

теперь пытаюсь прилинковать её к бинарнику:

[localhost libpixops]$ cat 1.c
#include <stdio.h>

#include "pixops.h"

int main()
{
pixops_scale(NULL, 0, 0, 1, 1, 1,
4, 1, NULL, 12, 12, 12, 4, 1,
1.2, 1.2,
PIXOPS_INTERP_NEAREST);

return 0;
}

[localhost libpixops]$ gcc -L. -lpixops -O2 -o 1 1.c
/tmp/ccp2I496.o(.text+0x36): In function `main':
: undefined reference to `pixops_scale'
collect2: ld returned 1 exit status
[localhost libpixops]$

Что не так ?
Спасибо.

anonymous

>gcc -L. -lpixops -O2 -o 1 1.c 

попробуй gcc -O2 -o 1 1.c -L. -lpixops

из man ld:

 -larchive
       --library=archive
           Add archive file archive to the list of files to link.  This option may be used any number  of
           times.  ld will search its path-list for occurrences of "libarchive.a" for every archive spec-
           ified.

           .....

           The linker will search an archive only once, at the location where it is specified on the com-
           mand line.  If the archive defines a symbol which was undefined in some object which  appeared
           before  the  archive on the command line, the linker will include the appropriate file(s) from
           the archive.  However, an undefined symbol in an object appearing later on  the  command  line
           will not cause the linker to search the archive again.

laad
()
Ответ на: комментарий от laad

отлично. спасибо. Либа нормально линкуется к Си программе.

Но возникла другая пробелма - не линкуется к QT проекту :(

в .pro файл добавил "LIBS += -L. -lpixops",

компилирую:

gcc -c -pipe -Wall -W -O2 -fomit-frame-pointer -pipe -march=i586 -mcpu=pentiumpro -DQT_NO_DEBUG -DQT_SHARED -DQT_THREAD_SUPPORT -I/usr/lib/qt3/mkspecs/default -I. -I. -I/usr/lib/qt3//include -o class1.o class1.cpp
gcc -o qpixbuf main.o class1.o -L/usr/lib/qt3//lib -L/usr/X11R6/lib -L. -lpixops -lqt-mt -lXext -lX11 -lm

class1.o(.text+0x267): In function `Class1::Class1[not-in-charge](QWidget*, char const*)':
: undefined reference to `pixops_scale(unsigned char*, int, int, int, int, int, int, int, unsigned char const*, int, int, int, int, int, double, double, PixopsInterpType)'
class1.o(.text+0x537): In function `Class1::Class1[in-charge](QWidget*, char const*)':
: undefined reference to `pixops_scale(unsigned char*, int, int, int, int, int, int, int, unsigned char const*, int, int, int, int, int, double, double, PixopsInterpType)'
collect2: ld returned 1 exit status
make: *** [qpixbuf] Ошибка 1


------------------------
Что теперь не так ?
Спасибо.

anonymous
()
Вы не можете добавлять комментарии в эту тему. Тема перемещена в архив.