<div dir="ltr">Hello,<div><br></div><div>thank you very much. It finally compiles. I have actually encountered the same StackOverflow post and tried it. However, because of the "paranoid=3" option (which I obviously did not know about), it did not work anyway, so changed it back to the original command.</div><div><br></div><div>Best regards</div><div>William</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Mar 20, 2020 at 9:36 PM Petr Tůma <<a href="mailto:petr.tuma@d3s.mff.cuni.cz">petr.tuma@d3s.mff.cuni.cz</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi,<br>
<br>
thanks! You're obviously right (we've had a similar issue some time ago but I completely forgot). I've updated the upstream Makefile, but since your repositories do not have tracking set up, it's probably best to just modify the Makefile in your clones as needed. Sorry about that.<br>
<br>
Petr<br>
<br>
<br>
On 20/03/2020 20:46, Karel Maděra wrote:<br>
> I had a similar problem, what helped was these StackOverflow question <a href="https://stackoverflow.com/questions/35897290/what-is-the-right-order-of-linker-flags-in-gcc" rel="noreferrer" target="_blank">https://stackoverflow.com/questions/35897290/what-is-the-right-order-of-linker-flags-in-gcc</a> and <a href="https://stackoverflow.com/questions/20731220/compile-error-gcc-lpthread-position" rel="noreferrer" target="_blank">https://stackoverflow.com/questions/20731220/compile-error-gcc-lpthread-position</a>.<br>
> <br>
> In a nutshell, try moving the -lpapi "option" to the last position,  so something like this:  $(CXX) $(CXXFLAGS) -O3 -Wall -o $@ counter-spinner.cpp harness.cpp -lpapi<br>
> <br>
> From what I understand (and i may be wrong on this), the -l option is processed as soon as it is encountered, so if it is used before mentioning the files that use the library, it is discarded.<br>
> So it s not really an option or switch of gcc, as the form -l would suggest, and more like a command.<br>
> It used to work on older gcc versions, but then they changed some default properties or something.<br>
> <br>
> Karel Maděra<br>
> ---------- Původní e-mail ----------<br>
> Od: Petr Tůma <<a href="mailto:petr.tuma@d3s.mff.cuni.cz" target="_blank">petr.tuma@d3s.mff.cuni.cz</a>><br>
> Komu: William Tatarko <<a href="mailto:william.tatarko@gmail.com" target="_blank">william.tatarko@gmail.com</a>><br>
> Datum: 20. 3. 2020 18:33:27<br>
> Předmět: Re: [NSWI131] 03-counter-spinner - papi problem<br>
> <br>
> <br>
>  Â  Â Hi,<br>
> <br>
>  Â  Â this is seriously weird :-) and in fact exactly the same error I get if I omit "-lpapi" from the command line. (Why it is weird is because from the log you have sent, it is clear that "-lpapi" is there, and if the library file was missing, GCC would display an error message saying "cannot find -lpapi".)<br>
> <br>
>  Â  Â What you can try to do is see what library file the "papi_avail" command uses, on my machine it is something like this:<br>
> <br>
>  Â  Â > ldd $(which papi_avail)<br>
>  Â  Â linux-vdso.so.1 (0x...)<br>
>  Â  Â libpapi.so.5 => /lib64/libpapi.so.5 (0x...)<br>
>  Â  Â ...<br>
> <br>
>  Â  Â This library obviously works, or the "papi_avail" command would not start. As the next step, you can try to use the library on the GCC command line directly:<br>
> <br>
>  Â  Â > g++ -O3 -Wall /lib64/libpapi.so.5 -o counter-spinner counter-spinner.cpp harness.cpp<br>
> <br>
>  Â  Â (Obviously, replace the library file name with whatever ldd shows on your system.)<br>
> <br>
>  Â  Â If this also fails, and you do not see any obvious permission issues on the files involved, then I would recommend to simply use a lab computer (remote access should work) otherwise you will waste too much time with this.<br>
> <br>
>  Â  Â Petr<br>
> <br>
> <br>
>  Â  Â On 20/03/2020 10:41, William Tatarko wrote:<br>
>  Â  Â > Hello,<br>
>  Â  Â ><br>
>  Â  Â > thank you very much for the answer, but I am still unable to make ti work.<br>
>  Â  Â ><br>
>  Â  Â > Initially I tried to install from the Git repository. From the src folder I ran "./configure", "make" and then I tried "make test", which resulted in "PASSED". Finally I ran "make install" with sudo, because otherwise I got a permission denied message. Later I also tried "make install-all" and papi versions 6.0 and 5.7 (which allegedly worked for a random person on the web). I also tried to install papi-tools using the "apt install" command (I am running Ubuntu).<br>
>  Â  Â ><br>
>  Â  Â > Command "papi_available" show no available events, which was suspicious. After I ran "papi_native_avail" I got a message that essentially said that with paranoid=3 it cannot work. This was weird, because I got this error message when I was installing papi for the first time and I had done what the error message had asked me to do, after which I have not seen this error message (until running "papi_native_avail"). Anyway, I executed "sudo sh -c 'echo -1 >/proc/sys/kernel/perf_event_paranoid" and then "papi_available" suddenly showed 59 available events and "papi_native_avail" stoped complaining. However the compilation still throws the same error (it is in the attachment).<br>
>  Â  Â ><br>
>  Â  Â > I believe it was initially installed (at least) into "/usr/local/lib/" directory. I tried to copy it also to different folders ("/lib/", "/lib64/", "/usr/lib/" and "/usr/lib64/") but it did not helped either. I also tried to explicitly set the path by modifying the compilation command to "$(CXX) $(CXXFLAGS) -O3 -Wall -L/usr/local/lib/ -lpapi -o $@ counter-spinner.cpp harness.cpp", but still no luck.<br>
>  Â  Â ><br>
>  Â  Â > Best regards<br>
>  Â  Â > William<br>
>  Â  Â ><br>
>  Â  Â > On Fri, Mar 20, 2020 at 8:09 AM Petr Tůma <<a href="mailto:petr.tuma@d3s.mff.cuni.cz" target="_blank">petr.tuma@d3s.mff.cuni.cz</a> <mailto:<a href="mailto:petr.tuma@d3s.mff.cuni.cz" target="_blank">petr.tuma@d3s.mff.cuni.cz</a>>> wrote:<br>
>  Â  Â ><br>
>  Â  Â > Hi,<br>
>  Â  Â ><br>
>  Â  Â > this sounds like a PAPI installation problem. It's hard to debug with little information, but these are the steps I would try (if they do not help, please include exact log of what commands you were running and what was the output):<br>
>  Â  Â ><br>
>  Â  Â > - Did you install using your distribution packages, or from the Git repository ? If the latter, did you do 'make install' ?<br>
>  Â  Â ><br>
>  Â  Â > - Do the 'papi_avail' and 'papi_native_avail' commands work, when launched from any directory (not just the build directory) ?<br>
>  Â  Â ><br>
>  Â  Â > - Do you have the PAPI library in your system default library path, e.g. /lib64/libpapi.so.* ?<br>
>  Â  Â ><br>
>  Â  Â > Hope this puts you on the right path, Petr<br>
>  Â  Â ><br>
>  Â  Â ><br>
>  Â  Â > On 19/03/2020 19:19, William Tatarko wrote:<br>
>  Â  Â > > Hello,<br>
>  Â  Â > ><br>
>  Â  Â > > I have some trouble with papi. I installed it without any problem (and even passed the original papi test). However when I try to run the make for the c++ version (without modifying the code at all) I got several errors like "undefined reference to `PAPI_*', where * is "stop", "start", "library_init" and many more. I also tried the java version (again without changing the code), but the run.sh script resulted in "error: PAPI library initialization: Invalid argument (-1)". I am probably doing something terribly wrong, but after about 4 hours of debugging I have not figured it out.<br>
>  Â  Â > ><br>
>  Â  Â > > Can anybody please help me?<br>
>  Â  Â > ><br>
>  Â  Â > > Best regards<br>
>  Â  Â > > William<br>
>  Â  Â > ><br>
>  Â  Â > > _______________________________________________<br>
>  Â  Â > > NSWI131 mailing list<br>
>  Â  Â > > <a href="mailto:NSWI131@d3s.mff.cuni.cz" target="_blank">NSWI131@d3s.mff.cuni.cz</a> <mailto:<a href="mailto:NSWI131@d3s.mff.cuni.cz" target="_blank">NSWI131@d3s.mff.cuni.cz</a>><br>
>  Â  Â > > <a href="https://d3s.mff.cuni.cz/mailman/listinfo/nswi131" rel="noreferrer" target="_blank">https://d3s.mff.cuni.cz/mailman/listinfo/nswi131</a><br>
>  Â  Â > ><br>
>  Â  Â ><br>
>  Â  Â _______________________________________________<br>
>  Â  Â NSWI131 mailing list<br>
>  Â  Â <a href="mailto:NSWI131@d3s.mff.cuni.cz" target="_blank">NSWI131@d3s.mff.cuni.cz</a><br>
>  Â  Â <a href="https://d3s.mff.cuni.cz/mailman/listinfo/nswi131" rel="noreferrer" target="_blank">https://d3s.mff.cuni.cz/mailman/listinfo/nswi131</a><br>
> <br>
> <br>
> _______________________________________________<br>
> NSWI131 mailing list<br>
> <a href="mailto:NSWI131@d3s.mff.cuni.cz" target="_blank">NSWI131@d3s.mff.cuni.cz</a><br>
> <a href="https://d3s.mff.cuni.cz/mailman/listinfo/nswi131" rel="noreferrer" target="_blank">https://d3s.mff.cuni.cz/mailman/listinfo/nswi131</a><br>
> <br>
_______________________________________________<br>
NSWI131 mailing list<br>
<a href="mailto:NSWI131@d3s.mff.cuni.cz" target="_blank">NSWI131@d3s.mff.cuni.cz</a><br>
<a href="https://d3s.mff.cuni.cz/mailman/listinfo/nswi131" rel="noreferrer" target="_blank">https://d3s.mff.cuni.cz/mailman/listinfo/nswi131</a><br>
</blockquote></div>