ClosestStorm / rar2fs

Automatically exported from code.google.com/p/rar2fs
GNU General Public License v3.0
0 stars 0 forks source link

Can't compile on Debian Squeeze #9

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hello, I have tried compiling both the stable and the svn versions of rar2fs in 
Debian Squeeze, but I get:

$ make
g++ -g -rdynamic -fno-omit-frame-pointer -O2  -D_FILE_OFFSET_BITS=64 
-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_GNU_SOURCE -DRARDLL  -MD -I./unrar 
-c dllext.cpp
gcc -g -rdynamic -fno-omit-frame-pointer -O2 -std=c99 -Wall  
-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_GNU_SOURCE 
-DHAS_GLIBC_CUSTOM_STREAMS_ -DRARDLL -DFUSE_USE_VERSION=27  -MD -I./unrar -I -c 
configdb.c
/usr/lib/gcc/i486-linux-gnu/4.4.5/../../../../lib/crt1.o: In function `_start':
(.text+0x18): undefined reference to `main'
collect2: ld returned 1 exit status
make: ** [configdb.o] Error 1

After some google search, I found that what could cause this is if there was no 
main function, but I know this doesn't apply. So, your help will be appreciated!

Original issue reported on code.google.com by teresaejunior on 16 Jul 2011 at 2:17

GoogleCodeExporter commented 9 years ago
See issue#2
Makefile is still not updated properly.

Original comment by hans.bec...@gmail.com on 16 Jul 2011 at 8:27

GoogleCodeExporter commented 9 years ago
Thank you! Though now I don't get past this:

$ make
g++ -g -rdynamic -fno-omit-frame-pointer -O2  -D_FILE_OFFSET_BITS=64 
-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_GNU_SOURCE -DRARDLL -MD -Iunrar -c 
dllext.cpp
g++ -g -rdynamic -fno-omit-frame-pointer -O2  -D_FILE_OFFSET_BITS=64 
-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_GNU_SOURCE -DRARDLL -MD -Iunrar -c 
extractext.cpp
gcc -g -rdynamic -fno-omit-frame-pointer -O2 -std=c99 -Wall  
-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_GNU_SOURCE 
-DHAS_GLIBC_CUSTOM_STREAMS_ -DRARDLL -DFUSE_USE_VERSION=27 -MD -Iunrar 
-I/usr/include/fuse -c configdb.c
gcc -g -rdynamic -fno-omit-frame-pointer -O2 -std=c99 -Wall  
-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_GNU_SOURCE 
-DHAS_GLIBC_CUSTOM_STREAMS_ -DRARDLL -DFUSE_USE_VERSION=27 -MD -Iunrar 
-I/usr/include/fuse -c filecache.c
gcc -g -rdynamic -fno-omit-frame-pointer -O2 -std=c99 -Wall  
-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_GNU_SOURCE 
-DHAS_GLIBC_CUSTOM_STREAMS_ -DRARDLL -DFUSE_USE_VERSION=27 -MD -Iunrar 
-I/usr/include/fuse -c iobuffer.c
gcc -g -rdynamic -fno-omit-frame-pointer -O2 -std=c99 -Wall  
-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_GNU_SOURCE 
-DHAS_GLIBC_CUSTOM_STREAMS_ -DRARDLL -DFUSE_USE_VERSION=27 -MD -Iunrar 
-I/usr/include/fuse -c sighandler.c
gcc -g -rdynamic -fno-omit-frame-pointer -O2 -std=c99 -Wall  
-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_GNU_SOURCE 
-DHAS_GLIBC_CUSTOM_STREAMS_ -DRARDLL -DFUSE_USE_VERSION=27 -MD -Iunrar 
-I/usr/include/fuse -c rar2fs.c
gcc -o rar2fs  dllext.o extractext.o configdb.o filecache.o iobuffer.o 
sighandler.o rar2fs.o -L -L/usr/lib -lunrar -pthread -lfuse     
/usr/bin/ld.bfd.real: cannot find -lunrar
collect2: ld returned 1 exit status
make: ** [rar2fs] Erro 1

I can't set UNRAR_LIB=, since there is no unrarlib.so in Debian. I placed the 
unrar source in the tree, shouldn't it be enough?

Original comment by teresaejunior on 16 Jul 2011 at 8:40

GoogleCodeExporter commented 9 years ago
No. If your platform does not provide libunrar.so you need to build it from the 
unrar source.
make -f makefile.unix lib should do it. Check the source tree, it should 
provide instructions on how to build.

Original comment by hans.bec...@gmail.com on 16 Jul 2011 at 11:54

GoogleCodeExporter commented 9 years ago
Thank you again! They build the unrar binary from the source, but not the 
library!

Now I'm stuck on the problem mentioned at 
https://code.google.com/p/rar2fs/issues/detail?id=3

g++ -g -rdynamic -fno-omit-frame-pointer -O2  -D_FILE_OFFSET_BITS=64 
-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_GNU_SOURCE -DRARDLL  -MD 
-I../unrar -c dllext.cpp
gcc -g -rdynamic -fno-omit-frame-pointer -O2 -std=c99 -Wall  
-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_GNU_SOURCE 
-DHAS_GLIBC_CUSTOM_STREAMS_ -DRARDLL -DFUSE_USE_VERSION=27 -I/usr/include -MD 
-I../unrar -I/usr/include -c configdb.c
gcc -g -rdynamic -fno-omit-frame-pointer -O2 -std=c99 -Wall  
-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_GNU_SOURCE 
-DHAS_GLIBC_CUSTOM_STREAMS_ -DRARDLL -DFUSE_USE_VERSION=27 -I/usr/include -MD 
-I../unrar -I/usr/include -c filecache.c
gcc -g -rdynamic -fno-omit-frame-pointer -O2 -std=c99 -Wall  
-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_GNU_SOURCE 
-DHAS_GLIBC_CUSTOM_STREAMS_ -DRARDLL -DFUSE_USE_VERSION=27 -I/usr/include -MD 
-I../unrar -I/usr/include -c iobuffer.c
gcc -g -rdynamic -fno-omit-frame-pointer -O2 -std=c99 -Wall  
-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_GNU_SOURCE 
-DHAS_GLIBC_CUSTOM_STREAMS_ -DRARDLL -DFUSE_USE_VERSION=27 -I/usr/include -MD 
-I../unrar -I/usr/include -c sighandler.c
gcc -g -rdynamic -fno-omit-frame-pointer -O2 -std=c99 -Wall  
-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_GNU_SOURCE 
-DHAS_GLIBC_CUSTOM_STREAMS_ -DRARDLL -DFUSE_USE_VERSION=27 -I/usr/include -MD 
-I../unrar -I/usr/include -c rar2fs.c
gcc -o rar2fs  dllext.o configdb.o filecache.o iobuffer.o sighandler.o rar2fs.o 
 -L../unrar -L/usr/lib -lunrar -pthread -lrt -lfuse     
../unrar/libunrar.so: undefined reference to `RecVolumes::~RecVolumes()'
../unrar/libunrar.so: undefined reference to `RecVolumes::Restore(RAROptions*, 
char const*, wchar_t const*, bool)'
../unrar/libunrar.so: undefined reference to `RecVolumes::RecVolumes()'
collect2: ld returned 1 exit status
make: ** [rar2fs] Error 1

Unfortunately cleaning the source with `make clean' before doing a `make' 
doesn't help. I don't understand much of C, so I placed -fPIC in CFLAGS and 
CXXFLAGS, maybe the wrong place, so it doesn't help either.

I really appreciate if you can help me further!

Original comment by teresaejunior on 16 Jul 2011 at 9:28

GoogleCodeExporter commented 9 years ago
Sounds strange that your platform should require specific placement independent 
code switches at compile time? Have you tried to upgrade to a later version of 
gcc?
In any case -fPIC should not be applied to the binary itself (the one with the 
main() function). It should be applied to shared object files (.so). So it is 
the makefile.unix in the unrar source tree that should be changed, not the 
makefiles for rar2fs. 

Original comment by hans.bec...@gmail.com on 19 Jul 2011 at 8:11

GoogleCodeExporter commented 9 years ago
Another thing that sounds odd is that your platform provides the unrar binary 
but not the shared libs that belongs to it? Is it built statically? That would 
surprise me!?
What is the output from 'ldd' on your unrar binary? Eg. 'ldd 
/usr/local/bin/unrar'

Original comment by hans.bec...@gmail.com on 19 Jul 2011 at 10:10

GoogleCodeExporter commented 9 years ago
Thank you, hans! Now it works!

I found strange that i didn't work with one rar file I had on my machine. 
rar2fs didn't complain, but the mount was defective and would throw a fuse 
error: "ls: cannot access /home/teresaejunior/mountpoint: Transport endpoint is 
not connected"

But now I got to try with one more rar file and it works well. I'll try with 
more rar files when I'm able to!

$ ldd /usr/bin/unrar
    linux-gate.so.1 =>  (0xb7730000)
    libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0xb7623000)
    libm.so.6 => /lib/libm.so.6 (0xb75fd000)
    libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xb75de000)
    libc.so.6 => /lib/libc.so.6 (0xb7499000)
    /lib/ld-linux.so.2 (0xb7731000)

Original comment by teresaejunior on 19 Jul 2011 at 10:17

GoogleCodeExporter commented 9 years ago
Ok. I totally forgot that the unrar binary actually does not use the shared lib 
itself. But what made it work for you, did you have to add -fPIC to the 
makefile.unix ?

Original comment by hans.bec...@gmail.com on 19 Jul 2011 at 11:13

GoogleCodeExporter commented 9 years ago
No packages in Debian depend on libunrar.so. So, I believe they prefer to leave 
non-free stuff out when not needed.

Yes, I had to add it to makefile.unix!

BTW, I have now tested it with other archives and it works well. Thank you, 
again!

Original comment by teresaejunior on 20 Jul 2011 at 12:18

GoogleCodeExporter commented 9 years ago
Good to hear that issue is solved. 
I might have to add an entry in the FAQ for -fPIC.
Case closed.

Original comment by hans.bec...@gmail.com on 20 Jul 2011 at 8:34