Skip to content

Commit 961f502

Browse files
[pdf2htmlEX_exe] Set rpath at link time, instead of using LD_LIBRARY_PATH at run time
By default, neither the current working directory, nor the directory of the executable is used as a library search path.
1 parent 4b6363b commit 961f502

2 files changed

Lines changed: 2 additions & 6 deletions

File tree

dependency-builder/src/main/cpp/packages/pdf2htmlEX-Patch-Source-make-a-library.patch

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
src/pdf2htmlEX-config.h
4848
src/HTMLRenderer/HTMLRenderer.h
4949
src/HTMLRenderer/draw.cc
50-
@@ -172,8 +157,17 @@ set(PDF2HTMLEX_SRC ${PDF2HTMLEX_SRC}
50+
@@ -172,8 +157,18 @@ set(PDF2HTMLEX_SRC ${PDF2HTMLEX_SRC}
5151
src/TmpFiles.cc
5252
)
5353

@@ -62,6 +62,7 @@
6262
+set_target_properties(libpdf2htmlEX PROPERTIES OUTPUT_NAME pdf2htmlEX)
6363
+
6464
+add_executable(pdf2htmlEX ${PDF2HTMLEX_PROGRAM_SRC})
65+
+SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath='\${ORIGIN}'")
6566
+target_link_libraries(pdf2htmlEX libpdf2htmlEX)
6667
+set_target_properties(pdf2htmlEX PROPERTIES OUTPUT_NAME libpdf2htmlEX-exe_not_lib.so)
6768

pdf2htmlEX/src/main/java/com/viliussutkus89/android/pdf2htmlex/pdf2htmlEX_exe.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,6 @@ public pdf2htmlEX_exe(@NonNull Context ctx) {
5252
super(ctx, null);
5353

5454
String nativeLibraryDir = ctx.getApplicationInfo().nativeLibraryDir;
55-
String oldLibraryPath = m_environment.put("LD_LIBRARY_PATH", nativeLibraryDir);
56-
if (null != oldLibraryPath) {
57-
m_environment.put("LD_LIBRARY_PATH", oldLibraryPath + ":" + nativeLibraryDir);
58-
}
59-
6055
File externalExecutable = new File(nativeLibraryDir, "libpdf2htmlEX-exe_not_lib.so");
6156

6257
m_argumentsPrefix = new String[]{

0 commit comments

Comments
 (0)