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

readpe: symbol lookup error: /usr/lib/libpe.so.1: undefined symbol: _ZGVdN4v_log2 #199

Closed
AkechiShiro opened this issue Oct 8, 2023 · 12 comments

Comments

@AkechiShiro
Copy link

Describe the bug
Installed readpe from the AUR, ran the command

To Reproduce
Please provide us with:

  • pev version : 0.82
  • OS version : ArchLinux
  • The file(s) you've analysed with pev : not needed
  • The command you've used with the files, with all the flags : readpe

Expected behavior
Should work

Additional context
Add any other context about the problem here.

@GoGoOtaku
Copy link
Collaborator

_ZGVdN4v_log2 is part of glibc or to be more precise it it is part of glibc's vector math library (libmvec.so)
To me this looks like a linking error. The compiler did properly optimize the code to AVX2 but the linker didn't get the memo. I am not sure how this would happen tbh but I look into it. I will spin up an arch VM sometime next week and try it for myself.

As an aside:
Am I right to assume that you are using x86/amd64 and glibc?
glibc is the default so unless you explicitly chose another C library it should be glibc.
Can you run ldd on your readpe? (ldd $(which readpe) should do it) and tell me libmvec.so is in the list?
Is your processor older than 2014? If it was around there could you try lscpu and check if avx2 is in the flags section?

@AkechiShiro
Copy link
Author

Yes I am using glibc and x86/amd64, glibc is the default, the only thing that could impact the glibc may be that I have nix installed as well and have paths for Nix in my PATH variable, not sure if Nix comes with it's own glibc

@AkechiShiro
Copy link
Author

@GoGoOtaku ldd output :

	linux-vdso.so.1 (0x00007ffca2d70000)
	libpe.so.1 => /usr/lib/libpe.so.1 (0x00007f6a68edf000)
	libc.so.6 => /usr/lib/libc.so.6 (0x00007f6a68cfd000)
	libcrypto.so.3 => /usr/lib/libcrypto.so.3 (0x00007f6a687ff000)
	/lib64/ld-linux-x86-64.so.2 => /usr/lib64/ld-linux-x86-64.so.2 (0x00007f6a68f45000)

@AkechiShiro
Copy link
Author

AkechiShiro commented Oct 11, 2023

Processor is not older than 2014 :

Architecture:            x86_64
  CPU op-mode(s):        32-bit, 64-bit
  Address sizes:         43 bits physical, 48 bits virtual
  Byte Order:            Little Endian
CPU(s):                  8
  On-line CPU(s) list:   0-7
Vendor ID:               AuthenticAMD
  Model name:            AMD Ryzen 7 PRO 3700U w/ Radeon Vega Mobile Gfx
    CPU family:          23
    Model:               24
    Thread(s) per core:  2
    Core(s) per socket:  4
    Socket(s):           1
    Stepping:            1
    Frequency boost:     enabled
    CPU(s) scaling MHz:  72%
    CPU max MHz:         2300.0000
    CPU min MHz:         1400.0000
    BogoMIPS:            4592.34

2017 Zen+ architecture on a T495 Thinkpad Lenovo latpop.
AVX2 is supported image

@AkechiShiro
Copy link
Author

AkechiShiro commented Oct 11, 2023

glibc version :

core/glibc 2.38-7 [0 B 47.33 MiB] [Installed]
    GNU C Library
core/lib32-glibc 2.38-7 [0 B 18.04 MiB] [Installed]
    GNU C Library (32-bit)

Glibc from Nix :
image

@GoGoOtaku
Copy link
Collaborator

I tried building it on a fresh vm and it looks like the PKGBUILD is working.

@GoGoOtaku ldd output :

	linux-vdso.so.1 (0x00007ffca2d70000)
	libpe.so.1 => /usr/lib/libpe.so.1 (0x00007f6a68edf000)
	libc.so.6 => /usr/lib/libc.so.6 (0x00007f6a68cfd000)
	libcrypto.so.3 => /usr/lib/libcrypto.so.3 (0x00007f6a687ff000)
	/lib64/ld-linux-x86-64.so.2 => /usr/lib64/ld-linux-x86-64.so.2 (0x00007f6a68f45000)

Seems like it didn't link against libm and libmvec on your system.
libm has been explicitly added to libpes Makefile and unless you link statically you don't need to add libmvec (which is only needed due to optimizations by the compiler anyway).

I'm frankly stumped. Did you have an old libpe?
I think I am mostly stumped. This commit isn't in the latest version.
a4d2fb1

Now afaik this shouldn't cause what you experience. (I could still run it in my VM after all)
If you have a more aggressive dependency cleaning setup that might cause it.

@AkechiShiro
Copy link
Author

AkechiShiro commented Oct 13, 2023

I'm using mold as a linker, maybe that's the issue ? And not the default linker @GoGoOtaku

@GoGoOtaku
Copy link
Collaborator

I could actually reproduce this error with mold. And it is indeed the missing -lm that the commit added. I don't know what the best workaround for you is for now but I will also probably release a new version in the not so distant future.

@AkechiShiro
Copy link
Author

AkechiShiro commented Oct 17, 2023

Thanks a lot for your help ! I will be waiting and test it once it's out

@AkechiShiro
Copy link
Author

Hi again @GoGoOtaku could I be of any help towards the new release ? I would just like to help fix this issue, I can work on a PR/do some tests if needed.

@GoGoOtaku
Copy link
Collaborator

I'm sorry for this taking so long.
I went to a hospital and even tho I took my laptop I didn't really have much time to maintain this repo.

I did make a new release now tho.

@AkechiShiro
Copy link
Author

Thanks a lot for the new release !
No worries on the time taken, it's alright !

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

No branches or pull requests

2 participants