Reputation: 57
I'm trying to find value of huge page size using gethugepagesize()
function. I found out that hugetlbfs.h
library has to be included. When I included the header I got compile error:
Fatal error: hugetlbfs.h: No such file or directory
When I skip including library file and call the function, I get linker error as
undefined reference to `gethugepagesize'
I looked through the post How to get the value of huge page size?. I couldn't get the solution of the post working.
Am I missing something?
Upvotes: 1
Views: 2650
Reputation: 1
Try searching for the version of installed libhugetlbfs
rpm -qa | grep -i huge
libhugetlbfs-2.20-8.fc29.x86_64
libhugetlbfs-utils-2.20-8.fc29.x86_64
Then Install the same version of libhugetlbfs dev library.
sudo yum install libhugetlbfs-devel-2.20-8.fc29.x86_64
Upvotes: 0
Reputation: 102256
I get linker error as "undefined reference to `gethugepagesize'" ... Am I missing something?
According to dnf
, libhugetlbfs
is not provided by Fedora 31.
$ dnf provides 'hugetlbfs.h'
Error: No Matches found
$ dnf provides libhugetlbfs
Error: No Matches found
It looks like you may need to download libhugetlbfs
from their repo for Fedora. The old repo is at Sourceforge. The new repo is at GitHub | libhugetlbfs.
According to apt-file
, libhugetlbfs
is provided by Ubuntu 18. For Ubuntu the header file appears to be part of kernel headers. It looks like the library is part of the libhugetlbfs-dev
package on Ubuntu.
$ apt-file find hugetlbfs.h
libhugetlbfs-dev: /usr/include/hugetlbfs.h
linux-headers-4.15.0-1050-oem: /usr/src/linux-headers-4.15.0-1050-oem/include/config/hugetlbfs.h
linux-headers-4.15.0-1059-oem: /usr/src/linux-headers-4.15.0-1059-oem/include/config/hugetlbfs.h
linux-headers-4.15.0-1065-oem: /usr/src/linux-headers-4.15.0-1065-oem/include/config/hugetlbfs.h
...
Also see gethugepagesizes(3)
man page and the project's HOWTO.
I'm trying to find value of huge page size using gethugepagesize() function ...
From my reading of the man page, it looks like libhugetlbfs
is part of a virtual file system. It may not do what you think (if you are thinking large page sizes on x86 cpu's). But I may be wrong since I have never used the library.
Upvotes: 1