[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [Debian-med-packaging] C++ help needed for centrifuge



Le 27/11/2017 à 00:39, Alexis Murzeau a écrit :
> Hi,
> 
> Le 26/11/2017 à 22:01, Fabian Klötzl a écrit :
>> Ho,
>>
>> On 26.11.2017 19:32, Walter Landry wrote:
>>> Andreas Tille <andreas@an3as.eu> wrote:
>>>> Unfortunately I've hit another issue:
>>>>
>>>> ...
>>>> classifier.h:428:54: error: the value of 'rank' is not usable in a constant expression
>>>>                      while((uint8_t)_hitMap[i].rank < rank) {
>>>>                                                       ^~~~
>>>> classifier.h:424:21: note: 'uint8_t rank' is not const
>>>>              uint8_t rank = 0;
>>>>                      ^~~~
>>>
>>> That is mysterious to me.  Is that the first error?
>>>
>>
>> That reminds me of an error where the `<` was mistaken for the opening
>> angle brackets of a template. Flipping the order of the comparison or
>> adding some extra parentheses might help.
> 
> Indeed, it seems gcc understand rank as std::rank, and maybe is trying
> to read _hitMap[i].std::rank<rank> ("using namespace std" is used,
> "rank" can also reference std::rank).
> 
> Reversing the order works: "while(rank > _hitMap[i].rank)".
> Removing "using namespace std" is probably a better long-term solution
> for upstream.
> 
> As a side note, I found the package to not build on 32 bits linux
> because the ASM instruction "popcntq" doesn't exists. To avoid that
> error, I used "export POPCNT_CAPABILITY=0" in debian/rules.
> But I'm not sure this program is designed to run with less than 2GB of
> memory anyway :) This flag is needed anyway if you want your package to
> build for non-amd64 architecture.
> 
> I got a deb file after the following modifications:
>  - Reversing the while condition (as said above)
>  - Patching Makefile to take into account the DESTDIR variable, used by
> Debian packaging scripts to set the target directory where to install
> and uninstall files (that is, $(DESTDIR)$(prefix) instead of just $(prefix))
>  - Add a dh_auto_install override to set "prefix" to /usr instead of
> default /usr/local
> 
> And the generated .deb got several lintian warnings/errors:
> W: centrifuge: wrong-bug-number-in-closes l3:#xxx
> W: centrifuge: new-package-should-close-itp-bug
> W: centrifuge: script-with-language-extension
> usr/bin/centrifuge-BuildSharedSequence.pl
> W: centrifuge: script-with-language-extension
> usr/bin/centrifuge-RemoveEmptySequence.pl
> W: centrifuge: script-with-language-extension usr/bin/centrifuge-RemoveN.pl
> W: centrifuge: script-with-language-extension usr/bin/centrifuge-compress.pl
> W: centrifuge: script-with-language-extension usr/bin/centrifuge-sort-nt.pl
> W: centrifuge: binary-without-manpage usr/bin/centrifuge
> W: centrifuge: binary-without-manpage
> usr/bin/centrifuge-BuildSharedSequence.pl
> W: centrifuge: binary-without-manpage
> usr/bin/centrifuge-RemoveEmptySequence.pl
> W: centrifuge: binary-without-manpage usr/bin/centrifuge-RemoveN.pl
> W: centrifuge: binary-without-manpage usr/bin/centrifuge-build
> W: centrifuge: binary-without-manpage usr/bin/centrifuge-build-bin
> W: centrifuge: binary-without-manpage usr/bin/centrifuge-class
> W: centrifuge: binary-without-manpage usr/bin/centrifuge-compress.pl
> W: centrifuge: binary-without-manpage usr/bin/centrifuge-download
> W: centrifuge: binary-without-manpage usr/bin/centrifuge-inspect
> W: centrifuge: binary-without-manpage usr/bin/centrifuge-inspect-bin
> W: centrifuge: binary-without-manpage usr/bin/centrifuge-sort-nt.pl
> E: centrifuge: python-script-but-no-python-dep usr/bin/centrifuge-build
> E: centrifuge: python-script-but-no-python-dep usr/bin/centrifuge-inspect
> W: centrifuge: script-not-executable
> usr/share/centrifuge/doc/strip_markdown.pl
> 
> So there is still some work to do after that ^^
> 
>>
>> I will do some more investigation, tomorrow.
>>
>> Fabian
>>
> 

I attached a dirty patch so you can see exactly what I have modified to
fix errors.

-- 
Alexis Murzeau
PGP: B7E6 0EBB 9293 7B06 BDBC  2787 E7BD 1904 F480 937F
diff --git a/debian/patches/0002-Fix-build-with-rank.patch b/debian/patches/0002-Fix-build-with-rank.patch
new file mode 100644
index 0000000..6e29a9c
--- /dev/null
+++ b/debian/patches/0002-Fix-build-with-rank.patch
@@ -0,0 +1,21 @@
+From: Alexis Murzeau <amubtdx@gmail.com>
+Date: Mon, 27 Nov 2017 00:04:21 +0100
+Subject: Fix build with rank
+
+---
+ classifier.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/classifier.h b/classifier.h
+index f61a7f0..13b110b 100644
+--- a/classifier.h
++++ b/classifier.h
+@@ -425,7 +425,7 @@ public:
+             while(_hitMap.size() > (size_t)rp.khits) {
+                 _hitTaxCount.clear();
+                 for(size_t i = 0; i < _hitMap.size(); i++) {
+-                    while(_hitMap[i].rank < rank) {
++                    while(rank > _hitMap[i].rank) {
+                         if(_hitMap[i].rank + 1 >= _hitMap[i].path.size()) {
+                             _hitMap[i].rank = std::numeric_limits<uint8_t>::max();
+                             break;
diff --git a/debian/patches/0003-Fix-make-install-DESTDIR.patch b/debian/patches/0003-Fix-make-install-DESTDIR.patch
new file mode 100644
index 0000000..7b2fe17
--- /dev/null
+++ b/debian/patches/0003-Fix-make-install-DESTDIR.patch
@@ -0,0 +1,41 @@
+From: Alexis Murzeau <amubtdx@gmail.com>
+Date: Mon, 27 Nov 2017 00:14:09 +0100
+Subject: Fix make install DESTDIR
+
+---
+ Makefile | 16 ++++++++--------
+ 1 file changed, 8 insertions(+), 8 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index 8d66b3c..1889b09 100644
+--- a/Makefile
++++ b/Makefile
+@@ -412,20 +412,20 @@ prefix=/usr/local
+ 
+ .PHONY: install
+ install: all
+-	mkdir -p $(prefix)/bin
+-	mkdir -p $(prefix)/share/centrifuge/indices
+-	install -m 0644 indices/Makefile $(prefix)/share/centrifuge/indices
+-	install -d -m 0755 $(prefix)/share/centrifuge/doc
+-	install -m 0644 doc/* $(prefix)/share/centrifuge/doc
++	mkdir -p $(DESTDIR)$(prefix)/bin
++	mkdir -p $(DESTDIR)$(prefix)/share/centrifuge/indices
++	install -m 0644 indices/Makefile $(DESTDIR)$(prefix)/share/centrifuge/indices
++	install -d -m 0755 $(DESTDIR)$(prefix)/share/centrifuge/doc
++	install -m 0644 doc/* $(DESTDIR)$(prefix)/share/centrifuge/doc
+ 	for file in $(CENTRIFUGE_BIN_LIST) $(CENTRIFUGE_SCRIPT_LIST); do \
+-		install -m 0755 $$file $(prefix)/bin ; \
++		install -m 0755 $$file $(DESTDIR)$(prefix)/bin ; \
+ 	done
+ 
+ .PHONY: uninstall
+ uninstall: all
+ 	for file in $(CENTRIFUGE_BIN_LIST) $(CENTRIFUGE_SCRIPT_LIST); do \
+-		rm -v $(prefix)/bin/$$file ; \
+-		rm -v $(prefix)/share/centrifuge; \
++		rm -v $(DESTDIR)$(prefix)/bin/$$file ; \
++		rm -v $(DESTDIR)$(prefix)/share/centrifuge; \
+ 	done
+ 
+ 
diff --git a/debian/patches/series b/debian/patches/series
index a0e148b..15bbdf8 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,3 @@
 fix_auto_ptr_usage_in_gcc-7.patch
+0002-Fix-build-with-rank.patch
+0003-Fix-make-install-DESTDIR.patch
diff --git a/debian/rules b/debian/rules
index f01a354..14450ed 100755
--- a/debian/rules
+++ b/debian/rules
@@ -3,6 +3,9 @@
 # DH_VERBOSE := 1
 
 export DEB_BUILD_MAINT_OPTIONS = hardening=+all
-
+export POPCNT_CAPABILITY=0
 %:
 	dh $@
+
+override_dh_auto_install:
+	dh_auto_install -- prefix=/usr

Attachment: signature.asc
Description: OpenPGP digital signature


Reply to: