0

I have run the following codes to install TRNG:

mkdir build 
cd build 
cmake ..
make 
make install 

and I think the installation has been successful. when I run my program with this g++ -o 1.cpp -ltrng4 it says :

/usr/bin/ld: cannot find -ltrng4
collect2: error: ld returned 1 exit status

Can anyone help me with this?

2

libtrng4 is not a Ubuntu ubuntu package and your error indicates that its not installed..

Suggest you have a go at installing it from scratch:-

https://github.com/rabauke/trng4

Installation instructions are here:- https://github.com/rabauke/trng4/raw/master/doc/trng.pdf

git clone https://github.com/rabauke/trng4 
cd trng4
mkdir build
cd build
cmake ..
make
make install

If all of that worked then your compile line should be:-

g++ -o 1.cpp -L/usr/local/lib -ltrng4

19
  • I did several time with scratch following the commands found on this pdf
    – MA19
    Mar 22 at 8:43
  • Compilation of the TRNG library generates a static as well as a shared library unless TRNG is compiled in Visual Studio where only static libraries are supported by CMake. Depending on your system further steps might be necessary to make the TRNG shared library known to the dynamic linker. On a Linux system the system administrator has to call ldconfig or you might set the LD_LIBRARY_PATH environment variable. See also the ld.so man page for further information. Mar 22 at 8:46
  • What did you set your LD_LIBRARY_PATH to and does it match where your libtrng4.so or libtrng4.a file is installed? Mar 22 at 8:47
  • 1
    Do ls -l /usr/local/lib/ Mar 22 at 9:46
  • 1
    That's user your user doesn't have permission to install.. sudo make install Mar 22 at 10:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.