<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>These were the steps I was following, however I probably forgot
to install some packages/had mismatching packages from other
installations, after trying again on a fresh vm the above works.</p>
<p>As a follow up question, is there a way to install / include only
the libraries / headers necessary for the lustreapi?<br>
</p>
<p>For context, I am trying to add the lustreapi to another project
as a third-party dependency. I would like to only have the
necessary libraries/headers in a thirdparty/lib and
thirdparty/includes directory, instead of installing the deb
packages. For this I don't know whether the system where my
project is compiled is the one mounting the lustre fs (and thus
has the client installed) so I want to have only the absolute
necessary for compilation.<br>
</p>
<p>Thanks in advance,</p>
<p>Apostolis Stamatis</p>
<p><br>
</p>
<div class="moz-cite-prefix">On 11/7/24 02:04, Andreas Dilger wrote:<br>
</div>
<blockquote type="cite"
cite="mid:73D96BFB-103F-42E2-9667-C2274479DCC9@whamcloud.com">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
Why not build packages and install them properly? There are a few
pages on <a href="https://wiki.lustre.org/"
class="moz-txt-link-freetext" moz-do-not-send="true">
https://wiki.lustre.org/</a> for this (which should be updated
if they are missing some info), but the TLDR to build a client is
to run in the Lustre Git checkout tree:
<div class=""><br class="">
</div>
<div class=""> sh autogen.sh</div>
<div class=""> ./configure --disable-tests --disable-server</div>
<div class=""> make debs</div>
<div class=""><br class="">
</div>
<div class="">(or "make rpms" for RH/SLES) and then install the
resulting packages should work for most people if the
pre-compiled packages do not. This avoids copying the files
around, ensures that those files are cleaned up when new
packages are installed/removed, has proper dependencies, etc.</div>
<div class=""><br class="">
</div>
<div class="">Cheers, Andreas<br class="">
<div><br class="">
<blockquote type="cite" class="">
<div class="">On Jul 10, 2024, at 15:55, Apostolis Stamatis
via lustre-discuss <<a
href="mailto:lustre-discuss@lists.lustre.org"
class="moz-txt-link-freetext" moz-do-not-send="true">lustre-discuss@lists.lustre.org</a>>
wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div class="">Hello all,<br class="">
<br class="">
Sharing an update on this issue to help anyone in the
future encountering similar problems.<br class="">
<br class="">
The first solution I tried was to abandon the
installation from source and install the deb packages.
This fixed the issues with the linker and the compiler
and I was able to use the C api, because it put the
files on the default paths for gcc and ld. However, this
caused other issues when I went to mount the filesystem
(eg modprobe lustre not working), to my understanding
caused by the deb packages being built for a slightly
different kernel version.<br class="">
<br class="">
So this made me go back to installing from source and
building the deb packages myself. In order to fix my
path errors, I manually copied the required files to the
default paths used by gcc and ld. I understand this is
not necessary, as I can also add the paths when
compiling. However this made me wonder whether there is
a way to directly generate/copy the include
files/libraries on the system defaults ? Looked through
the docs but couldn't find anything on this.<br class="">
<br class="">
In any case, what I needed to copy for my use case
(there might be additional files for completeness which
I didn't need, not sure):<br class="">
<br class="">
cp lustre-release/lustre/include/lustre/*.h
/usr/include/lustre/<br class="">
<br class="">
cp lustre-release/lustre/include/uapi/linux/lustre/*.h
/usr/include/linux/lustre/<br class="">
<br class="">
cp lustre-release/debian/lustre-dev/usr/lib/* /usr/lib/<br
class="">
<br class="">
After that the simple `gcc test.c -llustreapi` worked<br
class="">
<br class="">
Thanks for the help, feel free to add anything you might
think is useful (potentially a better way to do what I
described)<br class="">
<br class="">
Regards,<br class="">
<br class="">
Apostolis<br class="">
<br class="">
<br class="">
On 4/7/24 19:13, Apostolis Stamatis via lustre-discuss
wrote:<br class="">
<blockquote type="cite" class="">Thanks for the help
Andreas, indeed installing the lustre-dev and
lustre-client-utils packages solved the issue with the
lustreapi library.<br class="">
<br class="">
However I am still getting an error:<br class="">
<br class="">
```<br class="">
<br class="">
/usr/bin/ld: /tmp/cceAX1ZW.o: in function `main':<br
class="">
test_file.c:(.text+0x37): undefined reference to
`llapi_file_create'<br class="">
collect2: error: ld returned 1 exit status<br class="">
<br class="">
```<br class="">
<br class="">
This leads me to believe I am doing something else
wrong (potentially with the includes?).<br class="">
<br class="">
Anyone with any input on what the issue might be or
alternatively the steps they have followed to use the
C lustre api?<br class="">
<br class="">
Cheers, Apostolis<br class="">
<br class="">
<br class="">
On 8/6/24 21:19, Andreas Dilger wrote:<br class="">
<blockquote type="cite" class="">On Jun 8, 2024, at
08:14, Apostolis Stamatis via lustre-discuss <<a
href="mailto:lustre-discuss@lists.lustre.org"
class="moz-txt-link-freetext"
moz-do-not-send="true">lustre-discuss@lists.lustre.org</a>>
wrote:<br class="">
<blockquote type="cite" class=""><br class="">
Hello everyone,<br class="">
<br class="">
I am trying to use the C api for lustre, using
Ubuntu 22.04, kernel version 5.15.0-107 and lustre
client modules version 2.15.4<br class="">
I am building lustre from source with the
following steps (removed some junk like git clone
and cd) (mainly from the guide
<a
href="https://metebalci.com/blog/lustre-2.15.4-on-rhel-8.9-and-ubuntu-22.04/"
class="moz-txt-link-freetext"
moz-do-not-send="true">
https://metebalci.com/blog/lustre-2.15.4-on-rhel-8.9-and-ubuntu-22.04/</a>)<br
class="">
</blockquote>
<br class="">
It would be great to copy this page to <a
href="http://wiki.lustre.org" class=""
moz-do-not-send="true">
wiki.lustre.org</a>. It is a bit ironic that this
page is mentioning that the wiki is outdated, but
then proceeds to not update the wiki with new
content...<br class="">
<br class="">
<blockquote type="cite" class="">```<br class="">
sudo apt install build-essential libtool
pkg-config flex bison libpython3-dev libmount-dev
libaio-dev libssl-dev libnl-genl-3-dev
libkeyutils-dev libyaml-dev libreadline-dev
module-assistant debhelper dpatch libsnmp-dev
mpi-default-dev quilt swig<br class="">
sh autogen.sh<br class="">
./configure --disable-server<br class="">
make dkms-debs<br class="">
sudo dpkg -i
debs/lustre-client-modules-dkms_2.15.4-1_amd64.deb<br
class="">
sudo apt --fix-broken install<br class="">
sudo dpkg -i
debs/lustre-client-utils_2.15.4-1_amd64.deb<br
class="">
```<br class="">
</blockquote>
<br class="">
<blockquote type="cite" class="">The client works as
expected and can mount and modify the filesystem.<br
class="">
However when I try to compile the sample program
using gcc v 11.4.0 with the command<br class="">
`gcc
-I/usr/src/lustre-client-modules-2.15.4/lustre/include
-I/usr/src/lustre-client-modules-2.15.4/lustre/include/uapi/
-I/usr/src/lustre-client-modules-2.15.4/lustre/include/lustre
-llustreapi test_file.c -o test`<br class="">
I get the error `/usr/bin/ld: cannot find
-llustreapi: No such file or directory`<br
class="">
<br class="">
After trying to find the lustreapi library
manually, indeed I can't seem to find it anywhere<br
class="">
</blockquote>
<br class="">
According to the most recent build on the b2_15
branch on Ununtu 22.04 <a
href="https://build.whamcloud.com/job/lustre-b2_15/87/arch=x86_64,build_type=client,distro=ubuntu2204,ib_stack=inkernel/"
class="moz-txt-link-freetext"
moz-do-not-send="true">
https://build.whamcloud.com/job/lustre-b2_15/87/arch=x86_64,build_type=client,distro=ubuntu2204,ib_stack=inkernel/</a>
<br class="">
<br class="">
There is a "lustre-dev" package built, and it looks
like that this would contain the library files,
"This package provides development libraries for the
Lustre filesystem."<br class="">
<br class="">
Cheers, Andreas<br class="">
</blockquote>
_______________________________________________<br
class="">
lustre-discuss mailing list<br class="">
<a href="mailto:lustre-discuss@lists.lustre.org"
class="moz-txt-link-freetext" moz-do-not-send="true">lustre-discuss@lists.lustre.org</a><br
class="">
<a class="moz-txt-link-freetext" href="http://lists.lustre.org/listinfo.cgi/lustre-discuss-lustre.org">http://lists.lustre.org/listinfo.cgi/lustre-discuss-lustre.org</a><br
class="">
</blockquote>
_______________________________________________<br
class="">
lustre-discuss mailing list<br class="">
<a href="mailto:lustre-discuss@lists.lustre.org"
class="moz-txt-link-freetext" moz-do-not-send="true">lustre-discuss@lists.lustre.org</a><br
class="">
<a class="moz-txt-link-freetext" href="http://lists.lustre.org/listinfo.cgi/lustre-discuss-lustre.org">http://lists.lustre.org/listinfo.cgi/lustre-discuss-lustre.org</a><br
class="">
</div>
</div>
</blockquote>
</div>
<br class="">
<div class="">
<div dir="auto"
style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"
class="">
<div dir="auto"
style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"
class="">
<div dir="auto"
style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"
class="">
<div dir="auto"
style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"
class="">
<div dir="auto"
style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"
class="">
<div dir="auto"
style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"
class="">
<div>Cheers, Andreas</div>
<div>--</div>
<div>Andreas Dilger</div>
<div>Lustre Principal Architect</div>
<div>Whamcloud</div>
<div><br class="">
</div>
<div><br class="">
</div>
<div><br class="">
</div>
</div>
</div>
</div>
</div>
</div>
<br class="Apple-interchange-newline">
</div>
<br class="Apple-interchange-newline">
<br class="Apple-interchange-newline">
</div>
<br class="">
</div>
</blockquote>
</body>
</html>