On Wed, Sep 15, 2021 at 6:39 PM Samyukta Yagati <sa...@berkeley.edu> wrote:
>
> I installed Crypto++ from source as follows:
>
> git clone https://github.com/weidai11/cryptopp.git
> cd cryptopp
> Uncommented the CXX flag line in GNUmakefile that adds "-stdlib=libc++" 
> because I am using XCode.
> make -j 8 (8 = value of $(nproc) on my machine if it were linux)
> sudo make install
>
> The make and install complete without errors. I confirmed that /usr/local/lib 
> contains libcryptopp.a.
>
> When I try to use libcryptopp in a project (in a different directory from the 
> cryptopp install), clang (Apple Clang 12.0.0) can't find it. I get the 
> following error message:
>
> + LD     lib/crypto_bench
> ld: library not found for -l:libcryptopp.a
> clang: error: linker command failed with exit code 1 (use -v to see 
> invocation)
>
>  ...
>
> I also tried updating my PATH variable in bash_profile with the location of 
> libcryptopp as follows, then source'd bash_profile again:
>
> export PATH="/usr/local/lib:$PATH"
>
> However, this resulted in the same error as before when I tried to compile 
> the project. I've spent several hours googling and haven't been able to find 
> a fix, and I'm wary of manually symlinking the file because it can break 
> other installs on my laptop. Any help with fixing this issue would be much 
> appreciated.

When linking, use -L to provide a path to the linker. That is, you
invoke ld directly. If you are passing the linker option through the
compiler driver, then use -Wl,-L -Wl,<path>

So you would probably use something like:

  clang++ -g2 -O3 -I /usr/local/include test.cxx -Wl,-L
-Wl,/usr/local/lib -o test.exe

You would have to do the same on, say, CentOS, Fedora and Red Hat. Red
Hat does not put /usr/local on-path for the build tools.

Jeff

-- 
You received this message because you are subscribed to the Google Groups 
"Crypto++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cryptopp-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/cryptopp-users/CAH8yC8mNpnYfVifuBg12VHgRLuTyo5ZYDyv5Vg2TU49TxtPQhA%40mail.gmail.com.

Reply via email to