baidu / baidu/lac

MAC m1 上LAC的Java调用方式make失败

Open
#268 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
4k
Forks
592
PR merge metrics
No merged PRs in 30d

Description

1. OS环境:mac m1 13.2
2. Paddle的预测库下载的是[m1 版的C++预测库](https://www.paddlepaddle.org.cn/inference/v2.4/guides/install/download_lib.html#mac)
3. Java是openjdk11
4. cmake 3.25.2

编译JNI,执行make install后出现错误:
make[2]: *** No rule to make target `/Users/wang/Downloads/paddle_inference/paddle/lib/libpaddle_fluid.a', needed by `liblacjni.dylib'. Stop.
make[1]: *** [CMakeFiles/lacjni.dir/all] Error 2
make: *** [all] Error 2

cmake log

cmake -DPADDLE_ROOT=$PADDLE_ROOT \
-DJAVA_HOME=$JAVA_HOME \
-DWITH_JNILIB=ON \
-DWITH_DEMO=OFF
CMake Warning:
No source or binary directory provided. Both will be assumed to be the
same as the current working directory, but note that this warning will
become a fatal error in future CMake releases.

-- CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++, version: AppleClang 14.0.0.14000029
-- C compiler: /Library/Developer/CommandLineTools/usr/bin/cc, version: AppleClang 14.0.0.14000029
-- paddle include: /Users/wang/Downloads/paddle_inference/paddle/include
-- paddle lib: /Users/wang/Downloads/paddle_inference/paddle/lib
-- MKLDNN lib not found.
-- MKLML lib not found.
-- openblas lib found.
-- '/Users/wang/Desktop/test/lacbaidu/lac' output dir
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/wang/Desktop/test/lacbaidu/lac

make install log

make install
[ 9%] Building CXX object CMakeFiles/lac.dir/c++/src/ahocorasick.cpp.o
[ 18%] Building CXX object CMakeFiles/lac.dir/c++/src/lac.cpp.o
[ 27%] Building CXX object CMakeFiles/lac.dir/c++/src/lac_custom.cpp.o
[ 36%] Building CXX object CMakeFiles/lac.dir/c++/src/lac_util.cpp.o
[ 45%] Linking CXX static library liblac.a
[ 45%] Built target lac
[ 54%] Building CXX object CMakeFiles/lacjni.dir/c++/src/ahocorasick.cpp.o
[ 63%] Building CXX object CMakeFiles/lacjni.dir/c++/src/lac.cpp.o
[ 72%] Building CXX object CMakeFiles/lacjni.dir/c++/src/lac_custom.cpp.o
[ 81%] Building CXX object CMakeFiles/lacjni.dir/c++/src/lac_util.cpp.o
[ 90%] Building CXX object CMakeFiles/lacjni.dir/java/cpp/lac_jni.cpp.o
make[2]: *** No rule to make target `/Users/wang/Downloads/paddle_inference/paddle/lib/libpaddle_fluid.a', needed by `liblacjni.dylib'. Stop.
make[1]: *** [CMakeFiles/lacjni.dir/all] Error 2
make: *** [all] Error 2

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the shown CMake invocation and inspect how the Paddle library directory is used when building the `lacjni` target. Compare that configuration with the reported library path, then rerun `make install`; done means the JNI target links successfully and installation completes.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake, cpp, java
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.