PureData是用于声音合成的编程语言。 LibPD是围绕它的包装,因此我们可以在Java / C#/ Android等中使用补丁。
这是包含它的GitHub页面:https://github.com/libpd/libpd

现在要在Java中使用LibPD,我认为首先应该将其库导入到我的项目中,然后使用其类和方法来调用我的补丁并对其进行调整。问题是,我找不到要添加到项目中的jar文件。我是否必须“构建”某些东西以便生成jar文件?

如果有人向我解释此程序,我将不胜感激。
谢谢

更新1 [2017-01-11]:
在关注@umläute的帖子之后,出现以下错误:
(我在Windows 7/64位中使用MinGW,在MinGW-make中使用make)

C:\Users\Name\Documents\GitHub>cd libpd

C:\Users\Name\Documents\GitHub\libpd>git submodule init

C:\Users\Name\Documents\GitHub\libpd>git submodule update

C:\Users\Name\Documents\GitHub\libpd>make javalib
'make' is not recognized as an internal or external command,
operable program or batch file.

C:\Users\Name\Documents\GitHub\libpd>mingw32-make javalib
process_begin: CreateProcess(NULL, uname, ...) failed.
'sed' is not recognized as an internal or external command,
operable program or batch file.
'sed' is not recognized as an internal or external command,
operable program or batch file.
gcc -DPD -DHAVE_UNISTD_H -DUSEAPI_DUMMY -I./pure-data/src -I./libpd_wrapper -I./libpd_wrapper/util  -DWINVER=0x502 -DWIN
32 -D_WIN32 -DPD_INTERNAL -I"C:\Program Files\Java\jdk1.8.0_45/include" -I"C:\Program Files\Java\jdk1.8.0_45/include/win
32" -O3   -c -o pure-data/src/d_arithmetic.o pure-data/src/d_arithmetic.c
gcc -DPD -DHAVE_UNISTD_H -DUSEAPI_DUMMY -I./pure-data/src -I./libpd_wrapper -I./libpd_wrapper/util  -DWINVER=0x502 -DWIN
32 -D_WIN32 -DPD_INTERNAL -I"C:\Program Files\Java\jdk1.8.0_45/include" -I"C:\Program Files\Java\jdk1.8.0_45/include/win
32" -O3   -c -o pure-data/src/d_array.o pure-data/src/d_array.c
gcc -DPD -DHAVE_UNISTD_H -DUSEAPI_DUMMY -I./pure-data/src -I./libpd_wrapper -I./libpd_wrapper/util  -DWINVER=0x502 -DWIN
32 -D_WIN32 -DPD_INTERNAL -I"C:\Program Files\Java\jdk1.8.0_45/include" -I"C:\Program Files\Java\jdk1.8.0_45/include/win
32" -O3   -c -o pure-data/src/d_ctl.o pure-data/src/d_ctl.c
gcc -DPD -DHAVE_UNISTD_H -DUSEAPI_DUMMY -I./pure-data/src -I./libpd_wrapper -I./libpd_wrapper/util  -DWINVER=0x502 -DWIN
32 -D_WIN32 -DPD_INTERNAL -I"C:\Program Files\Java\jdk1.8.0_45/include" -I"C:\Program Files\Java\jdk1.8.0_45/include/win
32" -O3   -c -o pure-data/src/d_dac.o pure-data/src/d_dac.c
gcc -DPD -DHAVE_UNISTD_H -DUSEAPI_DUMMY -I./pure-data/src -I./libpd_wrapper -I./libpd_wrapper/util  -DWINVER=0x502 -DWIN
32 -D_WIN32 -DPD_INTERNAL -I"C:\Program Files\Java\jdk1.8.0_45/include" -I"C:\Program Files\Java\jdk1.8.0_45/include/win
32" -O3   -c -o pure-data/src/d_delay.o pure-data/src/d_delay.c
gcc -DPD -DHAVE_UNISTD_H -DUSEAPI_DUMMY -I./pure-data/src -I./libpd_wrapper -I./libpd_wrapper/util  -DWINVER=0x502 -DWIN
32 -D_WIN32 -DPD_INTERNAL -I"C:\Program Files\Java\jdk1.8.0_45/include" -I"C:\Program Files\Java\jdk1.8.0_45/include/win
32" -O3   -c -o pure-data/src/d_fft.o pure-data/src/d_fft.c
gcc -DPD -DHAVE_UNISTD_H -DUSEAPI_DUMMY -I./pure-data/src -I./libpd_wrapper -I./libpd_wrapper/util  -DWINVER=0x502 -DWIN
32 -D_WIN32 -DPD_INTERNAL -I"C:\Program Files\Java\jdk1.8.0_45/include" -I"C:\Program Files\Java\jdk1.8.0_45/include/win
32" -O3   -c -o pure-data/src/d_fft_fftsg.o pure-data/src/d_fft_fftsg.c
pure-data/src/d_fft_fftsg.c: In function 'mayer_dofft':
pure-data/src/d_fft_fftsg.c:88:11: warning: incompatible implicit declaration of built-in function 'alloca' [enabled by
default]
     buf = alloca(n * (2 * sizeof(FFTFLT)));
           ^
pure-data/src/d_fft_fftsg.c: In function 'mayer_realfft':
pure-data/src/d_fft_fftsg.c:121:11: warning: incompatible implicit declaration of built-in function 'alloca' [enabled by
 default]
     buf = alloca(n * sizeof(FFTFLT));
           ^
pure-data/src/d_fft_fftsg.c: In function 'mayer_realifft':
pure-data/src/d_fft_fftsg.c:139:11: warning: incompatible implicit declaration of built-in function 'alloca' [enabled by
 default]
     buf = alloca(n * sizeof(FFTFLT));
           ^
pure-data/src/d_fft_fftsg.c: In function 'pd_fft':
pure-data/src/d_fft_fftsg.c:156:30: warning: incompatible implicit declaration of built-in function 'alloca' [enabled by
 default]
     FFTFLT *buf2 = (FFTFLT *)alloca(2 * npoints * sizeof(FFTFLT)), *bp2;
                              ^
gcc -DPD -DHAVE_UNISTD_H -DUSEAPI_DUMMY -I./pure-data/src -I./libpd_wrapper -I./libpd_wrapper/util  -DWINVER=0x502 -DWIN
32 -D_WIN32 -DPD_INTERNAL -I"C:\Program Files\Java\jdk1.8.0_45/include" -I"C:\Program Files\Java\jdk1.8.0_45/include/win
32" -O3   -c -o pure-data/src/d_filter.o pure-data/src/d_filter.c
gcc -DPD -DHAVE_UNISTD_H -DUSEAPI_DUMMY -I./pure-data/src -I./libpd_wrapper -I./libpd_wrapper/util  -DWINVER=0x502 -DWIN
32 -D_WIN32 -DPD_INTERNAL -I"C:\Program Files\Java\jdk1.8.0_45/include" -I"C:\Program Files\Java\jdk1.8.0_45/include/win
32" -O3   -c -o pure-data/src/d_global.o pure-data/src/d_global.c
gcc -DPD -DHAVE_UNISTD_H -DUSEAPI_DUMMY -I./pure-data/src -I./libpd_wrapper -I./libpd_wrapper/util  -DWINVER=0x502 -DWIN
32 -D_WIN32 -DPD_INTERNAL -I"C:\Program Files\Java\jdk1.8.0_45/include" -I"C:\Program Files\Java\jdk1.8.0_45/include/win
32" -O3   -c -o pure-data/src/d_math.o pure-data/src/d_math.c
gcc -DPD -DHAVE_UNISTD_H -DUSEAPI_DUMMY -I./pure-data/src -I./libpd_wrapper -I./libpd_wrapper/util  -DWINVER=0x502 -DWIN
32 -D_WIN32 -DPD_INTERNAL -I"C:\Program Files\Java\jdk1.8.0_45/include" -I"C:\Program Files\Java\jdk1.8.0_45/include/win
32" -O3   -c -o pure-data/src/d_osc.o pure-data/src/d_osc.c
gcc -DPD -DHAVE_UNISTD_H -DUSEAPI_DUMMY -I./pure-data/src -I./libpd_wrapper -I./libpd_wrapper/util  -DWINVER=0x502 -DWIN
32 -D_WIN32 -DPD_INTERNAL -I"C:\Program Files\Java\jdk1.8.0_45/include" -I"C:\Program Files\Java\jdk1.8.0_45/include/win
32" -O3   -c -o pure-data/src/d_resample.o pure-data/src/d_resample.c
gcc -DPD -DHAVE_UNISTD_H -DUSEAPI_DUMMY -I./pure-data/src -I./libpd_wrapper -I./libpd_wrapper/util  -DWINVER=0x502 -DWIN
32 -D_WIN32 -DPD_INTERNAL -I"C:\Program Files\Java\jdk1.8.0_45/include" -I"C:\Program Files\Java\jdk1.8.0_45/include/win
32" -O3   -c -o pure-data/src/d_soundfile.o pure-data/src/d_soundfile.c
pure-data/src/d_soundfile.c:17:21: fatal error: pthread.h: No such file or directory
 #include <pthread.h>
                     ^
compilation terminated.
<builtin>: recipe for target 'pure-data/src/d_soundfile.o' failed
mingw32-make: *** [pure-data/src/d_soundfile.o] Error 1

更新2 [2017-01-11]:
我已经安装了MSYS2mingw3264make(由于@milleniumbug的帮助)。我已经将mingw64make的目录添加到PATH中。
现在当我执行make javalib时,出现此错误:
C:\Users\Name\Documents\GitHub\libpd>make javalib
gcc -DPD -DHAVE_UNISTD_H -DUSEAPI_DUMMY -I./pure-data/src -I./libpd_wrapper -I./libpd_wrapper/util  -DWINVER=0x502 -DWIN
32 -D_WIN32 -DPD_INTERNAL -I"C:\Program Files\Java\jdk1.8.0_45/include" -I"C:\Program Files\Java\jdk1.8.0_45/include/win
32" -O3   -c -o jni/z_jni_plain.o jni/z_jni_plain.c
In file included from jni/z_jni_shared.c:8:0,
                 from jni/z_jni_plain.c:8:
jni/z_jni.h:2:10: fatal error: jni.h: No such file or directory
 #include <jni.h>
          ^~~~~~~

更新3 [2017年4月11日]:
解决了 jni.h问题。我的PATH指向旧的jdk,而不是更新的jdk。
现在我得到这个错误:
C:/msys32/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: Cannot export libpd
_set_concatenated_printhook: symbol not found
C:/msys32/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: i386 architecture o
f input file `libpd_wrapper/util/z_print_util.o' is incompatible with i386:x86-64 output
libpd_wrapper/util/z_print_util.o:z_print_util.c:(.text+0x3a): undefined reference to `_strlen'
libpd_wrapper/util/z_print_util.o:z_print_util.c:(.text+0x75): undefined reference to `_strncat'
libpd_wrapper/util/z_print_util.o:z_print_util.c:(.text+0xad): undefined reference to `_strncat'
collect2.exe: error: ld returned 1 exit status
make: *** [Makefile:163: java-build/org/puredata/core/natives/windows/x86_64//pdnative.dll] Error 1

使用32位MinGW gcc进行了测试...仍然存在相同的错误...

更新4 [6-11-2017]:
解决了问题
看来我已经设法解决了。这是我通常所做的:
1-首先,我已经安装了msys2并对其进行了彻底的安装,MinGW32MinGW64make注意:如果您从旧的原始网站获得mingw32,请删除它。它不再更新,您可能会遇到依赖性问题。
2-更改了路径以使用MinGW32(因此gcc -v应该报告32位版本)
3-将JAVA_HOME更改为更新的jdk目录。似乎更新Java不会自动更新环境。变量(解决了jni header not found问题)。
4-安装git并通过libpd命令获取git(按照存储库的自述文件中的说明)
5- make clean6- make clean libpd7- make clean javalib
我希望这可以帮助别人

最佳答案

libpd Github project包含(与其他源代码存储库一样)libpd的(而不是预构建的二进制文件)。

README



然后继续构建:



因此,只需创建libs/libpd.jar即可:

make javalib

09-11 20:14