jigneshvasoya / fuse-zip

Automatically exported from code.google.com/p/fuse-zip
GNU Lesser General Public License v3.0
0 stars 0 forks source link

Compilation fails if "--as-needed" linker flag is set / Не компилируется с опцией "--as-needed" #29

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Во многих дистрибутивах опция "--as-needed" 
используется по умолчанию.
При компиляции получаем ошибку:

ar -cq libfusezip.a libZipWrapper.o fuseZipData.o fileNode.o fuse-zip.o 
bigBuffer.o
make[1]: Leaving directory `/usr/src/packages/BUILD/fuse-zip-0.2.13/lib'
g++  main.o -pthread -lfuse -lrt -ldl   -lzip -lz   -Llib -lfusezip \
    -o fuse-zip
lib/libfusezip.a(fuseZipData.o): In function `FuseZipData::build_tree()':
/usr/src/packages/BUILD/fuse-zip-0.2.13/lib/fuseZipData.cpp:56: undefined 
reference to `zip_get_num_files'
/usr/src/packages/BUILD/fuse-zip-0.2.13/lib/fuseZipData.cpp:58: undefined 
reference to `zip_get_name'
lib/libfusezip.a(fuseZipData.o): In function 
`FuseZipData::removeNode(FileNode*) const':
/usr/src/packages/BUILD/fuse-zip-0.2.13/lib/fuseZipData.cpp:74: undefined 
reference to `zip_delete'
lib/libfusezip.a(fuseZipData.o): In function `~FuseZipData':
... (и т. д.)

Помогает исправление Makefile.

fuse-zip-0.2.13-linker.patch:

Index: Makefile
===================================================================
--- Makefile.orig
+++ Makefile
@@ -1,5 +1,5 @@
 DEST=fuse-zip
-LIBS=$(shell pkg-config fuse --libs) $(shell pkg-config libzip --libs) -Llib 
-lfusezip
+LIBS=-Llib -lfusezip $(shell pkg-config fuse --libs) $(shell pkg-config libzip 
--libs)
 LIB=lib/libfusezip.a
 CXXFLAGS=-g -O2 -Wall -Wextra
 RELEASE_CXXFLAGS=-O2 -Wall -Wextra

Original issue reported on code.google.com by lazy.ken...@gmail.com on 27 Dec 2010 at 6:01

GoogleCodeExporter commented 9 years ago
Already fixed (changeset a9fad2bb6c). To be included in the next release.

Original comment by alexander.galanin on 28 Dec 2010 at 4:55

GoogleCodeExporter commented 9 years ago

Original comment by alexander.galanin on 14 Jun 2013 at 8:51

GoogleCodeExporter commented 9 years ago
Fixed in 0.3.0

Original comment by alexander.galanin on 29 Jun 2013 at 5:31

GoogleCodeExporter commented 9 years ago
I'm sorry to say, it doesn't work.

 g++ main.o  -lfuse -pthread  -lzip -lz  -Llib -lfusezip \
     -o fuse-zip
 lib/libfusezip.a(fuseZipData.o): In function `FuseZipData::removeNode(FileNode*) const':
 /home/abuild/rpmbuild/BUILD/fuse-zip-0.3.0/lib/fuseZipData.cpp:87: undefined reference to `zip_delete'
 lib/libfusezip.a(fuseZipData.o): In function `FuseZipData::build_tree(bool)':
 /home/abuild/rpmbuild/BUILD/fuse-zip-0.3.0/lib/fuseZipData.cpp:56: undefined reference to `zip_get_num_entries'
 /home/abuild/rpmbuild/BUILD/fuse-zip-0.3.0/lib/fuseZipData.cpp:61: undefined reference to `zip_get_name'
 /home/abuild/rpmbuild/BUILD/fuse-zip-0.3.0/lib/fuseZipData.cpp:69: undefined reference to `zip_get_name'
 lib/libfusezip.a(fuseZipData.o): In function `FuseZipData::~FuseZipData()':
 /home/abuild/rpmbuild/BUILD/fuse-zip-0.3.0/lib/fuseZipData.cpp:41: undefined reference to `zip_close'
 /home/abuild/rpmbuild/BUILD/fuse-zip-0.3.0/lib/fuseZipData.cpp:43: undefined reference to `zip_strerror'
 lib/libfusezip.a(fileNode.o): In function `FileNode::FileNode(FuseZipData*, char const*, long)':
 /home/abuild/rpmbuild/BUILD/fuse-zip-0.3.0/lib/fileNode.cpp:54: undefined reference to `zip_stat_index'
 /home/abuild/rpmbuild/BUILD/fuse-zip-0.3.0/lib/fileNode.cpp:60: undefined reference to `zip_stat_init'
 lib/libfusezip.a(fuse-zip.o): In function `initFuseZip':
 /home/abuild/rpmbuild/BUILD/fuse-zip-0.3.0/lib/fuse-zip.cpp:54: undefined reference to `zip_open'
 /home/abuild/rpmbuild/BUILD/fuse-zip-0.3.0/lib/fuse-zip.cpp:56: undefined reference to `zip_error_to_str'
 lib/libfusezip.a(fuse-zip.o): In function `fusezip_mkdir':
 /home/abuild/rpmbuild/BUILD/fuse-zip-0.3.0/lib/fuse-zip.cpp:335: undefined reference to `zip_dir_add'
 lib/libfusezip.a(fuse-zip.o): In function `fusezip_rename':
 /home/abuild/rpmbuild/BUILD/fuse-zip-0.3.0/lib/fuse-zip.cpp:401: undefined reference to `zip_file_rename'
 /home/abuild/rpmbuild/BUILD/fuse-zip-0.3.0/lib/fuse-zip.cpp:407: undefined reference to `zip_file_rename'
 lib/libfusezip.a(bigBuffer.o): In function `BigBuffer::zipUserFunctionCallback(void*, void*, unsigned long, zip_source_cmd)':
 /home/abuild/rpmbuild/BUILD/fuse-zip-0.3.0/lib/bigBuffer.cpp:274: undefined reference to `zip_stat_init'
 lib/libfusezip.a(bigBuffer.o): In function `BigBuffer::saveToZip(long, zip*, char const*, bool, long)':
 /home/abuild/rpmbuild/BUILD/fuse-zip-0.3.0/lib/bigBuffer.cpp:295: undefined reference to `zip_source_function'
 /home/abuild/rpmbuild/BUILD/fuse-zip-0.3.0/lib/bigBuffer.cpp:300: undefined reference to `zip_file_replace'
 /home/abuild/rpmbuild/BUILD/fuse-zip-0.3.0/lib/bigBuffer.cpp:299: undefined reference to `zip_file_add'
 /home/abuild/rpmbuild/BUILD/fuse-zip-0.3.0/lib/bigBuffer.cpp:302: undefined reference to `zip_source_free'
 lib/libfusezip.a(bigBuffer.o): In function `BigBuffer::BigBuffer(zip*, unsigned long, unsigned long)':
 /home/abuild/rpmbuild/BUILD/fuse-zip-0.3.0/lib/bigBuffer.cpp:161: undefined reference to `zip_fopen_index'
 /home/abuild/rpmbuild/BUILD/fuse-zip-0.3.0/lib/bigBuffer.cpp:175: undefined reference to `zip_fread'
 /home/abuild/rpmbuild/BUILD/fuse-zip-0.3.0/lib/bigBuffer.cpp:193: undefined reference to `zip_fclose'
 /home/abuild/rpmbuild/BUILD/fuse-zip-0.3.0/lib/bigBuffer.cpp:177: undefined reference to `zip_file_strerror'
 /home/abuild/rpmbuild/BUILD/fuse-zip-0.3.0/lib/bigBuffer.cpp:179: undefined reference to `zip_fclose'
 /home/abuild/rpmbuild/BUILD/fuse-zip-0.3.0/lib/bigBuffer.cpp:187: undefined reference to `zip_fclose'
 /home/abuild/rpmbuild/BUILD/fuse-zip-0.3.0/lib/bigBuffer.cpp:189: undefined reference to `zip_get_name'
 /home/abuild/rpmbuild/BUILD/fuse-zip-0.3.0/lib/bigBuffer.cpp:194: undefined reference to `zip_strerror'
 /home/abuild/rpmbuild/BUILD/fuse-zip-0.3.0/lib/bigBuffer.cpp:195: undefined reference to `zip_strerror'
 /home/abuild/rpmbuild/BUILD/fuse-zip-0.3.0/lib/bigBuffer.cpp:163: undefined reference to `zip_strerror'
 /home/abuild/rpmbuild/BUILD/fuse-zip-0.3.0/lib/bigBuffer.cpp:164: undefined reference to `zip_strerror'
 collect2: error: ld returned 1 exit status
 make: *** [fuse-zip] Error 1

Works with the patch.
fuse-zip-0.3.0-linker.patch:

Index: fuse-zip-0.3.0/Makefile
===================================================================
--- fuse-zip-0.3.0.orig/Makefile
+++ fuse-zip-0.3.0/Makefile
@@ -1,5 +1,5 @@
 DEST=fuse-zip
-LIBS=$(shell pkg-config fuse --libs) $(shell pkg-config libzip --libs) -Llib 
-lfusezip
+LIBS=-Llib -lfusezip $(shell pkg-config fuse --libs) $(shell pkg-config libzip 
--libs)
 LIB=lib/libfusezip.a
 CXXFLAGS=-g -O0 -Wall -Wextra
 RELEASE_CXXFLAGS=-O2 -Wall -Wextra

Original comment by lazy.ken...@gmail.com on 29 Jun 2013 at 6:15

GoogleCodeExporter commented 9 years ago
OK, I will include fix into thew next release.

Original comment by alexander.galanin on 30 Jun 2013 at 4:16

GoogleCodeExporter commented 9 years ago
Issue 39 has been merged into this issue.

Original comment by alexander.galanin on 9 Oct 2013 at 5:38

GoogleCodeExporter commented 9 years ago
Fixed again (version 0.3.1) :)

Original comment by alexander.galanin on 7 Dec 2013 at 3:22