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

kodev build fails under Fedora 26 #3069

Closed
silberzwiebel opened this issue Aug 10, 2017 · 19 comments · Fixed by #3124
Closed

kodev build fails under Fedora 26 #3069

silberzwiebel opened this issue Aug 10, 2017 · 19 comments · Fixed by #3124

Comments

@silberzwiebel
Copy link
Contributor

  • KOReader version: master

Issue

In the process of creating a plugin (to be able to disable touch with a physical button on the inkbook prime, stay tuned), I wanted to build koreader but failed to do so.

I'm running Fedora 26 and think that I do have all necessary requirements (lua, nasm, ...)

This is what I did:

git clone https://github.com/koreader/koreader.git
cd koreader
./kodev build

And here is the output from ./kodev build -v. It fails at configuring djvulibre. Manually going into that directory and doing .\configure && make works, though.

@Frenzie
Copy link
Member

Frenzie commented Aug 10, 2017

You could always use https://github.com/koreader/virdevenv instead, but that sounds like there's something wrong with either the linker or a compiler.

Notice how it says "CC=\"/usr/bin/ccache gcc\" CXX=\"/usr/bin/ccache g++\"

Could any of that be the problem? (e.g., missing g++)

@silberzwiebel
Copy link
Contributor Author

silberzwiebel commented Aug 10, 2017 via email

@Frenzie
Copy link
Member

Frenzie commented Aug 10, 2017

And ld is working fine too? Does it say anything in config.log?

Edit: that is, something like thirdparty/djvulibre/build/x86_64-linux-gnu/djvulibre-prefix/src/djvulibre/config.log

@silberzwiebel
Copy link
Contributor Author

Not sure how I would execute ld exactly. Manually compiling and installing djvulibre works without errors by doing

./configure
make
sudo make install

here is the part of the config log that shows the error in more detail

@Frenzie
Copy link
Member

Frenzie commented Aug 10, 2017

But you're conspicuously leaving out all of the environment variables in that case. ;-) Like I implied, I'd be particularly suspicious of something in this one: LDFLAGS="-Wl,-O1 -Wl,--as-needed -static-libstdc++".

Heck, I wrote that before even actually looking at the log and it's confirmed:

gcc: error: libstdc++.a: No such file or directory

A quick search for that error combined with Fedora yields this.

If you want libstdc++.a, you need to install libstdc++-static package, it is intentionally not part of libstdc++-devel anymore (see Fedora packaging guidelines).

@silberzwiebel
Copy link
Contributor Author

silberzwiebel commented Aug 11, 2017

But you're conspicuously leaving out all of the environment variables in that case. ;-)

Sorry, I did not do this intentionally. To me those files often look more like noise than like signal.
Installing libstdc++-static indeed did fix this problem but I ran into another one:

[ 12%] Performing build step for 'turbo'
cd /home/thomas/zeugs/fossgits/mykoreader/base/thirdparty/turbo/build/x86_64-redhat-linux/turbo-prefix/src/turbo && sh -c "make CC=\"/usr/bin/ccache gcc -O2 -ffast-math -pipe -fomit-frame-pointer  -march=native -fPIC -I/home/thomas/zeugs/fossgits/mykoreader/base/thirdparty/openssl/build/x86_64-redhat-linux/openssl-prefix/src/openssl/include\" LDFLAGS=\"-Wl,-O1 -Wl,--as-needed -static-libstdc++ -lcrypto -lssl 		 		 		-L/home/thomas/zeugs/fossgits/mykoreader/base/thirdparty/openssl/build/x86_64-redhat-linux/openssl-prefix/src/openssl -Wl,-rpath,'\\\$\\\$ORIGIN/../libs'\" all"
make[5]: Verzeichnis „/home/thomas/zeugs/fossgits/mykoreader/base/thirdparty/turbo/build/x86_64-redhat-linux/turbo-prefix/src/turbo“ wird betreten
make -C deps/http-parser library
make[6]: Verzeichnis „/home/thomas/zeugs/fossgits/mykoreader/base/thirdparty/turbo/build/x86_64-redhat-linux/turbo-prefix/src/turbo/deps/http-parser“ wird betreten
/usr/bin/ccache gcc -O2 -ffast-math -pipe -fomit-frame-pointer  -march=native -fPIC -I/home/thomas/zeugs/fossgits/mykoreader/base/thirdparty/openssl/build/x86_64-redhat-linux/openssl-prefix/src/openssl/include  -I. -fPIC -DHTTP_PARSER_STRICT=0  -O3  -Wall -Wextra -Werror -c http_parser.c -o libhttp_parser.o
http_parser.c: In Funktion »http_parser_parse_url«:
http_parser.c:2096:18: Fehler: diese Anweisung könnte durchfallen [-Werror=implicit-fallthrough=]
         found_at = 1;
         ~~~~~~~~~^~~
http_parser.c:2099:7: Anmerkung: hier
       case s_req_server:
       ^~~~
cc1: Alle Warnungen werden als Fehler behandelt
make[6]: *** [Makefile:82: libhttp_parser.o] Fehler 1

The error translates to: "All warnings are treated as errors". I manually deleted the string -Werror from the file koreader/base/thirdparty/turbo/build/x86_64-redhat-linux/turbo-prefix/src/turbo/deps/http-parser/Makefile but I guess this is not the way to go ;)
But probably this is an issue of the turbo lib then?

Anyway, after doing this, ./kodev build is succesful. However, ./kodev run won't start due to missing translation files (maybe need to add this to the readme?). Pulling the translation as described in l10n/README.md, however, does not work:

tx pull -a -f
New translations found for the following languages: el, zh, fi_FI, vi, ca, it_IT, ug, vi_VN, cs, nl_NL, eu, gl, es, ru, tr, pt_PT, pl, bg_BG, fr, zh_TW, pt_BR, bn, ar_AA, hu, fa, ko_KR, cs_CZ, ja, zh_CN, kk, sv, de, zh_TW.Big5, uk, pl_PL, nb_NO
Pulling new translations for resource koreader.koreader (source: templates/koreader.pot)
 -> el: el/koreader.po
DecodeError: ('Received response with content-encoding: gzip, but failed to decode it.', error('Error -2 while decompressing: inconsistent stream state',))
make: *** [Makefile:9: pull] Fehler 1

@Frenzie
Copy link
Member

Frenzie commented Aug 11, 2017

You don't need any translations unless you wish to test in another language (wie Deutsch). ERROR cannot open translation file: l10n/en_US:en/koreader.po is just some noise. I thought that shouldn't happen, but that aside. I'll fix that.

I guess this is not the way to go ;)

It's actually exactly what they did upstream. We'll have to look into bumping that. Also, here's an argument against it https://blog.flameeyes.eu/2009/02/future-proof-your-code-dont-use-werror/

The easiest option would be just to add -Wnoerror without changing anything else, something I've done before.

Frenzie added a commit that referenced this issue Aug 11, 2017
`new_lang` isn't `en_US` but `en_US:en`

Also see #3069 (comment)
@Frenzie
Copy link
Member

Frenzie commented Aug 11, 2017

Sorry, I got distracted by the translation thing. Could you share the debug output?

@silberzwiebel
Copy link
Contributor Author

Sure, here you go.
It's something with not finding the correct device for deployment.
This might be actually a misunderstanding: I intend to build for android but for now I just want to have the emulator running. I thought \kodev run should give me the emulator or do I miss something?

About the translation: I did not ask for German translation files but it somehow looks for them (maybe because my locale is set to de_DE?)

@Frenzie
Copy link
Member

Frenzie commented Aug 11, 2017

I thought \kodev run should give me the emulator or do I miss something?

That's correct. I'm guessing you're missing SDL? A Debian package name like libsdl2-dev (see the README) would turn into something like SDL2-devel under Fedora. Also see https://pkgs.org/download/SDL2-devel but you probably have yum available for easy searching.

About the translation: I did not ask for German translation files but it somehow looks for them (maybe because my locale is set to de_DE?)

I think KOReader locale is wholly independent from the system locale. Either way it doesn't matter because it simply falls back to the built-in (English) strings.

@silberzwiebel
Copy link
Contributor Author

That's correct. I'm guessing you're missing SDL? A Debian package name like libsdl2-dev (see the README) would turn into something like SDL2-devel under Fedora.

Oh, yes. That's true. Luckily for me this isn't the only error because otherwise you could have just relied RTFM.
So, now I get a screen blinking but then it closes immediately:

./luajit: frontend/apps/reader/modules/readerdictionary.lua:7: module 'json' not found:
	no field package.preload['json']
	no file 'common/json.lua'
	no file 'rocks/share/lua/5.1/json.lua'
	no file 'frontend/json.lua'
	no file './json.lua'
	no file '/usr/local/share/luajit-2.1.0-beta2/json.lua'
	no file '/usr/local/share/lua/5.1/json.lua'
	no file '/usr/local/share/lua/5.1/json/init.lua'
	no file 'common/json.so'
	no file 'common/json.dll'
	no file '/usr/lib/lua/json.so'
	no file 'rocks/lib/lua/5.1/json.so'
	no file './json.so'
	no file '/usr/local/lib/lua/5.1/json.so'
	no file '/usr/local/lib/lua/5.1/loadall.so'
stack traceback:
	[C]: in function 'require'
	frontend/apps/reader/modules/readerdictionary.lua:7: in main chunk
	[C]: in function 'require'
	frontend/apps/reader/readerui.lua:25: in main chunk
	[C]: in function 'require'
	./reader.lua:155: in main chunk
	[C]: at 0x00404690

Package lua-json is installed and I do have the file /usr/share/lua/5.3/json.lua but apparently this is not found. I also have various json.luas under the koreader repo directory.

Also see https://pkgs.org/download/SDL2-devel but you probably have yum available for easy searching.

It's nowadays dnf for dandified yum ;)

@Frenzie
Copy link
Member

Frenzie commented Aug 11, 2017

Package lua-json is installed and I do have the file /usr/share/lua/5.3/json.lua but apparently this is not found. I also have various json.luas under the koreader repo directory.

Ah yes, I should've expected that. See #2798 (comment)

Your easiest bet is to install Lua 5.1. On Debian I can pick between 5.1, 5.2, 5.3 or all of 'em. If that's not possible I mentioned an ugly hack in my link as well as the proper way to go about it.

It's nowadays dnf for dandified yum ;)

Keine Ahnung. :-P Was ist anders?

@silberzwiebel
Copy link
Contributor Author

Okay, there is no dedicated lua-5.1 under fedora, only the binaries (compat-lua) but not the json module. I'll have a look to your "hack" after my vacation in a week or so. Thanks so far!

It's nowadays dnf for dandified yum ;)

Keine Ahnung. :-P Was ist anders?

Oh, they just rewrote it from scratch I think and everything is supposed to be better in dnf compared to yum.

@Frenzie
Copy link
Member

Frenzie commented Aug 11, 2017

Well, hopefully I'll remember the next time I try a Fedora LiveCDUSB.

@silberzwiebel
Copy link
Contributor Author

So, I managed to compile the koreader emulator under fedora now (see linked pull request), but it still fails to start. Installing lua5.1 seems to not so easy to do under fedora1, I successfully scrambled up my system's lua by compiling and installing lua5.1 manually. I reverted that and tried the hack, you mentioned @Frenzie (changing 5.1 to 5.3 in setupkoenv.lua). Now the json module is found but koreader is not happy with the 5.3 lpeg module:

./luajit: error loading module 'lpeg' from file '/usr/lib64/lua/5.3/lpeg.so':
	/usr/lib64/lua/5.3/lpeg.so: undefined symbol: luaL_setfuncs
stack traceback:
	[C]: at 0x004523f0
	[C]: in function 'require'
	rocks/share/lua/5.3/json/decode.lua:5: in main chunk
	[C]: in function 'require'
	rocks/share/lua/5.3/json.lua:5: in main chunk
	[C]: in function 'require'
	frontend/apps/reader/modules/readerdictionary.lua:7: in main chunk
	[C]: in function 'require'
	frontend/apps/reader/readerui.lua:25: in main chunk
	[C]: in function 'require'
	./reader.lua:155: in main chunk
	[C]: at 0x00404690

So, I'm trying the virdevenv method now. It still compiles, fingers crossed ...

1 imo that's fine; quote from http://www.lua.org/versions.html#5.1

The last release was Lua 5.1.5, released on 17 Feb 2012. There will be no further releases of Lua 5.1.

@Frenzie
Copy link
Member

Frenzie commented Aug 23, 2017

Like I said in my linked comment, compiling your own probably shouldn't be too problematic as the Travis builds do just that already:

koreader/.ci/install.sh

Lines 25 to 31 in 96ea2ec

git clone https://github.com/torch/luajit-rocks.git
pushd luajit-rocks && {
git checkout 6529891
cmake . -DWITH_LUAJIT21=ON -DCMAKE_INSTALL_PREFIX="${TRAVIS_BUILD_DIR}/install"
make install
} || exit
popd

That aside, LuaJIT2.1-beta3 (the version I just recently bumped it to) has a lot more 5.2 stuff, so that might both work and not even be half as inadvisable as it used to be.

Frenzie added a commit to Frenzie/koreader that referenced this issue Aug 23, 2017
Fixes koreader#3069

* [fix] compile errors under Fedora due to -Werror (koreader/koreader-base#500)
@Frenzie Frenzie mentioned this issue Aug 23, 2017
Frenzie added a commit to Frenzie/koreader that referenced this issue Aug 23, 2017
Fixes koreader#3069 and koreader#3116.

* [fix] compile errors under Fedora due to -Werror (koreader/koreader-base#500)
@silberzwiebel
Copy link
Contributor Author

okay. Since I'm not familiar with the lua... ...jit, ...rocks, ...younameit world, I need some clarifications:

  • where exactly should I compile luajit-rocks as written in the travi build file?
  • do I need to install it somehow systemwide?
  • do I need to uninstall system's lua-packages?

@Frenzie
Copy link
Member

Frenzie commented Aug 23, 2017

You can stick it wherever you want as long as it's in $PATH before you execute ./kodev run.

Edit: relevant parts from Travis script and kodev:

koreader/.ci/common.sh

Lines 64 to 69 in 96ea2ec

export PATH=$PWD/bin:$PATH
export PATH=$PATH:${TRAVIS_BUILD_DIR}/install/bin
if [ -f "${TRAVIS_BUILD_DIR}/install/bin/luarocks" ]; then
# add local rocks to $PATH
eval "$(luarocks path --bin)"
fi

koreader/kodev

Lines 563 to 566 in 7284ad4

echo "adding ${CURDIR} to \$PATH..."
export PATH="${PATH}:${CURDIR}"
eval "$(luarocks path --bin)"
exec "${SHELL}"

Frenzie added a commit that referenced this issue Aug 23, 2017
Fixes #3069 and #3116.

* [fix] compile errors under Fedora due to -Werror (koreader/koreader-base#500)
Frenzie pushed a commit that referenced this issue Aug 23, 2017
Fixes #3069 and #3116.

Add `libstc++-static package` as build prerequisite under Fedora to the README.
@silberzwiebel
Copy link
Contributor Author

I give up on this. I compiled and installed luajit systemwide (with no specific CMAKE_INSTALL_PREFIX). koreader starts but this time really crashes:

[*] Running KOReader with arguments: ...
~/zeugs/fossgits/koreader/koreader-emulator-x86_64-redhat-linux/koreader ~/zeugs/fossgits/koreader
---------------------------------------------
                launching...
  _  _____  ____                _
 | |/ / _ \|  _ \ ___  __ _  __| | ___ _ __
 | ' / | | | |_) / _ \/ _` |/ _` |/ _ \ '__|
 | . \ |_| |  _ <  __/ (_| | (_| |  __/ |
 |_|\_\___/|_| \_\___|\__,_|\__,_|\___|_|

 [*] Current time: 08/23/17-13:58:54

08/23/17-13:58:54 ERROR cannot open translation file: l10n/de_DE/koreader.po
08/23/17-13:58:55 DEBUG refresh on physical rectangle 0 0 540 720
08/23/17-13:58:55 INFO  initializing for device SDL
08/23/17-13:58:55 INFO  framebuffer resolution: {
    ["h"] = 720,
    ["w"] = 540
}
08/23/17-13:58:55 DEBUG show reader ui
08/23/17-13:58:55 DEBUG show widget unknown
08/23/17-13:58:55 DEBUG ImageWidget: _render'ing
08/23/17-13:58:55 DEBUG cache image|resources/info-i.png||
08/23/17-13:58:55 DEBUG blitFrom 55 329 0 0 60 60
08/23/17-13:58:55 DEBUG refresh on physical rectangle 0 0 540 720
08/23/17-13:58:55 DEBUG close widget
08/23/17-13:58:55 DEBUG creating coroutine for showing reader
08/23/17-13:58:55 INFO  opening file ./help/quickstart-en-v2015.11-1155-gbd096dea.html
./kodev: Zeile 295: 13410 Speicherzugriffsfehler  (Speicherabzug geschrieben) EMULATE_READER_W=${screen_width} EMULATE_READER_H=${screen_height} ./reader.lua -d "$args"

Speicherzugriffsfehler is a segmentation fault. My gut says this has something to do with too much lua stuff on my PC.

Anyway, I got a running emulator using the virtual machine. it takes way longer to compile but it runs, so I'm happy for now.

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

Successfully merging a pull request may close this issue.

2 participants