当我尝试编译C它使用OpenSSL的"密码"的库函数与COMAND行代码-lcrypto与gcc 4.4.3它给出了一个错误
`@ubu:$ gcc -ggdb aes_m.c -Werror -Wall -I /usr/local/ssl/include/ -lcrypto -o aes
/usr/bin/ld: cannot find -lcrypto
collect2: ld returned 1 exit status`
Run Code Online (Sandbox Code Playgroud)
这可能是什么原因?
我已经完成了这个讨论ld找不到现有的库,但这没有帮助.
找到命令结果
$ locate libcrypto
/home/abhi/Downloads/openssl-1.0.1b/libcrypto.a
/home/abhi/Downloads/openssl-1.0.1b/libcrypto.pc
/lib/libcrypto.so.0.9.8
/lib/i486/libcrypto.so.0.9.8
/lib/i586/libcrypto.so.0.9.8
/lib/i686/cmov/libcrypto.so.0.9.8
/usr/lib/libcrypto.so.0.9.8
/usr/lib/vmware-tools/lib32/libcrypto.so.0.9.8
/usr/lib/vmware-tools/lib32/libcrypto.so.0.9.8/libcrypto.so.0.9.8
/usr/lib/vmware-tools/lib64/libcrypto.so.0.9.8
/usr/lib/vmware-tools/lib64/libcrypto.so.0.9.8/libcrypto.so.0.9.8
/usr/local/ssl/lib/libcrypto.a
/usr/local/ssl/lib/pkgconfig/libcrypto.pc
Run Code Online (Sandbox Code Playgroud)
有人可以请帮助,或指出我正在做的任何错误
@ Daniel Roethlisberger尝试使用-L标志但导致了这些错误
gcc -ggdb aes_m.c -Werror -Wall -I /usr/local/ssl/include/ -L /usr/local/ssl/lib -lcrypto -o aes
/usr/local/ssl/lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_globallookup':
dso_dlfcn.c:(.text+0x2d): undefined reference to `dlopen'
dso_dlfcn.c:(.text+0x43): undefined reference to `dlsym' …Run Code Online (Sandbox Code Playgroud) 嗨,我已经在我的linux机器上安装了openssl并通过头文件和文档(这是非常不充分的:().
我正在尝试构建一个使用对称加密算法的项目(在'c'中)(我专注于aes256cbc).问题是我很困惑如何在我的代码中使用库函数.
对于我实现的aes256cbc,我可以直接使用'aes.h'头文件中定义的函数(首先在我看来).
但在google搜索中我遇到了一些使用'evp.h'函数的教程来做这个http://saju.net.in/code/misc/openssl_aes.c.txt
是否有特定原因或直接访问aes.h函数更好.
而且,如果有人能够指出我使用openssl的加密库的任何类型的良好文档/教程将非常感激.
非常感谢
如果我天真,PS原谅我
我有一个Web应用程序,我正在使用WebDriver和Python.
问题是有这样的菜单
如果我在箭头按钮上手动单击它会扩展到我需要选择特定字段的另一个子菜单.
我可以找到第三个菜单但是当我点击它element.click()而不是展开菜单并向我显示其子菜单项时,它显示所有子菜单的合并内容.
(手动扩展到子菜单是通过实际点击组名称前面的小箭头图标来实现的)所以我如何实际点击此箭头图标将其中一个组菜单扩展到子菜单.
HTML如果它有帮助,这是对应于第三组菜单.
<div id="node_3_item" class="treeLabelSelected" style="padding-left: 0px; background-position: 0px -24px;">
<span style="background-position: 0px -24px;">XXX Groups</span>
</div>
<div style="display: none;"></div>
</div>
Run Code Online (Sandbox Code Playgroud)
该display: none行实际上隐藏了子菜单(据我所知)
任何关于如何处理的建议将不胜感激.谢谢
注意:我已经讨论了几个与隐藏网页元素交互相关的问题,但它们与我的情况不同.
我有一个用户程序,通常编译为有一个入口点0x400460,我必须重新定位,以便2GB在Linux中加载的共享库中有一个入口点.例如linux-vdso.so.1 => (0x00007fff109cd000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fcd195e6000)
/lib64/ld-linux-x86-64.so.2 (0x00007fcd199af000)
我使用gcc命令行参数-Wl,-Ttext=0x80000000来指定.textsegemnt 的起始地址.
问题是当我2GB在这个参数中给出一个上面的地址时,我得到一个链接器错误,它是:
gcc test.c -ggdb -Wl,-Ttext=0x80000000 -o test1
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 0 has invalid symbol index 10
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 1 has invalid symbol index 11
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 2 has invalid symbol index 2
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 3 has invalid symbol index 2
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 4 has invalid symbol index 10
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 5 …Run Code Online (Sandbox Code Playgroud) 我正在Linux 64bit下使用Eclipse CDT编写一个简单的C共享库.
代码有一个对rand()函数的引用,<stdlib.h>它编译得很好,但是在链接时它报告来自链接器的以下错误:
gcc -shared -o "libalg.so" ./sort.o
/usr/bin/ld: ./sort.o: relocation R_X86_64_PC32 against undefined symbol `rand@@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Bad value
Run Code Online (Sandbox Code Playgroud)
sort.o是从文件编译的目标文件.libalg.so是目标共享库名称.
谁能解释为什么会这样?
谢谢.
我有一个代码,它从 stdin 读取大约 (10^5) int(s) ,然后在执行 ## 后将它们输出到 stdout 上。我通过使用“setvbuf”和使用“fgets_unlocked()”读取行来处理输入部分,然后解析它们以获得所需的 int(s)。我有两个无法解决的问题:
1.)当我在标准输出上打印 int(s) 500 万时,它花费了大量时间:有没有办法减少这个(我尝试使用 fwrite() 但由于使用 fread 的原因,o/p 打印了不可打印的字符读入 int 缓冲区)
2.)在解析 int(s) 的输入后,说“x”,我实际上通过在循环中对 no 执行 %(mod) 来找到除数的 no。(参见下面的代码):也许这也是一个我的代码超时的原因:对此的任何建议都需要改进。非常感谢这实际上是来自http://www.codechef.com/problems/PD13的问题
# include <stdio.h>
# define SIZE 32*1024
char buf[SIZE];
main(void)
{
int i=0,chk =0;
unsigned int j =0 ,div =0;
int a =0,num =0;
char ch;
setvbuf(stdin,(char*)NULL,_IOFBF,0);
scanf("%d",&chk);
while(getchar_unlocked() != '\n');
while((a = fread_unlocked(buf,1,SIZE,stdin)) >0)
{
for(i=0;i<a;i++)
{
if(buf[i] != '\n')
{
num = (buf[i] - …Run Code Online (Sandbox Code Playgroud) 我正在使用malloc编写代码然后遇到问题所以我写了一个测试代码,它实际上总结了下面的整个混乱::
# include <stdio.h>
# include <stdlib.h>
# include <error.h>
int main()
{
int *p = NULL;
void *t = NULL;
unsigned short *d = NULL;
t = malloc(2);
if(t == NULL) perror("\n ERROR:");
printf("\nSHORT:%d\n",sizeof(short));
d =t;
(*d) = 65536;
p = t;
*p = 65536;
printf("\nP:%p: D:%p:\n",p,d);
printf("\nVAL_P:%d ## VAL_D:%d\n",(*p),(*d));
return 0;
}
Output:: abhi@ubuntu:~/Desktop/ad/A1/CC$ ./test
SHORT:2
P:0x9512008: D:0x9512008:
VAL_P:65536 ## VAL_D:0
Run Code Online (Sandbox Code Playgroud)
我使用malloc 分配2个字节的内存.返回void*指针的 Malloc 存储在void*指针't'中.
然后在那之后指出2个指针p - 整数类型和d - 短类型.然后我将t分配给它们*(p = …
我试图向Linux内核3.2.x添加新的系统调用。在Internet上搜索有用的参考资料时,我有一个印象,就是无法像将SO那样实现将系统调用作为可加载模块来实现吗?是否可以通过LKM添加系统调用?
我找到了另一个链接,上面写着“有一种添加系统调用而无需使用模块作为包装器重新编译内核的方法,但这超出了本文档的范围”。来源http://hekimian-williams.com/?p=20
我知道静态实现系统调用将要求我每次进行任何更改时都编译内核代码。有没有上述博客中指定的一种方法,我可以将其实现为模块。
对该方向的任何建议或指示,我们将不胜感激。
是否有任何有效的方法使用任何Python模块,如PyWind32与现有的本机操作系统对话框,如"另存为"框交互?
我尝试在Google上搜索但没有任何帮助.
编辑:
1:当用户单击Web应用程序上的"另存为"对话框时,将触发"另存为"对话框.
2:欢迎任何建议处理已经使用Python触发的任何本机操作系统对话框.(不需要特定于Selenium webdriver,我正在寻找一个通用的建议.)
(当我发布问题时,我认为通过'与对话框交互'将隐含地意味着它是一个现有的,好像我能够创建一个然后肯定我可以与它进行交互,因为它在我的程序控制下.在阅读了前两个答案之后,我意识到我并没有明确说明.这就是为什么EDIT)
谢谢
我试图在64位Ubuntu机器上修改libc6(2.15-0ubuntu20.2)中提供的动态链接器.
所以目前我的代码使用相同版本的glibc库.(我已经下载了相同的源代码并进行了处理).我的问题是,是否可以仅修改和构建glibc\elf\目录中存在的链接器源代码,而无需构建整个glibc库.
如果可能的话,我怎么能让我的测试程序使用我自己构建的新版动态链接器进行切换,而不是使用默认的未修改链接器.
任何指针或建议都非常感谢.(如果需要更多信息,请告诉我)
编辑:: @constantius
我按照您链接的帖子中的步骤构建ld.so. 但是我在make上遇到了错误,我检查了ld.so在精灵中没有.错误是::
/var/services/homes/abhi/test/ld/eglibc-build/elf/librtld.os: In function `generic_getcwd':
/var/services/homes/abhi/test/ld/eglibc-2.15/elf/../sysdeps/posix/getcwd.c:356: undefined reference to `__closedir'
/var/services/homes/abhi/test/ld/eglibc-2.15/elf/../sysdeps/posix/getcwd.c:368: undefined reference to `__fdopendir'
/var/services/homes/abhi/test/ld/eglibc-2.15/elf/../sysdeps/posix/getcwd.c:384: undefined reference to `__readdir'
/var/services/homes/abhi/test/ld/eglibc-2.15/elf/../sysdeps/posix/getcwd.c:397: undefined reference to `rewinddir'
/var/services/homes/abhi/test/ld/eglibc-2.15/elf/../sysdeps/posix/getcwd.c:528: undefined reference to `__closedir'
/var/services/homes/abhi/test/ld/eglibc-2.15/elf/../sysdeps/posix/getcwd.c:490: undefined reference to `__closedir'
collect2: error: ld returned 1 exit status
make[2]: *** [/var/services/homes/abhi/test/ld/eglibc-build/elf/ld.so] Error 1
make[2]: Leaving directory `/var/services/homes/abhi/test/ld/eglibc-2.15/elf'
make[1]: *** [elf/subdir_lib] Error 2
make[1]: Leaving directory `/var/services/homes/abhi/test/ld/eglibc-2.15'
make: *** [all] Error 2
Run Code Online (Sandbox Code Playgroud)
注意使用相同的基础设施,我可以构建和安装完整的GLIBC,所以我不认为基础设施有错误. - 我猜这个错误是与编辑Makeconfig到all-subdirs …
c ×7
linux ×4
gcc ×3
linker ×3
openssl ×2
python ×2
selenium ×2
automation ×1
cryptography ×1
glibc ×1
io ×1
linux-kernel ×1
malloc ×1
optimization ×1
pywin32 ×1
system-calls ×1
webdriver ×1
winapi ×1
windows ×1
x86-64 ×1