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

Add newsbeuter #298

Merged
merged 4 commits into from Nov 16, 2016

Conversation

@bkutil
Copy link
Contributor

commented Jun 3, 2016

Newsbeuter is an open-source RSS/Atom feed reader for text terminals.

This PR adds Newsbeuter and its two dependencies - json-c and stfl.

It successfully starts on a Nexus 7, can list, view and fetch feeds.

@bkutil

This comment has been minimized.

Copy link
Contributor Author

commented Jun 3, 2016

It is possible that some of the patches to original sources could be removed, as there might be a more 'termux' way to compile things. I mostly copied what seemed to be working in the other build scripts, but I'm otherwise new to termux, so any advice is welcome :)

@Neo-Oli

This comment has been minimized.

Copy link
Member

commented Oct 12, 2016

I tried to test this, but it doesn't work yet.
There is a small error in the json-c build.sh. I had to change line 7 to export LDFLAGS+=" -llog" (because of this.
But newsbeuter can't be built and fails with Checking for package ncursesw5 using ncursesw5-config... not found

@Neo-Oli Neo-Oli referenced this pull request Nov 7, 2016
@bkutil

This comment has been minimized.

Copy link
Contributor Author

commented Nov 13, 2016

After sudo apt-get install libncursesw5-dev on the host, newsbeuter compiles again.

The command used for build is ./build-package.sh -a arm newsbeuter on ubuntu 16.04.1 with termux-packages ecaaa5d, environment was set up using ./setup-ubuntu.sh.

newsbeuter's config.sh checks for ncursesw5-config on the host, but is not able to find it. Stracing it gives:

...
stat("/usr/local/sbin/ncursesw5-config", 0x7ffd379a3870) = -1 ENOENT (No such file or directory)
stat("/usr/local/bin/ncursesw5-config", 0x7ffd379a3870) = -1 ENOENT (No such file or directory)
stat("/usr/sbin/ncursesw5-config", 0x7ffd379a3870) = -1 ENOENT (No such file or directory)
stat("/usr/bin/ncursesw5-config", 0x7ffd379a3870) = -1 ENOENT (No such file or directory)
stat("/sbin/ncursesw5-config", 0x7ffd379a3870) = -1 ENOENT (No such file or directory)
stat("/bin/ncursesw5-config", 0x7ffd379a3870) = -1 ENOENT (No such file or directory)
stat("/usr/games/ncursesw5-config", 0x7ffd379a3870) = -1 ENOENT (No such file or directory)
stat("/usr/local/games/ncursesw5-config", 0x7ffd379a3870) = -1 ENOENT (No such file or directory)
stat("/space/termux/.termux-build/_lib/toolchain-aarch64-ndk13-api21-v2/bin/ncursesw5-config", 0x7ffd379a3870) = -1 ENOENT (No such file or directory)
...

I suspect the package stopped compiling due to debian bug 745479 getting fixed in ncurses package version 6.0+20151017-1 (debian ncurses package changelog), which ubuntu then picked up in 16.04 or 16:10:

dev@dev:~$ dpkg -S /usr/bin/ncursesw5-config # Ubuntu 15.10
ncurses-bin: /usr/bin/ncursesw5-config
...
termux@dev:~$ dpkg -S /usr/bin/ncursesw5-config # Ubuntu 16.10.1
libncursesw5-dev:amd64: /usr/bin/ncursesw5-config
@bkutil

This comment has been minimized.

Copy link
Contributor Author

commented Nov 13, 2016

Squashed json-c fix and replaced check in config.sh for host's ncursesw5-config with -lncursesw5 in the Makefile.

@Neo-Oli

This comment has been minimized.

Copy link
Member

commented Nov 14, 2016

Cool. I was able to compile it now and it seems to work without any problems.

@Neo-Oli

This comment has been minimized.

Copy link
Member

commented Nov 14, 2016

I did encounter a bug now. When using Podbeuter to download an enqueued file a segmentation fault occurs.
Backtrace:

terminate called without an active exception
Thread 1 "podbeuter" received signal SIGABRT, Aborted.
0x0000007fb79853d4 in tgkill () from /system/lib64/libc.so
(gdb) bt
#0  0x0000007fb79853d4 in tgkill () from /system/lib64/libc.so
#1  0x0000007fb7982b68 in pthread_kill () from /system/lib64/libc.so
#2  0x0000007fb793fa3c in raise () from /system/lib64/libc.so
#3  0x0000007fb793a1dc in abort () from /system/lib64/libc.so
#4  0x0000007fb7ab1e14 in __gnu_cxx::__verbose_terminate_handler() () from /data/data/com.termux/files/usr/lib/libgnustl_shared.so
#5  0x0000007fb7aaed9c in __cxxabiv1::__terminate(void (*)()) () from /data/data/com.termux/files/usr/lib/libgnustl_shared.so
#6  0x0000007fb7aaee08 in std::terminate() () from /data/data/com.termux/files/usr/lib/libgnustl_shared.so
#7  0x000000558c9326e4 in ?? ()
#8  0x000000558c930b10 in ?? ()
#9  0x000000558c92f014 in main ()

@Neo-Oli

This comment has been minimized.

Copy link
Member

commented Nov 14, 2016

I just found this: akrennmair/newsbeuter#418
So it's not termux related then.

@bkutil

This comment has been minimized.

Copy link
Contributor Author

commented Nov 14, 2016

This should be fixed in akrennmair/newsbeuter#168 - should I add those patches into the build? I already did something similar in df3dfcd for akrennmair/newsbeuter#180.

@Neo-Oli

This comment has been minimized.

Copy link
Member

commented Nov 14, 2016

I think that would be a good idea. Or we could build straight from the latest version on Github.

@fornwall fornwall merged commit b3a91dd into termux:master Nov 16, 2016

@bkutil bkutil deleted the bkutil:newsbeuter branch Nov 16, 2016

@bkutil

This comment has been minimized.

Copy link
Contributor Author

commented Nov 16, 2016

Thanks!

@fornwall

This comment has been minimized.

Copy link
Member

commented Nov 16, 2016

@bkutil Thank you, and sorry for the delay! The built packages are now available in the apt package repository.

Additional development and fixes can now be done in separate pull requests.

@Neo-Oli

This comment has been minimized.

Copy link
Member

commented Dec 8, 2016

@bkutil Could you maybe now try to build from the latest git version? Something like this::

TERMUX_PKG_VERSION=2.9.20161208
_COMMIT=cc6aeeec117302496943f71ed5c698b90c002f67
TERMUX_PKG_SRCURL=https://github.com/akrennmair/newsbeuter/archive/${_COMMIT}.tar.gz
TERMUX_PKG_FOLDERNAME=newsbeuter-${_COMMIT}

I just tried it, but of course a number of patches now don't work anymore.

@bkutil

This comment has been minimized.

Copy link
Contributor Author

commented Dec 8, 2016

I updated the patches so they re-apply cleanly (except for https://github.com/termux/termux-packages/blob/master/packages/newsbeuter/007_translit.patch, which might not be needed anymore), however, I'm hitting issues with std::to_string and std::stoi which are used extensively in the newer version. A WIP branch is here: https://github.com/bkutil/termux-packages/tree/newsbeuter-git

@sayash

This comment has been minimized.

Copy link

commented Jan 19, 2017

Probably doing all sorts of wrong things ... But in the off chance it is of any assistance, here goes. If not, feel free to ignore / delete.

I tried to use this StackOverflow answer and added the following patches.

Add a custom to_string()

--- src/src/ocnews_api.cpp      2016-11-23 23:24:19.000000000 +0000
+++ ocnews_api.cpp.new  2017-01-19 06:09:20.938444785 +0000
@@ -9,8 +9,19 @@
 #include <ocnews_api.h>
 #include <utils.h>
 
+#include <string>
+#include <sstream>
+
 #define OCNEWS_API "/index.php/apps/news/api/v1-2/"
 
+template <typename T>
+std::string to_string(T value)
+{
+    std::ostringstream os ;
+    os << value ;
+    return os.str() ;
+}
+
 namespace newsbeuter {
 
 typedef std::unique_ptr<json_object, decltype(*json_object_put)> json_uptr;

Change all occurrences:

--- src/src/ocnews_api.cpp      2017-01-19 06:10:04.654200465 +0000
+++ ocnews_api.cpp.new  2017-01-19 06:13:52.672833897 +0000
@@ -131,8 +131,8 @@
 bool ocnews_api::mark_all_read(const std::string& feedurl) {
        long id = known_feeds[feedurl].second;
 
-       std::string max = std::to_string(std::numeric_limits<long>::max());
-       std::string query = "feeds/" + std::to_string(id)
+       std::string max = to_string(std::numeric_limits<long>::max());
+       std::string query = "feeds/" + to_string(id)
                            + "/read?newestItemId=" + max;
 
        return this->query(query, nullptr, "{}");
@@ -170,8 +170,8 @@
        rsspp::feed feed = known_feeds[feed_id].first;
 
        std::string query = "items?";
-       query += "type="+std::to_string(known_feeds[feed_id].second != 0 ? 0 : 2);
-       query += "&id="+std::to_string(known_feeds[feed_id].second);
+       query += "type="+to_string(known_feeds[feed_id].second != 0 ? 0 : 2);
+       query += "&id="+to_string(known_feeds[feed_id].second);
 
        json_object* response;
        if (!this->query(query, &response))
@@ -214,7 +214,7 @@
                long f_id = json_object_get_int(node);
 
                json_object_object_get_ex(item_j, "guid", &node);
-               item.guid = std::to_string(id) + ":" + std::to_string(f_id)
+               item.guid = to_string(id) + ":" + to_string(f_id)
                            + "/" + json_object_get_string(node);
 
                json_object_object_get_ex(item_j, "unread", &node);
@@ -275,7 +275,7 @@
 
        if (res != CURLE_OK && res != CURLE_HTTP_RETURNED_ERROR) {
                std::string msg = "ocnews_api::query: connection error code ";
-               msg += std::to_string(res);
+               msg += to_string(res);
                LOG(level::CRITICAL, msg);
                return false;
        }

Now the build goes past this step, but fails to podbeuter. Tried excluding that step from the Makefile ... then ran into rather hard to parse error messages about LLVM:

external/compiler-rt/lib/profile/InstrProfilingFile.c:36: error: undefined reference to '__llvm_profile_gather_value_data'
external/compiler-rt/lib/profile/InstrProfilingFile.c:37: error: undefined reference to 'llvmWriteProfData'
external/compiler-rt/lib/profile/InstrProfiling.c:39: error: undefined reference to '__llvm_profile_begin_counters'
external/compiler-rt/lib/profile/InstrProfiling.c:40: error: undefined reference to '__llvm_profile_end_counters'
external/compiler-rt/lib/profile/InstrProfiling.c:44: error: undefined reference to '__llvm_profile_begin_data'
external/compiler-rt/lib/profile/InstrProfiling.c:45: error: undefined reference to '__llvm_profile_end_data'

Stuck for a bit, but hoping someone else may have ideas at this point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.