Re: [cryptopp-users] Linking issue on MacOS Catalina (using XCode)

2021-09-17 Thread Samyukta Yagati
Thanks for your help! Resolved, the issue was in my Makefile flags.

On Friday, September 17, 2021 at 3:11:53 PM UTC-7 Mouse wrote:

> Sorry, I've no idea what your makefile looks like, or how to convey the 
> working flags to it. 
>
> On Sep 17, 2021, at 16:39, Samyukta Yagati  wrote:
>
> (I currently have -l:libcryptopp.a in my LDFLAGS)
>
>
>
> On Friday, September 17, 2021 at 1:38:31 PM UTC-7 Samyukta Yagati wrote:
>
>> Ah I see -- I'm using make with a custom makefile to build the source 
>> files in my project, is there a way to translate this to flags in the 
>> makefile?
>>
>> On Thursday, September 16, 2021 at 6:31:25 PM UTC-7 Mouse wrote:
>>
>>> Say, you have a file that includes Crypto++ headers and needs linking 
>>> with Crypto++ library. And Crypto++ is installed into /usr/local. 
>>>
>>> Then, the following would be sufficient: 
>>>
>>> clang++ -o my_binary -I/usr/local/include my_source.cpp -L 
>>> /usr/local/lib -lcryptopp -lm 
>>>
>>> (I'm not sure if "-lm" is still necessary) 
>>>
>>>
>>> > On Sep 16, 2021, at 19:28, Samyukta Yagati  
>>> wrote: 
>>> > 
>>>
>> -- 
> 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-user...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/cryptopp-users/436b6393-8bb5-4b5e-b50c-1bb71da7aa24n%40googlegroups.com
>  
> 
> .
>
>

-- 
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/47a1a5be-9275-4bd2-b669-7d6bb4de22afn%40googlegroups.com.


Re: [cryptopp-users] Linking issue on MacOS Catalina (using XCode)

2021-09-17 Thread Uri Blumenthal
Sorry, I've no idea what your makefile looks like, or how to convey the working 
flags to it. 

> On Sep 17, 2021, at 16:39, Samyukta Yagati  wrote:
> 
> (I currently have -l:libcryptopp.a in my LDFLAGS)
> 
>> On Friday, September 17, 2021 at 1:38:31 PM UTC-7 Samyukta Yagati wrote:
>> Ah I see -- I'm using make with a custom makefile to build the source files 
>> in my project, is there a way to translate this to flags in the makefile?
>> 
>>> On Thursday, September 16, 2021 at 6:31:25 PM UTC-7 Mouse wrote:
>>> Say, you have a file that includes Crypto++ headers and needs linking with 
>>> Crypto++ library. And Crypto++ is installed into /usr/local. 
>>> 
>>> Then, the following would be sufficient: 
>>> 
>>> clang++ -o my_binary -I/usr/local/include my_source.cpp -L /usr/local/lib 
>>> -lcryptopp -lm 
>>> 
>>> (I'm not sure if "-lm" is still necessary) 
>>> 
>>> 
>>> > On Sep 16, 2021, at 19:28, Samyukta Yagati  wrote: 
>>> > 
> 
> -- 
> 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/436b6393-8bb5-4b5e-b50c-1bb71da7aa24n%40googlegroups.com.

-- 
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/15C7DC99-680F-49DA-891A-5D60B9B904C2%40gmail.com.


smime.p7s
Description: S/MIME cryptographic signature


Re: [cryptopp-users] Linking issue on MacOS Catalina (using XCode)

2021-09-17 Thread Samyukta Yagati
(I currently have -l:libcryptopp.a in my LDFLAGS)

On Friday, September 17, 2021 at 1:38:31 PM UTC-7 Samyukta Yagati wrote:

> Ah I see -- I'm using make with a custom makefile to build the source 
> files in my project, is there a way to translate this to flags in the 
> makefile?
>
> On Thursday, September 16, 2021 at 6:31:25 PM UTC-7 Mouse wrote:
>
>> Say, you have a file that includes Crypto++ headers and needs linking 
>> with Crypto++ library. And Crypto++ is installed into /usr/local.
>>
>> Then, the following would be sufficient:
>>
>> clang++ -o my_binary -I/usr/local/include my_source.cpp -L /usr/local/lib 
>> -lcryptopp -lm
>>
>> (I'm not sure if "-lm" is still necessary)
>>
>>
>> > On Sep 16, 2021, at 19:28, Samyukta Yagati  wrote:
>> > 
>>
>

-- 
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/436b6393-8bb5-4b5e-b50c-1bb71da7aa24n%40googlegroups.com.


Re: [cryptopp-users] Linking issue on MacOS Catalina (using XCode)

2021-09-17 Thread Samyukta Yagati
Ah I see -- I'm using make with a custom makefile to build the source files 
in my project, is there a way to translate this to flags in the makefile?

On Thursday, September 16, 2021 at 6:31:25 PM UTC-7 Mouse wrote:

> Say, you have a file that includes Crypto++ headers and needs linking with 
> Crypto++ library. And Crypto++ is installed into /usr/local.
>
> Then, the following would be sufficient:
>
> clang++ -o my_binary -I/usr/local/include my_source.cpp -L /usr/local/lib 
> -lcryptopp -lm
>
> (I'm not sure if "-lm" is still necessary)
>
>
> > On Sep 16, 2021, at 19:28, Samyukta Yagati  wrote:
> > 
>

-- 
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/4df7487a-c2ea-4807-b73d-1099a13ae866n%40googlegroups.com.


Re: [cryptopp-users] Linking issue on MacOS Catalina (using XCode)

2021-09-16 Thread Uri Blumenthal
Say, you have a file that includes Crypto++ headers and needs linking with 
Crypto++ library. And Crypto++ is installed into /usr/local.

Then, the following would be sufficient:

clang++ -o my_binary -I/usr/local/include my_source.cpp -L /usr/local/lib 
-lcryptopp -lm

(I'm not sure if "-lm" is still necessary)


> On Sep 16, 2021, at 19:28, Samyukta Yagati  wrote:
> 

-- 
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/E164A065-8F39-4F86-9B46-83F20F765D85%40gmail.com.


smime.p7s
Description: S/MIME cryptographic signature


Re: [cryptopp-users] Linking issue on MacOS Catalina (using XCode)

2021-09-16 Thread Samyukta Yagati
I think I'm still misunderstanding the intention of the command. 

On Thursday, September 16, 2021 at 3:56:20 PM UTC-7 Jeffrey Walton wrote:

>
> That's an "I" as in "include", bot a lowercase "L". 
>
> Use this command: 
>
> clang++ -g2 -O3 -I /usr/local/include test.cxx 
> /usr/local/lib/libcryptopp.a -o test.exe 
>
> For the above command (I'm reading it as a single line, so all part of one 
command), is the test.cxx file something that's generated by the cryptopp 
install process? If so, which directory should I be running this from? (I 
don't see a test.cxx in the cryptopp directory and searching online 
suggests this is related to the google testing framework for C++).
 
If I run the following (without the test.cxx file as input, which probably 
doesn't make sense but again I couldn't tell what function it's serving):
>> clang++ -g2 -O3 -I /usr/local/include /usr/local/lib/libcryptopp.a -o 
test.exe

I get this error:

Undefined symbols for architecture x86_64:
  "_main", referenced from:
 implicit entry/start for main executable
ld: symbol(s) not found for architecture x86_64

Thank you for your help so far, I really appreciate it.

-- 
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/bd84528c-915d-44aa-a3aa-6fafec7fc1e3n%40googlegroups.com.


Re: [cryptopp-users] Linking issue on MacOS Catalina (using XCode)

2021-09-16 Thread Jeffrey Walton
On Thu, Sep 16, 2021 at 6:22 PM Samyukta Yagati  wrote:
>
> As a follow up: I tried running
>
> >> clang++ -g2 -O3 -l /usr/local/include /usr/local/lib/libcryptopp.a -WI,-L
>
> And got the error:
> ld: library not found for -l/usr/local/include
> clang: error: linker command failed with exit code 1 (use -v to see 
> invocation)

That's an "I" as in "include", bot a lowercase "L".

Use this command:

clang++ -g2 -O3 -I /usr/local/include test.cxx
/usr/local/lib/libcryptopp.a -o test.exe

An archive like libcryptopp.a is just a collection of object files. It
is equivalent to saying:

clang++ -g2 -O3 -I /usr/local/include test.cxx
/usr/local/lib/cryptlib.o /usr/local/lib/cpu.o
/usr/local/lib/integer.o ... -o test.exe

A share object like libcryptopp.dylib or libcryptopp.so is the same
collection of object files in an executable format that can be loaded
at runtime.

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/CAH8yC8mCGpoOq3Si5M%2B_6AtJ6GAuqBUn%3D-Dh67Q%2BHP5cc%3DEX9g%40mail.gmail.com.


Re: [cryptopp-users] Linking issue on MacOS Catalina (using XCode)

2021-09-16 Thread Samyukta Yagati
As a follow up: I tried running  

>> clang++ -g2 -O3 -l /usr/local/include /usr/local/lib/libcryptopp.a -WI,-L

And got the error:

ld: library not found for -l/usr/local/include
clang: error: linker command failed with exit code 1 (use -v to see 
invocation)

It seems like the intention of this command was to ask clang to link to the 
include path to crypto++ but clang doesn't have the include path on in its 
build tools? Further suggestions or clarifications would be great, I tried 
googling again and couldn't find anything.
On Thursday, September 16, 2021 at 12:04:00 PM UTC-7 Samyukta Yagati wrote:

> I'm new to using clang, so to clarify: in my case, I should try "clang++ 
> -g2 -O3 -I /usr/local/include cryptopp -Wl,-L" (where cryptopp is a 
> subdirectory of include)? Also, is "-Wl,/usr/local/lib -o test.exe" 
> intended to be shorthand for "clang++ -g2 -O3 -Wl,/usr/local/lib -o 
> test.exe"? (and, relatedly, what output should I expect in test.exe?)
>
>
>
> On Wednesday, September 15, 2021 at 4:58:05 PM UTC-7 Jeffrey Walton wrote:
>
>> On Wed, Sep 15, 2021 at 6:39 PM Samyukta Yagati  
>> 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,
>>
>> 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/7405a8e9-7cad-45a3-b3ab-ac1853c6d227n%40googlegroups.com.


Re: [cryptopp-users] Linking issue on MacOS Catalina (using XCode)

2021-09-16 Thread Samyukta Yagati
I'm new to using clang, so to clarify: in my case, I should try "clang++ 
-g2 -O3 -I /usr/local/include cryptopp -Wl,-L" (where cryptopp is a 
subdirectory of include)? Also, is "-Wl,/usr/local/lib -o test.exe" 
intended to be shorthand for "clang++ -g2 -O3 -Wl,/usr/local/lib -o 
test.exe"? (and, relatedly, what output should I expect in test.exe?)



On Wednesday, September 15, 2021 at 4:58:05 PM UTC-7 Jeffrey Walton wrote:

> On Wed, Sep 15, 2021 at 6:39 PM Samyukta Yagati  
> 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,
>
> 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/9d368cb4-7206-458f-9bd7-3a4796ac9df9n%40googlegroups.com.


Re: [cryptopp-users] Linking issue on MacOS Catalina (using XCode)

2021-09-15 Thread Jeffrey Walton
On Wed, Sep 15, 2021 at 6:39 PM Samyukta Yagati  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,

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.