[Ur] OpenSSL and C FFI

David Snider david at davidsnider.net
Sat Oct 20 10:58:14 EDT 2012


For some reason you have to link pq after everything else. It doesn't do 
this with sqlite or mysql.

david at ubuntu:~/Projects/UrShop$ gcc -Werror  -pthread -L/usr/local/lib 
-lurweb_http -lurweb /tmp/webapp.o -lpq -lm -lcrypto -lssl -o 
/home/david/Projects/UrShop/urshop.exe -g 
/home/david/Projects/UrShop/lib/sha.o
/usr/bin/ld: /usr/local/lib/liburweb.so: undefined reference to symbol 
'SHA256_Init@@OPENSSL_1.0.0'
/usr/bin/ld: note: 'SHA256_Init@@OPENSSL_1.0.0' is defined in DSO 
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/libcrypto.so 
so try adding it to the linker command line
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/libcrypto.so: could 
not read symbols: Invalid operation
collect2: ld returned 1 exit status


david at ubuntu:~/Projects/UrShop$ gcc -Werror  -pthread -L/usr/local/lib 
-lurweb_http -lurweb /tmp/webapp.o -lm -lcrypto -lssl -lpq -o 
/home/david/Projects/UrShop/urshop.exe -g 
/home/david/Projects/UrShop/lib/sha.o


On 10/20/2012 09:03 AM, Adam Chlipala wrote:
> On 10/20/2012 08:54 AM, David Snider wrote:
>> |I'm trying to make a C FFI that returns the SHA256 of a string and this is what I get when I try to compile with my library added:
>>
>> david at ubuntu:~/Projects/UrShop$ urweb urshop
>> /usr/bin/ld: /usr/local/lib/liburweb.so: undefined reference to symbol 'SHA256_Init@@OPENSSL_1.0.0'
>> /usr/bin/ld: note: 'SHA256_Init@@OPENSSL_1.0.0' is defined in DSO /usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/libcrypto.so so try adding it to the linker command line
>> /usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/libcrypto.so: could not read symbols: Invalid operation
>> collect2: ld returned 1 exit status
>>
>> What step am I missing?|
>>    
>
> Run 'urweb' with the '-debug' option and then tweak the gcc command 
> lines it uses until they work.  Once you figure out what was wrong, I 
> can comment on the right way to get 'urweb' itself to use different 
> command lines.
>
>
> _______________________________________________
> Ur mailing list
> Ur at impredicative.com
> http://www.impredicative.com/cgi-bin/mailman/listinfo/ur

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.impredicative.com/pipermail/ur/attachments/20121020/dfa77390/attachment-0001.html>


More information about the Ur mailing list