Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
The Razor-Qt Thread
View unanswered posts
View posts from last 24 hours

Goto page Previous  1, 2, 3, 4, 5, 6  
Reply to topic    Gentoo Forums Forum Index Desktop Environments
View previous topic :: View next topic  
Author Message
MarcoMarin
Tux's lil' helper
Tux's lil' helper


Joined: 12 Mar 2014
Posts: 135

PostPosted: Sun Apr 13, 2014 2:43 pm    Post subject: Reply with quote

or is \n'' the parameter and this is enclosed in 2 ' ? thus I'd have to escape them all like \'\n\'\'\' (with another one after this to account for the bash command of course)

I still don't understand this double '' inside, does tr expect this? Im trying to read on escaping in shell scripts but nothing specific on ' yet...
Back to top
View user's profile Send private message
TomWij
Developer
Developer


Joined: 04 Jul 2012
Posts: 1553

PostPosted: Sun Apr 13, 2014 2:48 pm    Post subject: Reply with quote

MarcoMarin wrote:
Did not get this or how it relates to the error message?

It might be that ( doesn't work in other shells; that's why I think Bash is needed, but I might be wrong.

MarcoMarin wrote:
ok, help me understand this, please.. '\n' is the parameter to tr, so both should be escaped.. \'\n\' .. right? what are those last 2 '' for? or is ' escaped by repeating it, like ''?


Quote:
$ bash -c 'echo first second | tr ' ' '\n''
tr: missing operand


One trick is to wrap the quote with alternating quotes twice; such that ' becomes ' " ' " ', without the spaces in between.

Quote:
$ bash -c 'echo first second | tr '"'"' '"'"' '"'"'\n'"'"''
first
second


Another is to get out of the quotes, then escape it, then get back in to the quotes; such that ' becomes ' \' ', without the spaces in between.

Quote:
$ bash -c 'echo first second | tr '\'' '\'' '\''\n'\'''
first
second


Not sure if that are all the tricks that exist, but these should be sufficient. This is only needed for single quotes ('); as with double quotes ("), you can just do \" between the ".
Back to top
View user's profile Send private message
MarcoMarin
Tux's lil' helper
Tux's lil' helper


Joined: 12 Mar 2014
Posts: 135

PostPosted: Sun Apr 13, 2014 3:18 pm    Post subject: Reply with quote

I believe I'm using bash, what is the default for gentoo installations?

I think the problem was that make was passing your command verbatum to g++ which would expect parameters with dashes and hit upon a (


about the escaping, thanks, I think I get it now. : ) Biggest problem was I didn't understand the tr command, now I see it expects 2 sets and the 2nd set was empty (i mean 1 space, but that confused me too :lol: )

But now that we digressed here, that last example last couple '' still confuses me (for a different reason now,lol).. after you placed the \n inside the string then you place 1 final ' into the string you wouldn't need to get back in the string, so the pattern '\'' dont need the last ', right? by doing this you enter the string again only to exit it (with the last ') but then wouldn't you miss the closing ' for the command? how come it works? :?
Back to top
View user's profile Send private message
TomWij
Developer
Developer


Joined: 04 Jul 2012
Posts: 1553

PostPosted: Sun Apr 13, 2014 3:29 pm    Post subject: Reply with quote

Yes, Bash is default. The last ' is needed because you want it to become tr '\n' ' '; that gets to be inside the quotes as 'tr '\n' ' '', and if you replace the ' inside by '\'' you get 'tr '\''\n'\'' '\'' '\'''.

Here is an example with # instead of ': tr #\n# # # --> #tr #\n# # ## --> #tr #\##\n#\## #\## #\###

The tr command just replaces the character of the first parameter by the second parameter; so, replacing '\n' by ' ' means that newlines will become spaces. Very useful to turn multiple lines into multiple parameters.
Back to top
View user's profile Send private message
MarcoMarin
Tux's lil' helper
Tux's lil' helper


Joined: 12 Mar 2014
Posts: 135

PostPosted: Sun Apr 13, 2014 3:44 pm    Post subject: Reply with quote

What I do not get is this.. we are going in and out of the command string which begins with echo, right? as in bash -c 'echo etc'

This last single quote (ending the string and thus the -c parameter) would be achieved after \n, but then our string would be missing a quote as in "... tr ' ' '\n ... "

.. we then add that one with \'... why isn't that enough? In fact, if I'm right it also explain why the command still works... i did not see this before but because the last 2 single quotes cancel each other.

inside the script I'd still have to close the parenthesis from $(bash -c ... so the line would end in \')

anyway, not important.. I'm about to test that version, brb with a report =)
Back to top
View user's profile Send private message
MarcoMarin
Tux's lil' helper
Tux's lil' helper


Joined: 12 Mar 2014
Posts: 135

PostPosted: Sun Apr 13, 2014 3:49 pm    Post subject: Reply with quote

The syntax worked, tested both versions are equivalent. But now we are back into the undefined reference problem :(

Code:

# make BDB_INCLUDE_PATH=/usr/include/db4.8/ BOOST_INCLUDE_PATH=/usr/include/boost/ -f makefile.unix
...
[snip #same output]
...
/usr/include/boost/thread/pthread/condition_variable_fwd.hpp:181: undefined reference to `boost::chrono::steady_clock::now()'
collect2: error: ld returned 1 exit status


Edit: Wait a second.. the syntax worked but the command doesn't seem to be outputting anything...
Edit 2: Confirmed, it is outputting a blank space :?


Last edited by MarcoMarin on Sun Apr 13, 2014 3:56 pm; edited 1 time in total
Back to top
View user's profile Send private message
TomWij
Developer
Developer


Joined: 04 Jul 2012
Posts: 1553

PostPosted: Sun Apr 13, 2014 3:56 pm    Post subject: Reply with quote

Do you see the list we've just added in the linker calls in the output? Do you have the boost chrono library? Does it contain these functions?

There is steady_* in my library:

Quote:
$ readelf -a /usr/lib/libboost_chrono.so | grep steady
87: 0000000000003390 38 FUNC GLOBAL DEFAULT 10 _ZN5boost6chrono12steady_
95: 0000000000003470 172 FUNC GLOBAL DEFAULT 10 _ZN5boost6chrono12steady_


This is with Boost 1.55.0-r1; dunno about other versions, it can be found in the documentation of the certain version you have installed whether that version has that function.
Back to top
View user's profile Send private message
MarcoMarin
Tux's lil' helper
Tux's lil' helper


Joined: 12 Mar 2014
Posts: 135

PostPosted: Sun Apr 13, 2014 4:02 pm    Post subject: Reply with quote

Yep.. Sorry, the problem seem to be the $(bash -c '...') thing... I place a testing string to break the command on either side, and it produces nothing: (but it doesnt break the code either, the 2nd break still prints)
Code:

...[snip]...obj/checkpointsync.o -Wl,-z,relro -Wl,-z,now   break  break -Wl,-Bdynamic -l boost_system -l boost_filesystem -l ...[snip]...
g++: error:break: No such file or directory
g++: error:break: No such file or directory


Yes, here is the output:
Code:
# readelf -a /usr/lib/libboost_chrono.so | grep steady
    69: 0000000000003dc0    38 FUNC    GLOBAL DEFAULT   11 _ZN5boost6chrono12steady_
   115: 0000000000003df0   173 FUNC    GLOBAL DEFAULT   11 _ZN5boost6chrono12steady_


Edit: Our escaping adventures didn't pay off :oops: tr is getting a whole bunch of slashes...
Edit 2 Thats very confusing, I trying the command directly on the shell (it is indeed the escaping is off :cry: ), but the funny part is that it seems to get everything right, but the first single quote! then if I mess with stuff before the \n, it get's slashes after the \n.. look:

Code:
( echo -L/usr/lib/ ; cd /usr/lib/ ; for lib in libboost_* ; do echo -l${lib/.so*/} ; done ) | tr '\''\n'\'' '\'' '\'''
tr: missing operand after ‘\\\\n' ' '’
Two strings must be given when translating.

#( echo -L/usr/lib/ ; cd /usr/lib/ ; for lib in libboost_* ; do echo -l${lib/.so*/} ; done ) | tr ''\n'\'' '\'' '\'
tr: missing operand after ‘n\\ ' '’


Last edited by MarcoMarin on Sun Apr 13, 2014 4:22 pm; edited 1 time in total
Back to top
View user's profile Send private message
TomWij
Developer
Developer


Joined: 04 Jul 2012
Posts: 1553

PostPosted: Sun Apr 13, 2014 4:18 pm    Post subject: Reply with quote

MarcoMarin wrote:
Code:

...[snip]...obj/checkpointsync.o -Wl,-z,relro -Wl,-z,now   break  break -Wl,-Bdynamic -l boost_system -l boost_filesystem -l ...[snip]...


Apart from the intentional breakage; that looks good, but where did the -L/usr/lib/ parameter go?


Last edited by TomWij on Sun Apr 13, 2014 5:34 pm; edited 1 time in total
Back to top
View user's profile Send private message
MarcoMarin
Tux's lil' helper
Tux's lil' helper


Joined: 12 Mar 2014
Posts: 135

PostPosted: Sun Apr 13, 2014 4:26 pm    Post subject: Reply with quote

TomWij wrote:

Apart from the intentional breakage; that looks good, but where did the -L /usr/lib/ parameter go?


It's being eaten by tr as tribute for my lack of escaping skillz :lol: (more details on the edits above)

edit btw, I could simply use the double quotes example you gave, it's probably safer.. but aren't you curious why this does not work? : )
edit 2: Just realized my tests above are invalid, they doesnt tell us much because I'm not inside a string to escape out of, as i am when inside $(bash -c '... sorry :(
edit 3 ok, fixed my meta-mistake, placed inside a script by itself.. here is the true output
Code:
# ./test.sh
tr: missing operand after ‘n  ’
That's more informative, It is not getting the single quotes in... :?
Edit 4:Please ignore edit 3, it was one of the many tests i used, not the "official" string.. here is the output
Code:
# ./test.sh
./test.sh: line 1: -L/usr/lib/: No such file or directory

Which is weird because it prints the -L/usr/lib ! :?


Last edited by MarcoMarin on Sun Apr 13, 2014 4:50 pm; edited 1 time in total
Back to top
View user's profile Send private message
TomWij
Developer
Developer


Joined: 04 Jul 2012
Posts: 1553

PostPosted: Sun Apr 13, 2014 4:43 pm    Post subject: Reply with quote

MarcoMarin wrote:
( echo -L/usr/lib/ ; cd /usr/lib/ ; for lib in libboost_* ; do echo -l${lib/.so*/} ; done ) | tr '\''\n'\'' '\'' '\'''


Regarding your edits above, the bash -c ' at the beginning is missing which makes it complain about the extra ' at the end; just adding it to the beginning, this works:

Quote:
bash -c '( echo -L/usr/lib/ ; cd /usr/lib/ ; for lib in libboost_* ; do echo -l${lib/.so*/} ; done ) | tr '\''\n'\'' '\'' '\'''


Gives the same big example block I gave earlier.

MarcoMarin wrote:
btw, I could simply use the double quotes example you gave


If you do that, you need to escape the \ of \n; granted, it is somewhat easier, note the double backslash:

Quote:
bash -c '( echo -L/usr/lib/ ; cd /usr/lib/ ; for lib in libboost_* ; do echo -l${lib/.so*/} ; done ) | tr "\\n" " "'


It is less common for me to type it this way, given that " usually denote strings whereas ' denote characters in programming languages; in languages and Bash and JS, I don't really know what is expected given that both are often possible.
Back to top
View user's profile Send private message
MarcoMarin
Tux's lil' helper
Tux's lil' helper


Joined: 12 Mar 2014
Posts: 135

PostPosted: Sun Apr 13, 2014 4:54 pm    Post subject: Reply with quote

Indeed! it works! \o/

Which means it is the $(bash inside the makefile itself! (as my first prophetic error report unkowningly predicted... I was mistaken to think it had to be the escaping though)


hmmm.. would you mind helping figure out why? or should I just go with the double quotes? =)
Back to top
View user's profile Send private message
MarcoMarin
Tux's lil' helper
Tux's lil' helper


Joined: 12 Mar 2014
Posts: 135

PostPosted: Sun Apr 13, 2014 5:12 pm    Post subject: Reply with quote

the only thing I managed to discover is that spaces between variables and their values can break this...

I tried TEST123=$(bash -c 'etc') and it worked... with TEST123 =$... it tries to execute TEST123 (funny though, in the makefile it uses spaces! :? ).. then TEST123= $... it prints -L/usr/lib/, but also thinks it's a command and stops there because it's not a file or dir...
enclosing the = with spaces, just like the makefile manages to do, gives the same output as the first error above with 1 space before =...

I'm going for double quotes then... =/

edit oh, before i do that, i could simply use an intermediate variable! :idea: lets see...
edit 2 I think I know what's going on.. make doesn't seem to want to execute stuff.. I tried placing it in a variable of it's own, then I even separated the LIBS assignment with LIBS += $(INTERM) in a line of it's own, no luck either.. the only option now is hardcoding :oops:
Back to top
View user's profile Send private message
MarcoMarin
Tux's lil' helper
Tux's lil' helper


Joined: 12 Mar 2014
Posts: 135

PostPosted: Sun Apr 13, 2014 5:29 pm    Post subject: Reply with quote

ok.. hardcoded in.. this problem is history.

but now g++ doesn't even begin to compile though, for each and every one of the libs I hardcoded in (at least it got through this time :) ) it complains of not finding:

Code:
/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/../../../../x86_64-pc-linux-gnu/bin/ld: cannot find -llibboost_chrono-mt

There is 1 line like this for each one.. (those four ../ looks suspicious).. but now it is g++(or the linker) itself and not a ilne inside the application being compiled... :?
Back to top
View user's profile Send private message
TomWij
Developer
Developer


Joined: 04 Jul 2012
Posts: 1553

PostPosted: Sun Apr 13, 2014 5:33 pm    Post subject: Reply with quote

Remember from above, it is probably still a missing -L/usr/lib/

For -L, the man page contains no space between L and /; it might be that it doesn't work with a space in between.
Back to top
View user's profile Send private message
MarcoMarin
Tux's lil' helper
Tux's lil' helper


Joined: 12 Mar 2014
Posts: 135

PostPosted: Sun Apr 13, 2014 5:39 pm    Post subject: Reply with quote

Hardcoded it in, no spaces between...

went looking for it in the output itself (it's there) but look what I found right at the beginning (dunno if relevant but):

Code:
/bin/sh ../share/genbuild.sh obj/build.h
which: no git in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin:/usr/x86_64-pc-linux-gnu/gcc-bin/4.7.3)


what is git? why it isn't there in the paths? lol... maybe that's why it can't find anything without guidance?

if this is not relevant than I'm stuck with the problem above, it can't find the hardcoded libs...

edit here:
Code:
.....-z,now   -L/usr/lib/ -llibboost_chrono-mt -llibboost_chrono -llibboost_chrono -llibboost_date_time-mt -llibboost_date_time .....
Back to top
View user's profile Send private message
TomWij
Developer
Developer


Joined: 04 Jul 2012
Posts: 1553

PostPosted: Sun Apr 13, 2014 5:46 pm    Post subject: Reply with quote

Ah, a mistake of me; you need to remove "lib" from the file name. So, in the command echo -l${lib/.so*/} becomes echo -l${lib/.so*/} | sed 's:^-llib:-l:'; alternatively, just manually replace -llib by -l. For example, -llibtest -llibtest2 becomes -ltest -ltest2.
Back to top
View user's profile Send private message
MarcoMarin
Tux's lil' helper
Tux's lil' helper


Joined: 12 Mar 2014
Posts: 135

PostPosted: Sun Apr 13, 2014 5:57 pm    Post subject: Reply with quote

Noway I'm doing that manually :lol:

It works! \o/

We're down to 2 problematic ones now:
Code:
/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/../../../../x86_64-pc-linux-gnu/bin/ld: cannot find -lboost_exception.a
/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/../../../../x86_64-pc-linux-gnu/bin/ld: cannot find -lboost_test_exec_monitor.a
collect2: error: ld returned 1 exit status
Back to top
View user's profile Send private message
TomWij
Developer
Developer


Joined: 04 Jul 2012
Posts: 1553

PostPosted: Sun Apr 13, 2014 6:38 pm    Post subject: Reply with quote

You can remove those, that are the .a files which aren't the libraries themselves; in the original command, this can be solved by replacing libboost_* by libboost_*.so such that it only takes the .so files.
Back to top
View user's profile Send private message
MarcoMarin
Tux's lil' helper
Tux's lil' helper


Joined: 12 Mar 2014
Posts: 135

PostPosted: Sun Apr 13, 2014 6:42 pm    Post subject: Reply with quote

oh.. this is ameanable to manual tinkering ^_^

wow.... it.. finished!

will that concoction explode my computer? lol... testing... :lol:
Back to top
View user's profile Send private message
MarcoMarin
Tux's lil' helper
Tux's lil' helper


Joined: 12 Mar 2014
Posts: 135

PostPosted: Sun Apr 13, 2014 6:55 pm    Post subject: Reply with quote

Seems to be working... copied over to a user's home account (dunno if it would work compiling as non-root.. was this unwise? lol).. didn't complain about anything (it is the executable alone), simply worked (then quitted due to some configuration problem, but it shows it works!)

Thanks TomWij!!! Really appreciate all the help! :D

Now the last step, compiling the Qt gui! Gonna give it a rest then read the readme for it, then report back what happens : )

thanks!
Back to top
View user's profile Send private message
MarcoMarin
Tux's lil' helper
Tux's lil' helper


Joined: 12 Mar 2014
Posts: 135

PostPosted: Sun Apr 13, 2014 8:16 pm    Post subject: Reply with quote

It worked! \o/ 8)

Just a re-run of the same problems (and respective fixes :wink: thx!).. it probably compiles the daemon in as well, so it doesn't need to call the previous executable... (edit: except that the daemon is almost 60MB and the qt version is 10.8MB :? )

Anyway, awesome, took a while, about 2 months to set this box for this purpose but I learned a lot, thanks all. : )

A few strange, hopefully innocuous, stuff with this QT version of the wallet, Tom:

1) I tried running simply as #feathercoin-qt , it complained about miniupnp, not finding.. I was getting ready for another session here, when I tried ./feathercoin-qt and it worked! This probably means a previous experiment with that .deb package is in the system and I must remove it...

2) Just now it is synchronizing with the FTC network, then it pops up a warning which did not happen with LTC (same box, it is in portage though, so it was easier to get it working), nor did it ever happened before with BTC either (other machine though). The warning said to check the machine's clock or it would not work properly if it was wrong. But the clock is perfectly fine. If this pops up again, I'll begin to worry. lol

I'm probably too inexperienced to do it myself, but I hope our experience here in this thread can be of help to place the FTC client on portage together with LTC.

Thanks again. : )
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Desktop Environments All times are GMT
Goto page Previous  1, 2, 3, 4, 5, 6
Page 6 of 6

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum