Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't compile on Debian Squeeze #9

Closed
hasse69 opened this issue Mar 13, 2015 · 10 comments
Closed

Can't compile on Debian Squeeze #9

hasse69 opened this issue Mar 13, 2015 · 10 comments

Comments

@hasse69
Copy link
Owner

hasse69 commented Mar 13, 2015

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 2011-07-16

@hasse69
Copy link
Owner Author

hasse69 commented May 23, 2015

See issue#2
Makefile is still not updated properly.

Original issue reported on code.google.com by hans.beckerus on 2011-07-16 08:27:21

@hasse69
Copy link
Owner Author

hasse69 commented May 23, 2015

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 issue reported on code.google.com by teresaejunior on 2011-07-16 08:40:23

@hasse69
Copy link
Owner Author

hasse69 commented May 23, 2015

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 issue reported on code.google.com by hans.beckerus on 2011-07-16 11:54:06

@hasse69
Copy link
Owner Author

hasse69 commented May 23, 2015

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 issue reported on code.google.com by teresaejunior on 2011-07-16 21:28:15

@hasse69
Copy link
Owner Author

hasse69 commented May 23, 2015

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 issue reported on code.google.com by hans.beckerus on 2011-07-19 08:11:44

@hasse69
Copy link
Owner Author

hasse69 commented May 23, 2015

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 issue reported on code.google.com by hans.beckerus on 2011-07-19 10:10:17

@hasse69
Copy link
Owner Author

hasse69 commented May 23, 2015

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 issue reported on code.google.com by teresaejunior on 2011-07-19 10:17:07

@hasse69
Copy link
Owner Author

hasse69 commented May 23, 2015

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 issue reported on code.google.com by hans.beckerus on 2011-07-19 11:13:36

@hasse69
Copy link
Owner Author

hasse69 commented May 23, 2015

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 issue reported on code.google.com by teresaejunior on 2011-07-20 00:18:18

@hasse69
Copy link
Owner Author

hasse69 commented May 23, 2015

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

Original issue reported on code.google.com by hans.beckerus on 2011-07-20 08:34:10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant