You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Roman (JIRA)" <ji...@apache.org> on 2016/09/13 22:48:22 UTC
[jira] [Comment Edited] (AVRO-1844) Avro-C build procedure doesn't
set include paths for Jansson
[ https://issues.apache.org/jira/browse/AVRO-1844?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15488698#comment-15488698 ]
Roman edited comment on AVRO-1844 at 9/13/16 10:47 PM:
-------------------------------------------------------
I don't know enough about CMake as well, but the following allowed me to at least build Avro-C:
Replace the following lines in CMakeLists.txt
{noformat}
#pkg_check_modules(JANSSON jansson>=2.3)
#if (JANSSON_FOUND)
# set(JANSSON_PKG libjansson)
# include_directories(${JANSSON_INCLUDE_DIR})
# link_directories(${JANSSON_LIBRARY_DIRS})
#else (JANSSON_FOUND)
# message(FATAL_ERROR "libjansson >=2.3 not found")
#endif (JANSSON_FOUND)
{noformat}
with the following code, which is mostly taken from https://github.com/watchedit/CMakeModules/blob/master/FindJansson.cmake :
{noformat}
# - Try to find Jansson
# Once done this will define
#
# JANSSON_FOUND - system has Jansson
# JANSSON_INCLUDE_DIRS - the Jansson include directory
# JANSSON_LIBRARIES - Link these to use Jansson
#
# Copyright (c) 2011 Lee Hambley <le...@gmail.com>
#
# Redistribution and use is allowed according to the terms of the New
# BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
#
if (JANSSON_LIBRARIES AND JANSSON_INCLUDE_DIRS)
# in cache already
set(JANSSON_FOUND TRUE)
else (JANSSON_LIBRARIES AND JANSSON_INCLUDE_DIRS)
find_path(JANSSON_INCLUDE_DIR
NAMES
jansson.h
PATHS
/usr/include
/usr/local/include
/opt/local/include
/sw/include
${JANSSON_PATH}/include
)
find_library(JANSSON_LIBRARY
NAMES
jansson
PATHS
/usr/lib
/usr/local/lib
/opt/local/lib
/sw/lib
${JANSSON_PATH}/lib
)
set(JANSSON_INCLUDE_DIRS
${JANSSON_INCLUDE_DIR}
)
if (JANSSON_LIBRARY)
set(JANSSON_LIBRARIES
${JANSSON_LIBRARIES}
${JANSSON_LIBRARY}
)
endif (JANSSON_LIBRARY)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Jansson DEFAULT_MSG
JANSSON_LIBRARIES JANSSON_INCLUDE_DIRS)
# show the JANSSON_INCLUDE_DIRS and JANSSON_LIBRARIES variables only in the advanced view
mark_as_advanced(JANSSON_INCLUDE_DIRS JANSSON_LIBRARIES)
endif (JANSSON_LIBRARIES AND JANSSON_INCLUDE_DIRS)
include_directories(${JANSSON_INCLUDE_DIR})
link_directories(${JANSSON_LIBRARY_DIRS})
{noformat}
-----------------------------------------------------------------------------------------------------------------------
This allows the user to specify -DJANSSON_PATH as a command-line option to cmake, and this worked to build Avro for me.
was (Author: romwell):
I don't know enough about CMake as well, but the following allowed me to at least build Avro-C:
Replace the following lines in CMakeLists.txt
#pkg_check_modules(JANSSON jansson>=2.3)
#if (JANSSON_FOUND)
# set(JANSSON_PKG libjansson)
# include_directories(${JANSSON_INCLUDE_DIR})
# link_directories(${JANSSON_LIBRARY_DIRS})
#else (JANSSON_FOUND)
# message(FATAL_ERROR "libjansson >=2.3 not found")
#endif (JANSSON_FOUND)
with the following code, which is mostly taken from https://github.com/watchedit/CMakeModules/blob/master/FindJansson.cmake :
# - Try to find Jansson
# Once done this will define
#
# JANSSON_FOUND - system has Jansson
# JANSSON_INCLUDE_DIRS - the Jansson include directory
# JANSSON_LIBRARIES - Link these to use Jansson
#
# Copyright (c) 2011 Lee Hambley <le...@gmail.com>
#
# Redistribution and use is allowed according to the terms of the New
# BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
#
if (JANSSON_LIBRARIES AND JANSSON_INCLUDE_DIRS)
# in cache already
set(JANSSON_FOUND TRUE)
else (JANSSON_LIBRARIES AND JANSSON_INCLUDE_DIRS)
find_path(JANSSON_INCLUDE_DIR
NAMES
jansson.h
PATHS
/usr/include
/usr/local/include
/opt/local/include
/sw/include
${JANSSON_PATH}/include
)
find_library(JANSSON_LIBRARY
NAMES
jansson
PATHS
/usr/lib
/usr/local/lib
/opt/local/lib
/sw/lib
${JANSSON_PATH}/lib
)
set(JANSSON_INCLUDE_DIRS
${JANSSON_INCLUDE_DIR}
)
if (JANSSON_LIBRARY)
set(JANSSON_LIBRARIES
${JANSSON_LIBRARIES}
${JANSSON_LIBRARY}
)
endif (JANSSON_LIBRARY)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Jansson DEFAULT_MSG
JANSSON_LIBRARIES JANSSON_INCLUDE_DIRS)
# show the JANSSON_INCLUDE_DIRS and JANSSON_LIBRARIES variables only in the advanced view
mark_as_advanced(JANSSON_INCLUDE_DIRS JANSSON_LIBRARIES)
endif (JANSSON_LIBRARIES AND JANSSON_INCLUDE_DIRS)
include_directories(${JANSSON_INCLUDE_DIR})
link_directories(${JANSSON_LIBRARY_DIRS})
-----------------------------------------------------------------------------------------------------------------------
This allows the user to specify -DJANSSON_PATH as a command-line option to cmake, and this worked to build Avro for me.
> Avro-C build procedure doesn't set include paths for Jansson
> ------------------------------------------------------------
>
> Key: AVRO-1844
> URL: https://issues.apache.org/jira/browse/AVRO-1844
> Project: Avro
> Issue Type: Bug
> Components: c
> Affects Versions: 1.8.0
> Environment: gcc 4.9.3, Scientific Linux Fermi release 6.7
> Reporter: Jim Pivarski
>
> I `configure` Jansson with a user-space `PREFIX` because I don't have root access, and when I `make install`, the Jansson includes and libs appear in new `include` and `lib` directories, as expected.
> I `cmake` with `-DCMAKE_INSTALL_PREFIX:PATH=` the same path as `PREFIX` and CMake is successful: it finds Jansson and makes the Makefiles.
> BUT, when I `make`, it fails because it can't find `jansson.h`. The same is true if I explicitly set `PKG_CONFIG_PATH` to point to `$PREFIX/lib/pkgconfig` and `pkg-config jansson --cflags --libs` works.
> If I explicitly add full paths to Avro's and Jansson's `#include <jansson.h>` lines in the source code, Avro compiles without trouble. (`avro-c-1.8.0/src/schema.c`, `avro-c-1.8.0/src/value-json.c`, `include/jansson.h`)
> Presumably, the Jansson part of the build process is only partly implemented, such that the CMake script searches for the appropriate version but `-I` flags are not generated for the compiler. I don't know enough CMake to know where to insert these.
> Fixing this issue is the only way I know of to make Avro-C installable on a system without root access, apart from the hack I described above.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)