我正在尝试在64位ubuntu上构建32位库(tsnnls 1.0 distribution)。我选择这个旧版本,因为我稍后会尝试在mex上编译,为此我需要更改编译器选项和标签等。最近的版本使用autotool,我不知道如何更改那里。
这是makefile:
all: libtsnnls test
CC=gcc
CFLAGS=-O3
TAUCS_OBJS=tsnnls/taucs_basic/taucs_logging.o \
tsnnls/taucs_basic/taucs_malloc.o \
tsnnls/taucs_basic/taucs_ccs_order.o \
tsnnls/taucs_basic/taucs_ccs_ops.o \
tsnnls/taucs_basic/taucs_vec_base.o \
tsnnls/taucs_basic/taucs_complex.o \
tsnnls/taucs_basic/colamd.o \
tsnnls/taucs_basic/amdbar.o \
tsnnls/taucs_basic/amdexa.o \
tsnnls/taucs_basic/amdtru.o \
tsnnls/taucs_basic/genmmd.o \
tsnnls/taucs_basic/taucs_timer.o \
tsnnls/taucs_basic/taucs_sn_llt.o \
tsnnls/taucs_basic/taucs_ccs_base.o
TSNNLS_OBJS=tsnnls/tlsqr.o \
tsnnls/tsnnls.o \
tsnnls/lsqr.o
OBJS=$(TAUCS_OBJS) $(TSNNLS_OBJS)
ifeq ($(shell uname),Darwin)
LDFLAGS=-framework vecLib
else
LDFLAGS= -Lexternal_libraries -llapacklinux -lblaslinux -lf77blas -lcblas -latlas -lg2c -lm
endif
clean:
(cd tsnnls ; make clean)
rm -f tsnnls_test libtsnnls.a
tsnnls: $(OBJS)
(cd tsnnls ; make all "CFLAGS=$(CFLAGS)" )
libtsnnls: tsnnls
ar cru libtsnnls.a $(OBJS)
ranlib libtsnnls.a
test: $(OBJS)
$(CC) $(CFLAGS) tsnnls_test.c -o tsnnls_test -L. -ltsnnls $(LDFLAGS)
./tsnnls_test test_files/full_example_200 0 0
./tsnnls_test test_files/sparse_tests 0 1
我收到以下报告错误:
dkumar@kumar-Aspire-E1-510 ~/Desktop/tsnnls_dist $ make
gcc -O3 -c -o tsnnls/taucs_basic/taucs_logging.o tsnnls/taucs_basic/taucs_logging.c
gcc -O3 -c -o tsnnls/taucs_basic/taucs_malloc.o tsnnls/taucs_basic/taucs_malloc.c
gcc -O3 -c -o tsnnls/taucs_basic/taucs_ccs_order.o tsnnls/taucs_basic/taucs_ccs_order.c
gcc -O3 -c -o tsnnls/taucs_basic/taucs_ccs_ops.o tsnnls/taucs_basic/taucs_ccs_ops.c
gcc -O3 -c -o tsnnls/taucs_basic/taucs_vec_base.o tsnnls/taucs_basic/taucs_vec_base.c
gcc -O3 -c -o tsnnls/taucs_basic/taucs_complex.o tsnnls/taucs_basic/taucs_complex.c
gcc -O3 -c -o tsnnls/taucs_basic/colamd.o tsnnls/taucs_basic/colamd.c
gcc -O3 -c -o tsnnls/taucs_basic/amdbar.o tsnnls/taucs_basic/amdbar.c
gcc -O3 -c -o tsnnls/taucs_basic/amdexa.o tsnnls/taucs_basic/amdexa.c
gcc -O3 -c -o tsnnls/taucs_basic/amdtru.o tsnnls/taucs_basic/amdtru.c
gcc -O3 -c -o tsnnls/taucs_basic/genmmd.o tsnnls/taucs_basic/genmmd.c
gcc -O3 -c -o tsnnls/taucs_basic/taucs_timer.o tsnnls/taucs_basic/taucs_timer.c
gcc -O3 -c -o tsnnls/taucs_basic/taucs_sn_llt.o tsnnls/taucs_basic/taucs_sn_llt.c
gcc -O3 -c -o tsnnls/taucs_basic/taucs_ccs_base.o tsnnls/taucs_basic/taucs_ccs_base.c
gcc -O3 -c -o tsnnls/tlsqr.o tsnnls/tlsqr.c
tsnnls/tlsqr.c: In function ‘ccs_to_lapack’:
tsnnls/tlsqr.c:188:2: warning: incompatible implicit declaration of built-in function ‘bzero’ [enabled by default]
bzero(*lapackL, sizeof(double)*vSize);
^
tsnnls/tlsqr.c: In function ‘t_condest’:
tsnnls/tlsqr.c:237:2: warning: incompatible implicit declaration of built-in function ‘bzero’ [enabled by default]
bzero(lapackL, sizeof(double)*vSize);
^
tsnnls/tlsqr.c: In function ‘t_snnlslsqr’:
tsnnls/tlsqr.c:334:2: warning: incompatible implicit declaration of built-in function ‘memcpy’ [enabled by default]
memcpy(scratch, Apb, sizeof(double)*ApAperm->n);
^
gcc -O3 -c -o tsnnls/tsnnls.o tsnnls/tsnnls.c
gcc -O3 -c -o tsnnls/lsqr.o tsnnls/lsqr.c
tsnnls/lsqr.c: In function ‘lsqr’:
tsnnls/lsqr.c:430:2: warning: format ‘%i’ expects argument of type ‘int’, but argument 3 has type ‘long int’ [-Wformat=]
input->cond_lim, input->rel_rhs_err, input->max_iter );
^
tsnnls/lsqr.c:430:2: warning: format ‘%i’ expects argument of type ‘int’, but argument 4 has type ‘long int’ [-Wformat=]
tsnnls/lsqr.c:430:2: warning: format ‘%i’ expects argument of type ‘int’, but argument 9 has type ‘long int’ [-Wformat=]
tsnnls/lsqr.c:514:2: warning: format ‘%i’ expects argument of type ‘int’, but argument 3 has type ‘long int’ [-Wformat=]
bnorm, output->sol_norm );
^
tsnnls/lsqr.c:514:2: warning: format ‘%i’ expects argument of type ‘int’, but argument 4 has type ‘long int’ [-Wformat=]
tsnnls/lsqr.c:539:9: warning: format ‘%i’ expects argument of type ‘int’, but argument 3 has type ‘long int’ [-Wformat=]
output->frob_mat_norm, output->mat_cond_num);
^
tsnnls/lsqr.c:718:6: warning: format ‘%i’ expects argument of type ‘int’, but argument 3 has type ‘long int’ [-Wformat=]
output->frob_mat_norm, output->mat_cond_num);
^
tsnnls/lsqr.c:763:2: warning: format ‘%i’ expects argument of type ‘int’, but argument 3 has type ‘long int’ [-Wformat=]
bnorm, output->sol_norm );
^
tsnnls/lsqr.c:763:2: warning: format ‘%i’ expects argument of type ‘int’, but argument 4 has type ‘long int’ [-Wformat=]
(cd tsnnls ; make all "CFLAGS=-O3" )
make[1]: Entering directory `/home/dkumar/Desktop/tsnnls_dist/tsnnls'
(cd taucs_basic ; make all)
make[2]: Entering directory `/home/dkumar/Desktop/tsnnls_dist/tsnnls/taucs_basic'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/home/dkumar/Desktop/tsnnls_dist/tsnnls/taucs_basic'
make[1]: Leaving directory `/home/dkumar/Desktop/tsnnls_dist/tsnnls'
ar cru libtsnnls.a tsnnls/taucs_basic/taucs_logging.o tsnnls/taucs_basic/taucs_malloc.o tsnnls/taucs_basic/taucs_ccs_order.o tsnnls/taucs_basic/taucs_ccs_ops.o tsnnls/taucs_basic/taucs_vec_base.o tsnnls/taucs_basic/taucs_complex.o tsnnls/taucs_basic/colamd.o tsnnls/taucs_basic/amdbar.o tsnnls/taucs_basic/amdexa.o tsnnls/taucs_basic/amdtru.o tsnnls/taucs_basic/genmmd.o tsnnls/taucs_basic/taucs_timer.o tsnnls/taucs_basic/taucs_sn_llt.o tsnnls/taucs_basic/taucs_ccs_base.o tsnnls/tlsqr.o tsnnls/tsnnls.o tsnnls/lsqr.o
ranlib libtsnnls.a
gcc -O3 tsnnls_test.c -o tsnnls_test -L. -ltsnnls -Lexternal_libraries -llapacklinux -lblaslinux -lf77blas -lcblas -latlas -lg2c -lm
tsnnls_test.c: In function ‘read_tp’:
tsnnls_test.c:192:8: warning: ignoring return value of ‘fscanf’, declared with attribute warn_unused_result [-Wunused-result]
fscanf(fp, "%d %d\n", &dim, &cols);
^
tsnnls_test.c:198:10: warning: ignoring return value of ‘fscanf’, declared with attribute warn_unused_result [-Wunused-result]
fscanf( fp, "%lf ", &vals[r*cols+c] );
^
tsnnls_test.c:199:9: warning: ignoring return value of ‘fscanf’, declared with attribute warn_unused_result [-Wunused-result]
fscanf(fp, "\n");
^
tsnnls_test.c:206:9: warning: ignoring return value of ‘fscanf’, declared with attribute warn_unused_result [-Wunused-result]
fscanf(fp, "%lf\n", &a);
^
tsnnls_test.c:212:9: warning: ignoring return value of ‘fscanf’, declared with attribute warn_unused_result [-Wunused-result]
fscanf(fp, "%lf\n", &(*b)[r]);
^
tsnnls_test.c: In function ‘read_sparsetp’:
tsnnls_test.c:89:8: warning: ignoring return value of ‘fscanf’, declared with attribute warn_unused_result [-Wunused-result]
fscanf(fp, "%d %d\n", &dim, &cols);
^
tsnnls_test.c:90:8: warning: ignoring return value of ‘fscanf’, declared with attribute warn_unused_result [-Wunused-result]
fscanf(fp, "%d\n", &nnz);
^
tsnnls_test.c:115:9: warning: ignoring return value of ‘fscanf’, declared with attribute warn_unused_result [-Wunused-result]
fscanf(fp, "%d %d %lf\n", &elr, &elc, &theVal);
^
tsnnls_test.c:135:9: warning: ignoring return value of ‘fscanf’, declared with attribute warn_unused_result [-Wunused-result]
fscanf(fp, "%d %d %lf\n", &elr, &elc, &theVal);
^
tsnnls_test.c:174:9: warning: ignoring return value of ‘fscanf’, declared with attribute warn_unused_result [-Wunused-result]
fscanf(fp, "%lf\n", &a);
^
tsnnls_test.c:180:9: warning: ignoring return value of ‘fscanf’, declared with attribute warn_unused_result [-Wunused-result]
fscanf(fp, "%lf\n", &(*b)[r]);
^
/usr/bin/ld: skipping incompatible external_libraries/libblaslinux.a when searching for -lblaslinux
/usr/bin/ld: cannot find -lblaslinux
external_libraries/libf77blas.a: error adding symbols: Malformed archive
collect2: error: ld returned 1 exit status
make: *** [test] Error 1