geometer / FBReader

Official FBReader C++ project repository
http://www.fbreader.org/
540 stars 170 forks source link

0.99 does not build on Ubuntu 12.04 x86_64, make does not complete #146

Closed madig closed 12 years ago

madig commented 12 years ago

I'm trying to build both the 0.99 download from the website and the current revision from git. I get:

18:16  ~/Entwicklung/FBReader (a73066b7a96d9828ed9920076c912e0d602a4d05) $ LC_ALL=en make 
make[1]: Entering directory `/home/nikolaus/Entwicklung/FBReader/zlibrary/core'
make[2]: Entering directory `/home/nikolaus/Entwicklung/FBReader/zlibrary/core/src/library'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/home/nikolaus/Entwicklung/FBReader/zlibrary/core/src/library'
[...]
make[2]: Entering directory `/home/nikolaus/Entwicklung/FBReader/zlibrary/core/src/unix/library'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/home/nikolaus/Entwicklung/FBReader/zlibrary/core/src/unix/library'
Creating libzlcore.so.0.99.0 .../usr/bin/ld: cannot find -lzlui
collect2: ld returned 1 exit status
make[1]: *** [libzlcore.so.0.99.0] Error 1
make[1]: Leaving directory `/home/nikolaus/Entwicklung/FBReader/zlibrary/core'
make: *** [all] Error 1
zsh: exit 2     LC_ALL=en make

The "text" and "ui" directories aren't even touched it seems, I can "make" in these directories just fine.

snowwlex commented 12 years ago

Thanks for the posting this issue!

Looks like a bug with compiling with shared version of zlibrary, so it can be compiled with ZLSHARED=no flag:

make ZLSHARED=no && sudo make install

Also, I fixed this bug at current version of 0.99 branch (by commit 3dde161d)

madig commented 12 years ago

Thanks for the hint about ZLSHARED=no, now it compiles fine but I can't install the stuff... running "sudo make install" will try to "make" everything again with ZLSHARED=yes, the process then fails with

[...]
make[2]: Entering directory `/home/nikolaus/Entwicklung/FBReader/zlibrary/core/src/unix/library'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/home/nikolaus/Entwicklung/FBReader/zlibrary/core/src/unix/library'
Creating libzlcore.so.0.99.1 .../usr/bin/ld: src/library/ZLibrary.o: relocation R_X86_64_32 against `pthread_cancel' can not be used when making a shared object; recompile with -fPIC
src/library/ZLibrary.o: could not read symbols: Bad value

Running "sudo make install ZLSHARED=no" does pretty much the same as "make ZLSHARED=no" without installing anything :( And running fbreader/FBReader just gives me an empty window.

BTW: Is makefiles/target.mk intentionally missing?

snowwlex commented 12 years ago

Sorry, I was wrong: with ZLSHARED=no you should use make do_install (instead of install)

make ZLSHARED=no && sudo make do_install 

make do_install will just copy all necessary files without compiling it.

Yes, makefiles/target.mk missed intentionally - because it just contains current configuration for architecture and ui type. (Since 0.99.0 we support Qt4-based UI only, so UI_TYPE must be equal qt4)

Just in case, here is my target.mk below:

TARGET_ARCH = desktop
UI_TYPE = qt4
madig commented 12 years ago

Okay, "sudo make do_install ZLSHARED=no" seems to work :) Now when I install to /usr/local, I get the familiar empty window that does nothing. You might want to work on the makefiles to make "make && sudo make install" just work ;)

About target.mk: make complains about undefined TARGET_ARCH and UI_TYPE when the file is missing, so I wondered why it was removed when it's still needed :)

snowwlex commented 12 years ago

About target.mk: it's expected, that user will create this file by himself, and instruction about content of this file is in README.build (because FBReader can be compiliable for different platforms and UI libraries, and there no default values) :)

" I get the familiar empty window that does nothing." I didn't understand, if everything works now or not? :)

madig commented 12 years ago

Oh, alright.

Sorry for being unclear. The build process works and the program works when installing to the default /usr prefix (it hangs(?) trying to download something upon initial startup but that's for another bug report), it does not work when installing to /usr/local (-> empty window that doesn't do anything).

snowwlex commented 12 years ago

it does not work when installing to /usr/local

that's because FBReader is trying to read it's assets files from predefined folders. See makefiles/arch/desktop.mk, at the top of the file:

ifeq "$(INSTALLDIR)" ""
  INSTALLDIR=/usr
endif
IMAGEDIR = $(INSTALLDIR)/share/pixmaps
APPIMAGEDIR = $(INSTALLDIR)/share/pixmaps/%APPLICATION_NAME%

IMAGEDIR and APPIMAGEDIR (and other variables, from makefiles/config.mk) are included in source code as macroses, so they should be setted before running make.

So, if you want to install it to folder /usr/local, you should run

make INSTALLDIR=/usr/local

or

 make ZLSHARED=no INSTALLDIR=/usr/local