gpt4 book ai didi

java - 运行 makefile --add-stdcall-alias 时出现 JNI 问题

转载 作者:塔克拉玛干 更新时间:2023-11-03 07:22:43 25 4
gpt4 key购买 nike

当我运行带有目标 all 的 makefile 时,我遇到了 JNI 问题

这是我的问题:

**** Build of configuration Default for project TestTapeJNI ****
make all
javah -classpath ../bin TestTape
gcc -I"/home/tanio/DevelopmentEnvironment/jdk1.7.0_51/include"I"/home/tanio/DevelopmentEnvironment/jdk1.7.0_51/include/linux" -c TestTape.c -o TestTape.o
gcc -Wl,--add-stdcall-alias -shared -o Tape.dll TestTape.o
/usr/bin/ld: unrecognized option '--add-stdcall-alias'
/usr/bin/ld: use the --help option for usage information collect2: ld returned 1 exit status
make: *** [Tape.dll] Error 1

你知道问题出在哪里吗?

编辑

如果我尝试从 makefile 中取消它,则会触发此问题

make all 
javah -classpath ../bin TestTape
gcc -Wl, -shared -o Tape.dll TestTape.o
/usr/bin/ld: cannot find : No such file or directory
collect2: ld returned 1 exit status
make: *** [Tape.dll] Error 1

生成文件

# Define a variable for classpath
CLASS_PATH = ../bin

# Define a virtual path for .class in the bin directory
vpath %.class $(CLASS_PATH)

all : Tape.dll

# $@ matches the target, $< matches the first dependancy
Tape.dll : TestTape.o
gcc -Wl, -shared -o $@ $<

# $@ matches the target, $< matches the first dependancy
TestTape.o : TestTape.c TestTape.h
gcc -I"/home/tanio/DevelopmentEnvironment/jdk1.7.0_51/include" -I"/home/tanio/DevelopmentEnvironment/jdk1.7.0_51/include/linux" -c $< -o $@

# $* matches the target filename without the extension
TestTape.h : TestTape.class
javah -classpath $(CLASS_PATH) $*

clean :
rm TestTape.h TestTape.o Tape.dll

最佳答案

根据此链接 http://www.delorie.com/gnu/docs/binutils/ld_4.html

所以一个有效的解决方案就是删除它(..std..alisa..),你的 gcc 命令现在变成:

gcc -Wl -shared -o Tape.dll TestTape.o

关于java - 运行 makefile --add-stdcall-alias 时出现 JNI 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23605154/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com