usrp-users@lists.ettus.com

Discussion and technical support related to USRP, UHD, RFNoC

View all threads

Making Custom Block pymodule_library

D
David
Fri, Jul 18, 2025 3:49 AM

Hello all,

I upgraded to UHD 4.8 and the new features have been great. Still exploring
a lot. I ran into an issue when trying to run make target
"pymodule_library". It errors with:

"/usr/bin/ld: cannot find -luhd: No such file or directory"

I traced this using remake to the build directory file
python/CMakeFiles/rfnoc_testmod_python.dir/link.text. The single line file
uses "-L/opt/uhd/lib/libuhd.so", and when I corrected it to
"-L/opt/uhd/lib/", the linker was able to find uhd and the make command
completed.

Any suggestions on fixing this issue? I have seen it in my test block above
and another custom block I ported to UHD 4.8.

Thanks,

David

Hello all, I upgraded to UHD 4.8 and the new features have been great. Still exploring a lot. I ran into an issue when trying to run make target "pymodule_library". It errors with: "/usr/bin/ld: cannot find -luhd: No such file or directory" I traced this using remake to the build directory file python/CMakeFiles/rfnoc_testmod_python.dir/link.text. The single line file uses "-L/opt/uhd/lib/libuhd.so", and when I corrected it to "-L/opt/uhd/lib/", the linker was able to find uhd and the make command completed. Any suggestions on fixing this issue? I have seen it in my test block above and another custom block I ported to UHD 4.8. Thanks, David
MB
Martin Braun
Fri, Jul 18, 2025 8:25 AM

David,

can you elaborate a bit how you got there? If you compile rfnoc-gain, do
you have the same issues?

--M

On Fri, Jul 18, 2025 at 5:50 AM David vitishlsfan21@gmail.com wrote:

Hello all,

I upgraded to UHD 4.8 and the new features have been great. Still
exploring a lot. I ran into an issue when trying to run make target
"pymodule_library". It errors with:

"/usr/bin/ld: cannot find -luhd: No such file or directory"

I traced this using remake to the build directory file
python/CMakeFiles/rfnoc_testmod_python.dir/link.text. The single line file
uses "-L/opt/uhd/lib/libuhd.so", and when I corrected it to
"-L/opt/uhd/lib/", the linker was able to find uhd and the make command
completed.

Any suggestions on fixing this issue? I have seen it in my test block
above and another custom block I ported to UHD 4.8.

Thanks,

David


USRP-users mailing list -- usrp-users@lists.ettus.com
To unsubscribe send an email to usrp-users-leave@lists.ettus.com

David, can you elaborate a bit how you got there? If you compile rfnoc-gain, do you have the same issues? --M On Fri, Jul 18, 2025 at 5:50 AM David <vitishlsfan21@gmail.com> wrote: > Hello all, > > I upgraded to UHD 4.8 and the new features have been great. Still > exploring a lot. I ran into an issue when trying to run make target > "pymodule_library". It errors with: > > "/usr/bin/ld: cannot find -luhd: No such file or directory" > > I traced this using remake to the build directory file > python/CMakeFiles/rfnoc_testmod_python.dir/link.text. The single line file > uses "-L/opt/uhd/lib/libuhd.so", and when I corrected it to > "-L/opt/uhd/lib/", the linker was able to find uhd and the make command > completed. > > Any suggestions on fixing this issue? I have seen it in my test block > above and another custom block I ported to UHD 4.8. > > Thanks, > > David > _______________________________________________ > USRP-users mailing list -- usrp-users@lists.ettus.com > To unsubscribe send an email to usrp-users-leave@lists.ettus.com >
D
David
Sat, Jul 19, 2025 12:33 AM

I am using Ubuntu 22.04, with cmake 3.22.1. I cloned UHD using the --branch
UHD-4.8 option. Using the rfnoc-gain from uhd/host/examples/rfnoc-gain, if
I run

cmake -DUHD_FPGA_DIR=$UHD_FPGA_DIR ..

in a build directory, and try to make the target pymodule_libary, I get the
following output:

[image: image.png]

It looks like the link.txt is the same, and I can get the target to build
in the same manner as I did in my custom blocks by removing the libuhd.so
from the -L option. I am not very familiar with CMake, so I am having
trouble finding what generates the link.txt.

I generated my custom blocks with rfnoc_modtool using create and add.

Thanks,

David

On Fri, Jul 18, 2025 at 1:26 AM Martin Braun martin.braun@ettus.com wrote:

David,

can you elaborate a bit how you got there? If you compile rfnoc-gain, do
you have the same issues?

--M

On Fri, Jul 18, 2025 at 5:50 AM David vitishlsfan21@gmail.com wrote:

Hello all,

I upgraded to UHD 4.8 and the new features have been great. Still
exploring a lot. I ran into an issue when trying to run make target
"pymodule_library". It errors with:

"/usr/bin/ld: cannot find -luhd: No such file or directory"

I traced this using remake to the build directory file
python/CMakeFiles/rfnoc_testmod_python.dir/link.text. The single line file
uses "-L/opt/uhd/lib/libuhd.so", and when I corrected it to
"-L/opt/uhd/lib/", the linker was able to find uhd and the make command
completed.

Any suggestions on fixing this issue? I have seen it in my test block
above and another custom block I ported to UHD 4.8.

Thanks,

David


USRP-users mailing list -- usrp-users@lists.ettus.com
To unsubscribe send an email to usrp-users-leave@lists.ettus.com


USRP-users mailing list -- usrp-users@lists.ettus.com
To unsubscribe send an email to usrp-users-leave@lists.ettus.com

I am using Ubuntu 22.04, with cmake 3.22.1. I cloned UHD using the --branch UHD-4.8 option. Using the rfnoc-gain from uhd/host/examples/rfnoc-gain, if I run cmake -DUHD_FPGA_DIR=$UHD_FPGA_DIR .. in a build directory, and try to make the target pymodule_libary, I get the following output: [image: image.png] It looks like the link.txt is the same, and I can get the target to build in the same manner as I did in my custom blocks by removing the libuhd.so from the -L option. I am not very familiar with CMake, so I am having trouble finding what generates the link.txt. I generated my custom blocks with rfnoc_modtool using create and add. Thanks, David On Fri, Jul 18, 2025 at 1:26 AM Martin Braun <martin.braun@ettus.com> wrote: > David, > > can you elaborate a bit how you got there? If you compile rfnoc-gain, do > you have the same issues? > > --M > > On Fri, Jul 18, 2025 at 5:50 AM David <vitishlsfan21@gmail.com> wrote: > >> Hello all, >> >> I upgraded to UHD 4.8 and the new features have been great. Still >> exploring a lot. I ran into an issue when trying to run make target >> "pymodule_library". It errors with: >> >> "/usr/bin/ld: cannot find -luhd: No such file or directory" >> >> I traced this using remake to the build directory file >> python/CMakeFiles/rfnoc_testmod_python.dir/link.text. The single line file >> uses "-L/opt/uhd/lib/libuhd.so", and when I corrected it to >> "-L/opt/uhd/lib/", the linker was able to find uhd and the make command >> completed. >> >> Any suggestions on fixing this issue? I have seen it in my test block >> above and another custom block I ported to UHD 4.8. >> >> Thanks, >> >> David >> _______________________________________________ >> USRP-users mailing list -- usrp-users@lists.ettus.com >> To unsubscribe send an email to usrp-users-leave@lists.ettus.com >> > _______________________________________________ > USRP-users mailing list -- usrp-users@lists.ettus.com > To unsubscribe send an email to usrp-users-leave@lists.ettus.com >
D
David
Sat, Jul 19, 2025 6:12 PM

I think I fixed it for the gain example in a way that is repeatable. In
uhd/host/examples/rfnoc-gain/python/CMakeLists.txt, I changed the
target_link_libraries on line 32 from:

target_link_libraries(
${PYMODULE_NAME}_python
PRIVATE
pybind11::pybind11
uhd
)

To:

target_link_libraries(
${PYMODULE_NAME}_python
PRIVATE
pybind11::pybind11
${UHD_LIBRARIES}
)

Since this CMakeLists.txt was generated by rfnoc_modtool, I ran
"rfnoc_modtool --log-level debug create test" and can see that the
CMakeLists.txt is copied out of my install directory:

/opt/uhd/share/uhd/rfnoc-newmod/python/CMakeLLists.txt

I changed the target_link_libraries() there as I did above, and creating a
new test module was able to build the pymodule_library target.

That is a sufficient fix for me.

Thanks,

David

On Fri, Jul 18, 2025 at 5:33 PM David vitishlsfan21@gmail.com wrote:

I am using Ubuntu 22.04, with cmake 3.22.1. I cloned UHD using the
--branch UHD-4.8 option. Using the rfnoc-gain from
uhd/host/examples/rfnoc-gain, if I run

cmake -DUHD_FPGA_DIR=$UHD_FPGA_DIR ..

in a build directory, and try to make the target pymodule_libary, I get
the following output:

[image: image.png]

It looks like the link.txt is the same, and I can get the target to build
in the same manner as I did in my custom blocks by removing the libuhd.so
from the -L option. I am not very familiar with CMake, so I am having
trouble finding what generates the link.txt.

I generated my custom blocks with rfnoc_modtool using create and add.

Thanks,

David

On Fri, Jul 18, 2025 at 1:26 AM Martin Braun martin.braun@ettus.com
wrote:

David,

can you elaborate a bit how you got there? If you compile rfnoc-gain, do
you have the same issues?

--M

On Fri, Jul 18, 2025 at 5:50 AM David vitishlsfan21@gmail.com wrote:

Hello all,

I upgraded to UHD 4.8 and the new features have been great. Still
exploring a lot. I ran into an issue when trying to run make target
"pymodule_library". It errors with:

"/usr/bin/ld: cannot find -luhd: No such file or directory"

I traced this using remake to the build directory file
python/CMakeFiles/rfnoc_testmod_python.dir/link.text. The single line file
uses "-L/opt/uhd/lib/libuhd.so", and when I corrected it to
"-L/opt/uhd/lib/", the linker was able to find uhd and the make command
completed.

Any suggestions on fixing this issue? I have seen it in my test block
above and another custom block I ported to UHD 4.8.

Thanks,

David


USRP-users mailing list -- usrp-users@lists.ettus.com
To unsubscribe send an email to usrp-users-leave@lists.ettus.com


USRP-users mailing list -- usrp-users@lists.ettus.com
To unsubscribe send an email to usrp-users-leave@lists.ettus.com

I think I fixed it for the gain example in a way that is repeatable. In uhd/host/examples/rfnoc-gain/python/CMakeLists.txt, I changed the target_link_libraries on line 32 from: target_link_libraries( ${PYMODULE_NAME}_python PRIVATE pybind11::pybind11 uhd ) To: target_link_libraries( ${PYMODULE_NAME}_python PRIVATE pybind11::pybind11 ${UHD_LIBRARIES} ) Since this CMakeLists.txt was generated by rfnoc_modtool, I ran "rfnoc_modtool --log-level debug create test" and can see that the CMakeLists.txt is copied out of my install directory: /opt/uhd/share/uhd/rfnoc-newmod/python/CMakeLLists.txt I changed the target_link_libraries() there as I did above, and creating a new test module was able to build the pymodule_library target. That is a sufficient fix for me. Thanks, David On Fri, Jul 18, 2025 at 5:33 PM David <vitishlsfan21@gmail.com> wrote: > I am using Ubuntu 22.04, with cmake 3.22.1. I cloned UHD using the > --branch UHD-4.8 option. Using the rfnoc-gain from > uhd/host/examples/rfnoc-gain, if I run > > cmake -DUHD_FPGA_DIR=$UHD_FPGA_DIR .. > > in a build directory, and try to make the target pymodule_libary, I get > the following output: > > [image: image.png] > > It looks like the link.txt is the same, and I can get the target to build > in the same manner as I did in my custom blocks by removing the libuhd.so > from the -L option. I am not very familiar with CMake, so I am having > trouble finding what generates the link.txt. > > I generated my custom blocks with rfnoc_modtool using create and add. > > Thanks, > > David > > > > On Fri, Jul 18, 2025 at 1:26 AM Martin Braun <martin.braun@ettus.com> > wrote: > >> David, >> >> can you elaborate a bit how you got there? If you compile rfnoc-gain, do >> you have the same issues? >> >> --M >> >> On Fri, Jul 18, 2025 at 5:50 AM David <vitishlsfan21@gmail.com> wrote: >> >>> Hello all, >>> >>> I upgraded to UHD 4.8 and the new features have been great. Still >>> exploring a lot. I ran into an issue when trying to run make target >>> "pymodule_library". It errors with: >>> >>> "/usr/bin/ld: cannot find -luhd: No such file or directory" >>> >>> I traced this using remake to the build directory file >>> python/CMakeFiles/rfnoc_testmod_python.dir/link.text. The single line file >>> uses "-L/opt/uhd/lib/libuhd.so", and when I corrected it to >>> "-L/opt/uhd/lib/", the linker was able to find uhd and the make command >>> completed. >>> >>> Any suggestions on fixing this issue? I have seen it in my test block >>> above and another custom block I ported to UHD 4.8. >>> >>> Thanks, >>> >>> David >>> _______________________________________________ >>> USRP-users mailing list -- usrp-users@lists.ettus.com >>> To unsubscribe send an email to usrp-users-leave@lists.ettus.com >>> >> _______________________________________________ >> USRP-users mailing list -- usrp-users@lists.ettus.com >> To unsubscribe send an email to usrp-users-leave@lists.ettus.com >> >
MB
Martin Braun
Mon, Jul 21, 2025 7:34 AM

Thanks for reporting back. We did fix this on UHD master around January
this year, but it seems to have missed the cutoff for 4.8 by a few days.
That means anyone working off of master branch, or anyone reading this in
the future and using a later stable release, will have the fix already.

--M

On Sat, Jul 19, 2025 at 8:12 PM David vitishlsfan21@gmail.com wrote:

I think I fixed it for the gain example in a way that is repeatable. In
uhd/host/examples/rfnoc-gain/python/CMakeLists.txt, I changed the
target_link_libraries on line 32 from:

target_link_libraries(
${PYMODULE_NAME}_python
PRIVATE
pybind11::pybind11
uhd
)

To:

target_link_libraries(
${PYMODULE_NAME}_python
PRIVATE
pybind11::pybind11
${UHD_LIBRARIES}
)

Since this CMakeLists.txt was generated by rfnoc_modtool, I ran
"rfnoc_modtool --log-level debug create test" and can see that the
CMakeLists.txt is copied out of my install directory:

/opt/uhd/share/uhd/rfnoc-newmod/python/CMakeLLists.txt

I changed the target_link_libraries() there as I did above, and creating a
new test module was able to build the pymodule_library target.

That is a sufficient fix for me.

Thanks,

David

On Fri, Jul 18, 2025 at 5:33 PM David vitishlsfan21@gmail.com wrote:

I am using Ubuntu 22.04, with cmake 3.22.1. I cloned UHD using the
--branch UHD-4.8 option. Using the rfnoc-gain from
uhd/host/examples/rfnoc-gain, if I run

cmake -DUHD_FPGA_DIR=$UHD_FPGA_DIR ..

in a build directory, and try to make the target pymodule_libary, I get
the following output:

[image: image.png]

It looks like the link.txt is the same, and I can get the target to build
in the same manner as I did in my custom blocks by removing the libuhd.so
from the -L option. I am not very familiar with CMake, so I am having
trouble finding what generates the link.txt.

I generated my custom blocks with rfnoc_modtool using create and add.

Thanks,

David

On Fri, Jul 18, 2025 at 1:26 AM Martin Braun martin.braun@ettus.com
wrote:

David,

can you elaborate a bit how you got there? If you compile rfnoc-gain, do
you have the same issues?

--M

On Fri, Jul 18, 2025 at 5:50 AM David vitishlsfan21@gmail.com wrote:

Hello all,

I upgraded to UHD 4.8 and the new features have been great. Still
exploring a lot. I ran into an issue when trying to run make target
"pymodule_library". It errors with:

"/usr/bin/ld: cannot find -luhd: No such file or directory"

I traced this using remake to the build directory file
python/CMakeFiles/rfnoc_testmod_python.dir/link.text. The single line file
uses "-L/opt/uhd/lib/libuhd.so", and when I corrected it to
"-L/opt/uhd/lib/", the linker was able to find uhd and the make command
completed.

Any suggestions on fixing this issue? I have seen it in my test block
above and another custom block I ported to UHD 4.8.

Thanks,

David


USRP-users mailing list -- usrp-users@lists.ettus.com
To unsubscribe send an email to usrp-users-leave@lists.ettus.com


USRP-users mailing list -- usrp-users@lists.ettus.com
To unsubscribe send an email to usrp-users-leave@lists.ettus.com

Thanks for reporting back. We did fix this on UHD master around January this year, but it seems to have missed the cutoff for 4.8 by a few days. That means anyone working off of master branch, or anyone reading this in the future and using a later stable release, will have the fix already. --M On Sat, Jul 19, 2025 at 8:12 PM David <vitishlsfan21@gmail.com> wrote: > I think I fixed it for the gain example in a way that is repeatable. In > uhd/host/examples/rfnoc-gain/python/CMakeLists.txt, I changed the > target_link_libraries on line 32 from: > > target_link_libraries( > ${PYMODULE_NAME}_python > PRIVATE > pybind11::pybind11 > uhd > ) > > To: > > target_link_libraries( > ${PYMODULE_NAME}_python > PRIVATE > pybind11::pybind11 > ${UHD_LIBRARIES} > ) > > Since this CMakeLists.txt was generated by rfnoc_modtool, I ran > "rfnoc_modtool --log-level debug create test" and can see that the > CMakeLists.txt is copied out of my install directory: > > /opt/uhd/share/uhd/rfnoc-newmod/python/CMakeLLists.txt > > I changed the target_link_libraries() there as I did above, and creating a > new test module was able to build the pymodule_library target. > > That is a sufficient fix for me. > > Thanks, > > David > > > > On Fri, Jul 18, 2025 at 5:33 PM David <vitishlsfan21@gmail.com> wrote: > >> I am using Ubuntu 22.04, with cmake 3.22.1. I cloned UHD using the >> --branch UHD-4.8 option. Using the rfnoc-gain from >> uhd/host/examples/rfnoc-gain, if I run >> >> cmake -DUHD_FPGA_DIR=$UHD_FPGA_DIR .. >> >> in a build directory, and try to make the target pymodule_libary, I get >> the following output: >> >> [image: image.png] >> >> It looks like the link.txt is the same, and I can get the target to build >> in the same manner as I did in my custom blocks by removing the libuhd.so >> from the -L option. I am not very familiar with CMake, so I am having >> trouble finding what generates the link.txt. >> >> I generated my custom blocks with rfnoc_modtool using create and add. >> >> Thanks, >> >> David >> >> >> >> On Fri, Jul 18, 2025 at 1:26 AM Martin Braun <martin.braun@ettus.com> >> wrote: >> >>> David, >>> >>> can you elaborate a bit how you got there? If you compile rfnoc-gain, do >>> you have the same issues? >>> >>> --M >>> >>> On Fri, Jul 18, 2025 at 5:50 AM David <vitishlsfan21@gmail.com> wrote: >>> >>>> Hello all, >>>> >>>> I upgraded to UHD 4.8 and the new features have been great. Still >>>> exploring a lot. I ran into an issue when trying to run make target >>>> "pymodule_library". It errors with: >>>> >>>> "/usr/bin/ld: cannot find -luhd: No such file or directory" >>>> >>>> I traced this using remake to the build directory file >>>> python/CMakeFiles/rfnoc_testmod_python.dir/link.text. The single line file >>>> uses "-L/opt/uhd/lib/libuhd.so", and when I corrected it to >>>> "-L/opt/uhd/lib/", the linker was able to find uhd and the make command >>>> completed. >>>> >>>> Any suggestions on fixing this issue? I have seen it in my test block >>>> above and another custom block I ported to UHD 4.8. >>>> >>>> Thanks, >>>> >>>> David >>>> _______________________________________________ >>>> USRP-users mailing list -- usrp-users@lists.ettus.com >>>> To unsubscribe send an email to usrp-users-leave@lists.ettus.com >>>> >>> _______________________________________________ >>> USRP-users mailing list -- usrp-users@lists.ettus.com >>> To unsubscribe send an email to usrp-users-leave@lists.ettus.com >>> >>