使用i686-w64-mingw32-g ++进行静态库

时间:2023-01-22 07:09:46

I have a JNI project, which I have to make work on Windows (I am working on Linux). This project actually depends on third-party library file which is static (archived i.e .a files). I am trying to create a JNI shared library file using i686-w64-mingw32-g++ and including -static followed by static third-party library name. Following is the command I am using

我有一个JNI项目,我必须在Windows上工作(我在Linux上工作)。该项目实际上依赖于静态的第三方库文件(存档,即.a文件)。我正在尝试使用i686-w64-mingw32-g ++创建一个JNI共享库文件,并包括-static,后跟静态第三方库名。以下是我正在使用的命令

i686-w64-mingw32-g++ -v -L./ -L/home/user/jre1.8.0_40/lib/amd64/ -I/user/all/apps/Linux2/x86_64/gcc/4.8.2/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.8.2/include -shared  -o test.dll test.cpp  -lstdc++ -static -thirdparty 

In-spite of placing the third party library in the current working directory, I keep getting error

尽管将第三方库放在当前工作目录中,我仍然会收到错误

/user/all/apps/Linux2/src/mxe/2013_12_03/usr/bin/../lib/gcc/i686-w64-mingw32/4.8.1/../../../../i686-w64-mingw32/bin/ld: cannot find -thirdparty

Please note : I included -I/user/all/apps/Linux2/x86_64/gcc/4.8.2/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.8.2/include to avoid the error cannot find jni.h which I hit before including the path.

请注意:我包括-I / user / all / apps / Linux2 / x86_64 / gcc / 4.8.2 / bin /../ lib / gcc / x86_64-unknown-linux-gnu / 4.8.2 / include以避免错误找不到包含路径之前我打过的jni.h。

I also tried to compile using gcc, in place of g++.

我也尝试使用gcc编译,代替g ++。

Do I need to create .dll of this third-party library(currently it is archived .a containing .obj files)?

我是否需要创建此第三方库的.dll(目前它已存档.a包含.obj文件)?

Being a newbie in cross compilers, I might be doing something wrong. Please correct me and any suggestions with this will be very helpful. Thank you.

作为交叉编译器的新手,我可能做错了什么。请更正我,任何有关此建议将非常有帮助。谢谢。

1 个解决方案

#1


-Wl,--export-all-symbols -Wl,--add-stdcall-alias -v adding this solved my problem

-Wl, - export-all-symbols -Wl, - add-stdcall-alias -v添加这解决了我的问题

#1


-Wl,--export-all-symbols -Wl,--add-stdcall-alias -v adding this solved my problem

-Wl, - export-all-symbols -Wl, - add-stdcall-alias -v添加这解决了我的问题