Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/torch/image.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzheng03 <lingshan.zheng.dev@icloud.com>2017-02-28 05:53:12 +0300
committerSoumith Chintala <soumith@gmail.com>2017-02-28 05:53:12 +0300
commitfc214c0292f014d71312b1bbb3c54a75e0cda3b6 (patch)
treeeaf36732161fe93f7b096701c47c8fc53a4d08b4
parentc4f41c3156924a7509f9b7b3b5dcb1fa6e3b2f79 (diff)
Fix "undefined symbol: luaopen_libpng" when running torch-android (#215)
-rw-r--r--CMakeLists.txt6
-rw-r--r--init.lua12
-rw-r--r--png.c2
3 files changed, 10 insertions, 10 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d19b863..bc582c1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -69,10 +69,10 @@ endif (JPEG_FOUND)
if (PNG_FOUND)
SET(src png.c)
include_directories (${PNG_INCLUDE_DIR})
- ADD_TORCH_PACKAGE(png "${src}" "${luasrc}" "Image Processing")
- TARGET_LINK_LIBRARIES(png luaT TH ${PNG_LIBRARIES})
+ ADD_TORCH_PACKAGE(lua_png "${src}" "${luasrc}" "Image Processing")
+ TARGET_LINK_LIBRARIES(lua_png luaT TH ${PNG_LIBRARIES})
IF(LUALIB)
- TARGET_LINK_LIBRARIES(png ${LUALIB})
+ TARGET_LINK_LIBRARIES(lua_png ${LUALIB})
ENDIF()
else (PNG_FOUND)
message ("WARNING: Could not find PNG libraries, PNG wrapper will not be installed")
diff --git a/init.lua b/init.lua
index e77f309..24748cf 100644
--- a/init.lua
+++ b/init.lua
@@ -149,7 +149,7 @@ local function processPNG(img, depth, bit_depth, tensortype)
end
local function loadPNG(filename, depth, tensortype)
- if not xlua.require 'libpng' then
+ if not xlua.require 'liblua_png' then
dok.error('libpng package not found, please install libpng','image.loadPNG')
end
local load_from_file = 1
@@ -169,7 +169,7 @@ local function clampImage(tensor)
end
local function savePNG(filename, tensor)
- if not xlua.require 'libpng' then
+ if not xlua.require 'liblua_png' then
dok.error('libpng package not found, please install libpng','image.savePNG')
end
tensor = clampImage(tensor)
@@ -178,7 +178,7 @@ end
rawset(image, 'savePNG', savePNG)
local function decompressPNG(tensor, depth, tensortype)
- if not xlua.require 'libpng' then
+ if not xlua.require 'liblua_png' then
dok.error('libpng package not found, please install libpng',
'image.decompressPNG')
end
@@ -197,7 +197,7 @@ end
rawset(image, 'decompressPNG', decompressPNG)
function image.getPNGsize(filename)
- if not xlua.require 'libpng' then
+ if not xlua.require 'liblua_png' then
dok.error('libpng package not found, please install libpng','image.getPNGsize')
end
return torch.Tensor().libpng.size(filename)
@@ -1665,7 +1665,7 @@ local function lena()
local fname = 'grace_hopper_512'
if xlua.require 'libjpeg' then
lena = image.load(paths.concat(fpath(), 'assets', fname .. '.jpg'), 3)
- elseif xlua.require 'libpng' then
+ elseif xlua.require 'liblua_png' then
lena = image.load(paths.concat(fpath(), 'assets', fname .. '.png'), 3)
else
dok.error('no bindings available to load images (libjpeg AND libpng missing)', 'image.lena')
@@ -1684,7 +1684,7 @@ local function fabio()
local fname = 'fabio'
if xlua.require 'libjpeg' then
lena = image.load(paths.concat(fpath(), 'assets', fname .. '.jpg'), 1)
- elseif xlua.require 'libpng' then
+ elseif xlua.require 'liblua_png' then
lena = image.load(paths.concat(fpath(), 'assets', fname .. '.png'), 1)
else
dok.error('no bindings available to load images (libjpeg AND libpng missing)', 'image.fabio')
diff --git a/png.c b/png.c
index e69eee0..e7a9d83 100644
--- a/png.c
+++ b/png.c
@@ -61,7 +61,7 @@ libpng_error_fn(png_structp png_ptr, png_const_charp error_msg)
#include "generic/png.c"
#include "THGenerateAllTypes.h"
-DLL_EXPORT int luaopen_libpng(lua_State *L)
+DLL_EXPORT int luaopen_liblua_png(lua_State *L)
{
libpng_FloatMain_init(L);
libpng_DoubleMain_init(L);