Error trying to link with osgText and freetype - linux

I've already checked dozens of web pages and configurations about this.
I'm desperate because I really need to use this feature and soon.
These are my settings:
Language: C++
Libraries: OpenSceneGraph (OSG) v3.2.0
OS: Xubuntu 14.04 (on a VMWare Player virtual machine)
I am compiling an example from the book "OpenSceneGraph 3.0 - Beginner's Guide", pages 297-299, regarding the use of Text on OSG, which requires an additional plug-in, freetype (http://www.freetype.org/), which is installed.
The example compiles correctly.
I think I have all the required include files and libraries.
The problem comes in the link phase. It always gives me this error:
/usr/bin/ld: CMakeFiles/osg_demos.dir/osg_demos.cpp.o: undefined reference to symbol '_ZN7osgText12readFontFileERKSsPKN5osgDB7OptionsE'
//usr/lib/libosgText.so.99: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[2]: *** [osg_demos] Error 1
make[1]: *** [CMakeFiles/osg_demos.dir/all] Error 2
make: *** [all] Error 2
I checked that I have the files:
"/usr/lib/libosgText.so.99" which is a link to the actual lib file:
"libosgText.so.3.2.0".
"/usr/lib/osgPlugins-3.2.0/osgdb_freetype.so"
the external dependency of the osgText library.
I ran out of ideas. :(
Can someone help me?
My question stops here, but in case you want to check my files, please find them below.
The code responsible for this problem:
osgText::Text* createText( const osg::Vec3& pos,
const std::string& content, float size ) {
osg::ref_ptr<osgText::Font> g_font = osgText::readFontFile("arial.ttf");
osg::ref_ptr<osgText::Text> text = new osgText::Text;
text->setFont( g_font.get() );
text->setCharacterSize( size );
text->setAxisAlignment( osgText::TextBase::XY_PLANE );
text->setPosition( pos );
text->setText( content );
return text.release();
}
These are the Include files that I am using which are specific to osgText operations, apart from all the others that I already need on my project:
#include <osg/Camera>
#include <osgText/TextBase>
#include <osgText/Font>
#include <osgText/Text>
This is my "CMakeLists.txt" file:
cmake_minimum_required( VERSION 2.6 )
project( OSG_DEMOS )
find_package( OpenThreads )
find_package( osg )
find_package( osgDB )
find_package( osgGA )
find_package( osgUtil )
find_package( osgViewer )
find_package( osgText ) # Needed for demo: writeText()
find_package( osgShadow ) # Needed for demo: writeText()
find_package( osgParticle ) # Needed for demo: writeText()
find_package( osgFX ) # Needed for demo: writeText()
find_package(PCL 1.6 COMPONENTS)
set(CMAKE_CXX_FLAGS "-g -Wno-deprecated")
macro( config_project PROJNAME LIBNAME )
include_directories( ${${LIBNAME}_INCLUDE_DIR} )
target_link_libraries( ${PROJNAME} ${${LIBNAME}_LIBRARIES} )
endmacro()
add_executable(osg_demos osg_demos.cpp)
config_project(osg_demos OPENTHREADS )
config_project(osg_demos OSG )
config_project(osg_demos OSGDB )
config_project(osg_demos OSGGA )
config_project(osg_demos OSGUTIL )
config_project(osg_demos OSGVIEWER )
config_project(osg_demos osgText )
config_project(osg_demos osgShadow )
config_project(osg_demos osgParticle )
config_project(osg_demos osgFX )

The problem was on the "CMakeLists.txt" file.
Apparently, the config_project macro requires all uppercase letters. I don't exactly understand why.
To make the project link correctly, I switched to uppercase the reference to library name on the last four lines of that file, like:
config_project(osg_demos OSGTEXT )
instead of:
config_project(osg_demos osgText )
What a nightmare just because of this...

Related

I have installed QtCharts module in Qt6, but iam receiving error

I want to use QtCharts in Qt6, i have installed the module, after that i have added the module in CMakeLists.txt, but iam receiving error (Qt6CoreMacros.cmake:559: error: Target "4-DonutChartExample" links to target "Qt6::Charts" but the target was not found. Perhaps a find_package() call is missing for an IMPORTED target, or an ALIAS target is missing? )
my CMakeLists.txt
cmake_minimum_required(VERSION 3.5)
project(4-DonutChartExample VERSION 0.1 LANGUAGES CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widget Charts)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets)
set(PROJECT_SOURCES
main.cpp
widget.cpp
widget.h
widget.ui
)
if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
qt_add_executable(4-DonutChartExample
MANUAL_FINALIZATION
${PROJECT_SOURCES}
)
# Define target properties for Android with Qt 6 as:
# set_property(TARGET 4-DonutChartExample APPEND PROPERTY QT_ANDROID_PACKAGE_SOURCE_DIR
# ${CMAKE_CURRENT_SOURCE_DIR}/android)
# For more information, see https://doc.qt.io/qt-6/qt-add-executable.html#target-creation
else()
if(ANDROID)
add_library(4-DonutChartExample SHARED
${PROJECT_SOURCES}
)
# Define properties for Android with Qt 5 after find_package() calls as:
# set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android")
else()
add_executable(4-DonutChartExample
${PROJECT_SOURCES}
)
endif()
endif()
target_link_libraries(4-DonutChartExample PRIVATE Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::Charts)
set_target_properties(4-DonutChartExample PROPERTIES
MACOSX_BUNDLE_GUI_IDENTIFIER my.example.com
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
MACOSX_BUNDLE TRUE
WIN32_EXECUTABLE TRUE
)
if(QT_VERSION_MAJOR EQUAL 6)
qt_finalize_executable(4-DonutChartExample)
endif()

MAKE fails to find ft2build.h (freetype2 header) -freetype(2.8.1) is installed properly

I am Trying to compile 'xplanet' R224 (latest version) on Ubuntu 18.04
MAKE fails to find ft2build.h (freetype2 header) I have 'freetype'(2.8.1) installed properly and all the files are there. I have searched stackoverflow and found many people with the same problem (ft2build.h not found) yet no consensus on why or what the solution is.
Any help is appreciated.
MAKE ERROR MESSAGE:
In file included from getTextRenderer.cpp:8:0:
TextRendererFT2.h:4:10: fatal error: ft2build.h: No such file or directory
#include <ft2build.h>
compilation terminated.
Makefile:458: recipe for target 'getTextRenderer.o' failed
make[3]: *** [getTextRenderer.o] Error 1
MY INSTALLED FREETYPE FILES:
ls /usr/include/freetype2/freetype/config
ftconfig.h ftheader.h ftmodule.h ftoption.h ftstdlib.h
ls /usr/include/freetype2/freetype
config ftautoh.h ftbzip2.h ftcid.h ftgasp.h ftimage.h ftlzw.h ftmoderr.h ftpfr.h ftstroke.h ftttdrv.h ttnameid.h
freetype.h ftbbox.h ftcache.h fterrdef.h ftglyph.h ftincrem.h ftmac.h ftotval.h ftrender.h ftsynth.h fttypes.h tttables.h
ft2build.h ftbdf.h ftcffdrv.h fterrors.h ftgxval.h ftlcdfil.h ftmm.h ftoutln.h ftsizes.h ftsystem.h ftwinfnt.h tttags.h
ftadvanc.h ftbitmap.h ftchapters.h ftfntfmt.h ftgzip.h ftlist.h ftmodapi.h ftpcfdrv.h ftsnames.h fttrigon.h t1tables.h ttunpat.h
ls /usr/include/freetype2
freetype ft2build.h
MAKEFILE INCLUDES THESE LINES:
FREETYPE2_CFLAGS = -I/usr/include/freetype2 -I/usr/include/libpng16
FREETYPE2_LIBS = -lfreetype
FREETYPE_CFLAGS =
FREETYPE_LIBS =
They have there a mix of FREETYPE and FREETYPE2 variables for some reason. I managed to make it compile with those changes:
In src/libdisplay/Makefile.am:
--- src/libdisplay/Makefile.am.old 2022-02-27 22:21:56.089575296 +0100
+++ src/libdisplay/Makefile.am 2022-02-27 22:22:13.424197851 +0100
## -26,7 +26,7 ##
EXTRA_libdisplay_a_SOURCES = DisplayMacAqua.cpp DisplayMacAqua.h DisplayMSWin.cpp DisplayMSWin.h TextRendererFT2.cpp TextRendererFT2.h TextRendererPangoFT2.cpp TextRendererPangoFT2.h DisplayX11.cpp DisplayX11.h vroot.h TimerMacAqua.cpp TimerMacAqua.h TimerX11.cpp TimerX11.h
-AM_CPPFLAGS = -I#top_srcdir#/src #X_CFLAGS# #FREETYPE_CFLAGS#
+AM_CPPFLAGS = -I#top_srcdir#/src #X_CFLAGS# #FREETYPE2_CFLAGS#
if USE_AR
libdisplay_a_AR = $(AR) cru
In src/Makefile.am:
--- src/Makefile.am.old 2022-02-27 22:22:02.953029931 +0100
+++ src/Makefile.am 2022-02-27 22:22:31.438766211 +0100
## -8,7 +8,7 ##
parsegeom = ParseGeom.c ParseGeom.h
endif
-AM_CPPFLAGS = -DDATADIR=\"$(datadir)#separator#xplanet\" #X_CFLAGS# #FREETYPE_CFLAGS#
+AM_CPPFLAGS = -DDATADIR=\"$(datadir)#separator#xplanet\" #X_CFLAGS# #FREETYPE2_CFLAGS#
AM_LDFLAGS = #xplanet_LDFLAGS#
xplanet_SOURCES = \
## -72,5 +72,5 ##
libprojection/libprojection.a \
libsgp4sdp4/libsgp4sdp4.a \
#GRAPHICS_LIBS# #CSPICE_LIBS# #X_LIBS# \
- #XSS_LIBS# #FREETYPE_LIBS# #AQUA_LIBS# \
+ #XSS_LIBS# #FREETYPE2_LIBS# #AQUA_LIBS# \
#LIBICONV# #LIBCHARSET#
The solution above was completely successful. FREETYPE2 was misspelled in three places as FREETYPE in "src/Makefile.am" Installation had no further problems
Molly
Feb 27 at 22:50

Configuring NetCDF with CMake to build a model on Ubuntu

New to Linux and CMake ,I'm trying to build a model (SCHISM) with CMake and I have an error about the netCDF libraries...
The path is :
This netCDF 4.7.3 has been built with the following features:
--cc -> /usr/bin/cc
--cflags -> -I/usr/include -I/usr/include/hdf5/serial
--libs -> -L/usr/lib/x86_64-linux-gnu -L/usr/lib/x86_64-linux-gnu/hdf5/serial -lnetcdf
--static -> -lhdf5_hl -lhdf5 -lpthread -lsz -lz -ldl -lm -lcurl
--has-fortran -> yes
--fc -> gfortran
--fflags -> -I/usr/include
--flibs -> -L/usr/lib/x86_64-linux-gnu -lnetcdff -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -lnetcdf -lnetcdf -ldl -lm
So I set the path like this in my script TEST:
set(NetCDF_FORTRAN_DIR "/usr/lib/" CACHE PATH "Path to NetCDF Fortran library")
set(NetCDF_C_DIR "/usr/lib/" CACHE PATH "Path to NetCDF C library")
Then I did the command : $ cmake -C TEST
And I obtained this error:
### Configuring NetCDF
-- NetCDF include file /usr/include/netcdf.inc will be searched for define values
CMake Error at /home/christelle/Model/schism/cmake/modules/FindNetCDF.cmake:264 (message):
Can not locate NetCDF C library
Call Stack (most recent call first):
CMakeLists.txt:129 (find_package)
CMake Warning at /home/christelle/Model/schism/cmake/modules/FindNetCDF.cmake:268 (message):
********
Can not locate separate NetCDF Fortran library (netcdff) in your NetCDF
Installation.
For older versions of NetCDF the fortran library was not separate
(everything was in the netcdf library) and this is not a problem.
If you experience a lot of linker errors for symbols starting with 'nf_' ,
lack of netcdff is a likely cause.
Call Stack (most recent call first):
CMakeLists.txt:129 (find_package)
CMake Error at /usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:146 (message):
Could NOT find NetCDF (missing: NetCDF_LIBRARIES)
Call Stack (most recent call first):
/usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:393 (_FPHSA_FAILURE_MESSAGE)
/home/christelle/Model/schism/cmake/modules/FindNetCDF.cmake:336 (find_package_handle_standard_args)
CMakeLists.txt:129 (find_package)
-- Configuring incomplete, errors occurred!
See also "/home/christelle/Model/schism/build/CMakeFiles/CMakeOutput.log".
What am I doing wrong?
Could you help me please?
Here is the script for FindNetCDF.cmake:
# -*- mode: cmake -*-
#
# MSTK NetCDF Find Module
# Shamelessly stolen from Amanzi open source code https://software.lanl.gov/ascem/trac
#
# Usage:
# Control the search through NetCDF_DIR or setting environment variable
# NetCDF_ROOT to the NetCDF installation prefix.
#
# This module does not search default paths!
#
# Following variables are set:
# NetCDF_FOUND (BOOL) Flag indicating if NetCDF was found
# NetCDF_INCLUDE_DIR (PATH) Path to the NetCDF include file
# NetCDF_INCLUDE_DIRS (LIST) List of all required include files
# NetCDF_LIBRARY_DIR (PATH) Path to the NetCDF library
# NetCDF_LIBRARY (FILE) NetCDF library
# NetCDF_LIBRARIES (LIST) List of all required NetCDF libraries
#
# Additional variables set
# NetCDF_C_LIBRARY_DIR (PATH) Path to the NetCDF C library
# NetCDF_C_LIBRARY (FILE) NetCDF C library
# NetCDF_CXX_LIBRARY (FILE) NetCDF C++ library
# NetCDF_LARGE_DIMS (BOOL) Checks the header files for size of
# NC_MAX_DIMS, NC_MAX_VARS and NC_MAX_VARS_DIMS
# Returns TRUE if
# NC_MAX_DIMS >= 655363
# NC_MAX_VARS >= 524288
# NC_MAX_VAR_DIMS >= 8
#
# #############################################################################
# Standard CMake modules see CMAKE_ROOT/Modules
include(FindPackageHandleStandardArgs)
# MSTK CMake functions see <root>/cmake/modules for source
#include(PrintVariable)
#include(AddPackageDependency)
if ( NetCDF_LIBRARIES AND NetCDF_INCLUDE_DIRS )
# Do nothing. Variables are set. No need to search again
else(NetCDF_LIBRARIES AND NetCDF_INCLUDE_DIRS)
# Cache variables
if(NetCDF_DIR)
set(NetCDF_DIR "${NetCDF_DIR}" CACHE PATH "Path to search for NetCDF include and library files")
endif()
if(NetCDF_INCLUDE_DIR)
set(NetCDF_INCLUDE_DIR "${NetCDF_INCLUDE_DIR}" CACHE PATH "Path to search for NetCDF include files")
endif()
if(NetCDF_LIBRARY_DIR)
set(NetCDF_LIBRARY_DIR "${NetCDF_LIBRARY_DIR}" CACHE PATH "Path to search for NetCDF library files")
endif()
# Search for include files
# Search order preference:
# (1) NetCDF_INCLUDE_DIR - check existence of path AND if the include files exist
# (2) NetCDF_DIR/<include>
# (3) Default CMake paths See cmake --html-help=out.html file for more information.
#
set(netcdf_inc_names "netcdf.inc")
if (NetCDF_INCLUDE_DIR)
if (EXISTS "${NetCDF_INCLUDE_DIR}")
find_path(cdf_test_include_path
NAMES ${netcdf_inc_names}
HINTS ${NetCDF_INCLUDE_DIR}
NO_DEFAULT_PATH)
if(NOT cdf_test_include_path)
message(SEND_ERROR "Can not locate ${netcdf_inc_names} in ${NetCDF_INCLUDE_DIR}")
endif()
set(NetCDF_INCLUDE_DIR "${cdf_test_include_path}")
else()
message(SEND_ERROR "NetCDF_INCLUDE_DIR=${NetCDF_INCLUDE_DIR} does not exist")
set(NetCDF_INCLUDE_DIR "NetCDF_INCLUDE_DIR-NOTFOUND")
endif()
else()
set(netcdf_inc_suffixes "include")
if(NetCDF_DIR)
if (EXISTS "${NetCDF_DIR}" )
find_path(NetCDF_INCLUDE_DIR
NAMES ${netcdf_inc_names}
HINTS ${NetCDF_DIR}
PATH_SUFFIXES ${netcdf_inc_suffixes}
NO_DEFAULT_PATH)
else()
message(SEND_ERROR "NetCDF_DIR=${NetCDF_DIR} does not exist")
set(NetCDF_INCLUDE_DIR "NetCDF_INCLUDE_DIR-NOTFOUND")
endif()
elseif(NetCDF_FORTRAN_DIR)
if (EXISTS "${NetCDF_FORTRAN_DIR}" )
find_path(NetCDF_INCLUDE_DIR
NAMES ${netcdf_inc_names}
HINTS ${NetCDF_FORTRAN_DIR}
PATH_SUFFIXES ${netcdf_inc_suffixes}
NO_DEFAULT_PATH)
else()
message(SEND_ERROR "NetCDF_FORTRAN_DIR=${NetCDF_FORTRAN_DIR} does not exist")
set(NetCDF_INCLUDE_DIR "NetCDF_INCLUDE_DIR-NOTFOUND")
endif()
else()
find_path(NetCDF_INCLUDE_DIR
NAMES ${netcdf_inc_names}
PATH_SUFFIXES ${netcdf_inc_suffixes})
endif()
endif()
if ( NOT NetCDF_INCLUDE_DIR )
message(SEND_ERROR "Can not locate NetCDF include directory")
endif()
# Large dimension check here
if ( NetCDF_INCLUDE_DIR )
set(netcdf_h "${NetCDF_INCLUDE_DIR}/netcdf.inc" )
message(STATUS "NetCDF include file ${netcdf_h} will be searched for define values")
file(STRINGS "${netcdf_h}" netcdf_max_dims_string REGEX "^#define NC_MAX_DIMS")
string(REGEX REPLACE "[^0-9]" "" netcdf_max_dims "${netcdf_max_dims_string}")
file(STRINGS "${netcdf_h}" netcdf_max_vars_string REGEX "^#define NC_MAX_VARS")
string(REGEX REPLACE "[^0-9]" "" netcdf_max_vars "${netcdf_max_vars_string}")
file(STRINGS "${netcdf_h}" netcdf_max_var_dims_string REGEX "^#define NC_MAX_VAR_DIMS")
string(REGEX REPLACE "[^0-9]" "" netcdf_max_var_dims "${netcdf_max_var_dims_string}")
#if (
# ( (netcdf_max_dims EQUAL 65536) OR (netcdf_max_dims GREATER 65536) ) AND
# ( (netcdf_max_vars EQUAL 524288) OR (netcdf_max_vars GREATER 524288) ) AND
# ( (netcdf_max_var_dims EQUAL 8) OR (netcdf_max_var_dims GREATER 8) )
# )
# set(NetCDF_LARGE_DIMS TRUE)
#else()
# message(WARNING "The NetCDF found in ${NetCDF_DIR} does not have the correct NC_MAX_DIMS, NC_MAX_VARS and NC_MAX_VAR_DIMS\n"
# "It may not be compatible with other TPL libraries such MOAB and ExodusII\n" )
# set(NetCDF_LARGE_DIMS FALSE)
#endif()
endif()
# Search for libraries
# Search order preference:
# (1) NetCDF_LIBRARY_DIR - check existence of path AND if the include files exist
# (2) NetCDF_DIR/<lib,Lib>
# (3) Default CMake paths See cmake --html-help=out.html file for more information.
#
if (NetCDF_LIBRARY_DIR)
if (EXISTS "${NetCDF_LIBRARY_DIR}")
if (NOT EXISTS "${NetCDF_C_LIBRARY_DIR}")
set(NetCDF_C_LIBRARY_DIR "${NetCDF_LIBRARY_DIR}")
endif()
find_library(NetCDF_C_LIBRARY
NAMES netcdf
HINTS ${NetCDF_C_LIBRARY_DIR}
NO_DEFAULT_PATH)
find_library(NetCDF_Fortran_LIBRARY
NAMES netcdff
HINTS ${NetCDF_FORTRAN_LIBRARY_DIR}
NO_DEFAULT_PATH)
else()
message(SEND_ERROR "NetCDF_LIBRARY_DIR=${NetCDF_LIBRARY_DIR} does not exist")
set(NetCDF_LIBRARY "NetCDF_C_LIBRARY-NOTFOUND")
# set(NetCDF_LIBRARY "NetCDF_CXX_LIBRARY-NOTFOUND")
endif()
else()
if(NetCDF_DIR)
if (EXISTS "${NetCDF_DIR}" )
find_library(NetCDF_C_LIBRARY
NAMES netcdf
HINTS ${NetCDF_DIR}
PATH_SUFFIXES "lib" "Lib"
NO_DEFAULT_PATH)
find_library(NetCDF_Fortran_LIBRARY
NAMES netcdff
HINTS ${NetCDF_DIR}
PATH_SUFFIXES "lib" "Lib"
NO_DEFAULT_PATH)
# find_library(NetCDF_CXX_LIBRARY
# NAMES netcdf_c++
# HINTS ${NetCDF_DIR}
# PATH_SUFFIXES "lib" "Lib"
# NO_DEFAULT_PATH)
else()
message(SEND_ERROR "NetCDF_DIR=${NetCDF_DIR} does not exist")
set(NetCDF_LIBRARY "NetCDF_C_LIBRARY-NOTFOUND")
set(NetCDF_LIBRARY "NetCDF_FORTRAN_LIBRARY-NOTFOUND")
endif()
else()
if(NetCDF_C_DIR)
if (EXISTS "${NetCDF_C_DIR}")
find_library(NetCDF_C_LIBRARY
NAMES netcdf
HINTS ${NetCDF_C_DIR}
PATH_SUFFIXES "lib" "Lib"
NO_DEFAULT_PATH)
else()
message(SEND_ERROR "NetCDF_C_DIR=${NetCDF_C_DIR} does not exist")
set(NetCDF_LIBRARY "NetCDF_C_LIBRARY-NOTFOUND")
endif()
endif()
if(NetCDF_FORTRAN_DIR)
if (EXISTS "${NetCDF_FORTRAN_DIR}")
find_library(NetCDF_Fortran_LIBRARY
NAMES netcdff
HINTS ${NetCDF_FORTRAN_DIR}
PATH_SUFFIXES "lib" "Lib"
NO_DEFAULT_PATH)
else()
message(SEND_ERROR "NetCDF_FORTRAN_DIR=${NetCDF_FORTRAN_DIR} does not exist")
set(NetCDF_LIBRARY "NetCDF_FORTRAN_LIBRARY-NOTFOUND")
endif()
endif()
# find_library(NetCDF_C_LIBRARY
# NAMES netcdf
# PATH_SUFFIXES ${netcdf_lib_suffixes})
# find_library(NetCDF_Fortran_LIBRARY
# NAMES netcdff
# PATH_SUFFIXES ${netcdf_lib_suffixes})
# endif()
endif()
endif()
if ( NOT NetCDF_C_LIBRARY )
message(SEND_ERROR "Can not locate NetCDF C library")
endif()
if ( NOT NetCDF_Fortran_LIBRARY )
message(WARNING "\n********\nCan not locate separate NetCDF Fortran library (netcdff) in your NetCDF Installation. \nFor older versions of NetCDF the fortran library was not separate (everything was in the netcdf library) and this is not a problem. \nIf you experience a lot of linker errors for symbols starting with 'nf_' , lack of netcdff is a likely cause.")
endif()
# if ( NOT NetCDF_CXX_LIBRARY )
# message(SEND_ERROR "Can not locate NetCDF CXX library")
# endif()
# Define the LIBRARIES and INCLUDE_DORS
set(NetCDF_INCLUDE_DIRS ${NetCDF_INCLUDE_DIR})
set(NetCDF_LIBRARIES ${NetCDF_C_LIBRARY} ${NetCDF_Fortran_LIBRARY})
# Need to find the NetCDF config script to check for HDF5
if ( NetCDF_DIR OR NetCDF_BIN_DIR )
find_program(netcdf_config nc-config
HINTS ${NetCDF_DIR} ${NetCDF_BIN_DIR}
PATH_SUFFIXES bin Bin
DOC "NetCDF configuration script")
if (netcdf_config AND (NOT (${CMAKE_SYSTEM_NAME} MATCHES "Windows")))
message(STATUS "Found NetCDF configuration script: ${netcdf_config}")
execute_process(COMMAND "${netcdf_config}" "--has-hdf5"
RESULT_VARIABLE _ret_code
OUTPUT_VARIABLE _stdout
ERROR_VARIABLE _stderr
)
string(REGEX REPLACE "[\n\r ]" "" _hdf5_answer ${_stdout})
message(STATUS "${netcdf_config} --has-hdf5 returned '${_hdf5_answer}'")
string(COMPARE EQUAL "${_hdf5_answer}" "yes" _has_hdf5)
if (${_has_hdf5} )
set(NetCDF_NEEDS_HDF5 True)
else()
message(STATUS "NetCDF does not require HDF5")
endif()
execute_process(COMMAND "${netcdf_config}" "--version"
RESULT_VARIABLE _ret_code
OUTPUT_VARIABLE _stdout
ERROR_VARIABLE _stderr
)
string(REGEX REPLACE "[\n\r ]" "" _netcdf_version ${_stdout})
string(REGEX REPLACE "netCDF" "" _netcdf_version ${_netcdf_version})
message(STATUS "netcdf version: ${_netcdf_version}")
if(${_netcdf_version} VERSION_GREATER "4")
set( NETCDF_4 TRUE)
message(STATUS "support nc4:${NETCDF_4}")
endif()
else()
if (NOT DEFINED NetCDF_NEEDS_HDF5)
message(SEND_ERROR "netcdf_config not available, NetCDF_NEEDS_HDF5 must be set manually")
endif()
endif()
endif()
if(NetCDF_NEEDS_HDF5)
message(STATUS "NetCDF requires HDF5")
#add_package_dependency(NetCDF DEPENDS_ON HDF5)
endif()
endif(NetCDF_LIBRARIES AND NetCDF_INCLUDE_DIRS )
# Send useful message if everything is found
find_package_handle_standard_args(NetCDF DEFAULT_MSG
NetCDF_LIBRARIES
NetCDF_INCLUDE_DIRS)
# find_package)handle)standard_args should set NetCDF_FOUND but it does not!
if ( NetCDF_LIBRARIES AND NetCDF_INCLUDE_DIRS)
set(NetCDF_FOUND TRUE)
else()
set(NetCDF_FOUND FALSE)
endif()
mark_as_advanced(
NetCDF_INCLUDE_DIR
NetCDF_INCLUDE_DIRS
NetCDF_C_LIBRARY
NetCDF_CXX_LIBRARY
NetCDF_LIBRARIES
NetCDF_LIBRARY_DIR
)
Thanks

Can't install c2hs and language-c

I'm using cabal here to install package c2hs. However, it requires happy, so I installed happy with cabal install happy.
After, when trying to install c2hs and language-c I get package happy not found on both.
Here's the terminal log:
~> cabal install happy
Resolving dependencies...
[1 of 1] Compiling Main ( /tmp/happy-1.18.9-12936/happy-1.18.9/Setup.lhs, /tmp/happy-1.18.9-12936/happy-1.18.9/dist/setup/Main.o )
/tmp/happy-1.18.9-12936/happy-1.18.9/Setup.lhs:6:52:
Warning: In the use of `buildVerbose'
(imported from Distribution.Simple.Setup):
Deprecated: "Use buildVerbosity instead"
/tmp/happy-1.18.9-12936/happy-1.18.9/Setup.lhs:7:52:
Warning: In the use of `defaultUserHooks'
(imported from Distribution.Simple):
Deprecated: "Use simpleUserHooks or autoconfUserHooks, unless you need Cabal-1.2
compatibility in which case you must stick with defaultUserHooks"
/tmp/happy-1.18.9-12936/happy-1.18.9/Setup.lhs:12:26:
Warning: In the use of `try'
(imported from System.IO.Error):
Deprecated: "Please use the new exceptions variant, Control.Exception.try"
Linking /tmp/happy-1.18.9-12936/happy-1.18.9/dist/setup/setup ...
Warning: defaultUserHooks in Setup script is deprecated.
Configuring happy-1.18.9...
Building happy-1.18.9...
Preprocessing executable 'happy' for happy-1.18.9...
[ 1 of 18] Compiling NameSet ( src/NameSet.hs, dist/build/happy/happy-tmp/NameSet.o )
[ 2 of 18] Compiling Target ( src/Target.lhs, dist/build/happy/happy-tmp/Target.o )
[ 3 of 18] Compiling AbsSyn ( src/AbsSyn.lhs, dist/build/happy/happy-tmp/AbsSyn.o )
[ 4 of 18] Compiling ParamRules ( src/ParamRules.hs, dist/build/happy/happy-tmp/ParamRules.o )
[ 5 of 18] Compiling GenUtils ( src/GenUtils.lhs, dist/build/happy/happy-tmp/GenUtils.o )
[ 6 of 18] Compiling ParseMonad ( src/ParseMonad.lhs, dist/build/happy/happy-tmp/ParseMonad.o )
[ 7 of 18] Compiling Lexer ( src/Lexer.lhs, dist/build/happy/happy-tmp/Lexer.o )
[ 8 of 18] Compiling Parser ( dist/build/happy/happy-tmp/Parser.hs, dist/build/happy/happy-tmp/Parser.o )
[ 9 of 18] Compiling AttrGrammar ( src/AttrGrammar.lhs, dist/build/happy/happy-tmp/AttrGrammar.o )
[10 of 18] Compiling AttrGrammarParser ( dist/build/happy/happy-tmp/AttrGrammarParser.hs, dist/build/happy/happy-tmp/AttrGrammarParser.o )
[11 of 18] Compiling Grammar ( src/Grammar.lhs, dist/build/happy/happy-tmp/Grammar.o )
[12 of 18] Compiling First ( src/First.lhs, dist/build/happy/happy-tmp/First.o )
[13 of 18] Compiling LALR ( src/LALR.lhs, dist/build/happy/happy-tmp/LALR.o )
[14 of 18] Compiling Paths_happy ( dist/build/autogen/Paths_happy.hs, dist/build/happy/happy-tmp/Paths_happy.o )
[15 of 18] Compiling ProduceCode ( src/ProduceCode.lhs, dist/build/happy/happy-tmp/ProduceCode.o )
[16 of 18] Compiling ProduceGLRCode ( src/ProduceGLRCode.lhs, dist/build/happy/happy-tmp/ProduceGLRCode.o )
[17 of 18] Compiling Info ( src/Info.lhs, dist/build/happy/happy-tmp/Info.o )
[18 of 18] Compiling Main ( src/Main.lhs, dist/build/happy/happy-tmp/Main.o )
Linking dist/build/happy/happy ...
Installing executable(s) in /home/david/.cabal/bin
~> cabal install c2hs
Resolving dependencies...
Configuring language-c-0.3.2.1...
cabal: The program happy is required but it could not be found.
cabal: Error: some packages failed to install:
c2hs-0.16.3 depends on language-c-0.3.2.1 which failed to install.
language-c-0.3.2.1 failed during the configure step. The exception was:
ExitFailure 1
exit 1
~> cabal install language-c
Resolving dependencies...
Configuring language-c-0.4.2...
cabal: The program happy is required but it could not be found.
cabal: Error: some packages failed to install:
language-c-0.4.2 failed during the configure step. The exception was:
ExitFailure 1
exit 1
~>
Any ideas? Thank you.
I had to add ~/.cabal/bin to my path, and then it worked.

gtk2hs installation

hello I got some error
on windows xp sp3,
I tried
install up to date Haskell platform
install gtk+ all in one bundle 2.16
add MinGW's bin address to PATH Environment variables
add GTK+'s bin address to PATH Environment variables
and on CMD
I execute the
cabal update
cabal install gtk2hs-buildtools
so far so good
but when I execute the
cabal install gtk
the error arise
here's dump
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.
C:\Documents and Settings\dreambook>cabal install gtk
Resolving dependencies...
C:\DOCUME~1\DREAMB~1\LOCALS~1\Temp\cairo-0.12.0808\cairo-0.12.0\Gtk2HsSetup.hs:2
5:2: warning: #warning Setup.hs is guessing the version of Cabal. If compilation
of Setup.hs fails use -DCABAL_VERSION_MINOR=x for Cabal version 1.x.0 when buil
ding (prefixed by --ghc-option= when using the 'cabal' command)
[1 of 2] Compiling Gtk2HsSetup ( C:\DOCUME~1\DREAMB~1\LOCALS~1\Temp\cairo-0
.12.0808\cairo-0.12.0\Gtk2HsSetup.hs, C:\DOCUME~1\DREAMB~1\LOCALS~1\Temp\cairo-0
.12.0808\cairo-0.12.0\dist\setup\Gtk2HsSetup.o )
[2 of 2] Compiling Main ( C:\DOCUME~1\DREAMB~1\LOCALS~1\Temp\cairo-0
.12.0808\cairo-0.12.0\Setup.hs, C:\DOCUME~1\DREAMB~1\LOCALS~1\Temp\cairo-0.12.08
08\cairo-0.12.0\dist\setup\Main.o )
Linking C:\DOCUME~1\DREAMB~1\LOCALS~1\Temp\cairo-0.12.0808\cairo-0.12.0\dist\set
up\setup.exe ...
Configuring cairo-0.12.0...
Preprocessing library cairo-0.12.0...
Building cairo-0.12.0...
[ 1 of 17] Compiling Graphics.Rendering.Cairo.Matrix ( dist\build\Graphics\Rende
ring\Cairo\Matrix.hs, dist\build\Graphics\Rendering\Cairo\Matrix.o )
[ 2 of 17] Compiling Graphics.Rendering.Cairo.Types ( dist\build\Graphics\Render
ing\Cairo\Types.hs, dist\build\Graphics\Rendering\Cairo\Types.o )
[ 3 of 17] Compiling Graphics.Rendering.Cairo.Internal.Drawing.Cairo ( dist\buil
d\Graphics\Rendering\Cairo\Internal\Drawing\Cairo.hs, dist\build\Graphics\Render
ing\Cairo\Internal\Drawing\Cairo.o )
[ 4 of 17] Compiling Graphics.Rendering.Cairo.Internal.Drawing.Paths ( dist\buil
d\Graphics\Rendering\Cairo\Internal\Drawing\Paths.hs, dist\build\Graphics\Render
ing\Cairo\Internal\Drawing\Paths.o )
[ 5 of 17] Compiling Graphics.Rendering.Cairo.Internal.Drawing.Patterns ( dist\b
uild\Graphics\Rendering\Cairo\Internal\Drawing\Patterns.hs, dist\build\Graphics\
Rendering\Cairo\Internal\Drawing\Patterns.o )
[ 6 of 17] Compiling Graphics.Rendering.Cairo.Internal.Drawing.Text ( dist\build
\Graphics\Rendering\Cairo\Internal\Drawing\Text.hs, dist\build\Graphics\Renderin
g\Cairo\Internal\Drawing\Text.o )
[ 7 of 17] Compiling Graphics.Rendering.Cairo.Internal.Drawing.Transformations (
dist\build\Graphics\Rendering\Cairo\Internal\Drawing\Transformations.hs, dist\b
uild\Graphics\Rendering\Cairo\Internal\Drawing\Transformations.o )
[ 8 of 17] Compiling Graphics.Rendering.Cairo.Internal.Fonts.FontOptions ( dist\
build\Graphics\Rendering\Cairo\Internal\Fonts\FontOptions.hs, dist\build\Graphic
s\Rendering\Cairo\Internal\Fonts\FontOptions.o )
[ 9 of 17] Compiling Graphics.Rendering.Cairo.Internal.Surfaces.Image ( dist\bui
ld\Graphics\Rendering\Cairo\Internal\Surfaces\Image.hs, dist\build\Graphics\Rend
ering\Cairo\Internal\Surfaces\Image.o )
[10 of 17] Compiling Graphics.Rendering.Cairo.Internal.Surfaces.PDF ( dist\build
\Graphics\Rendering\Cairo\Internal\Surfaces\PDF.hs, dist\build\Graphics\Renderin
g\Cairo\Internal\Surfaces\PDF.o )
[11 of 17] Compiling Graphics.Rendering.Cairo.Internal.Surfaces.PNG ( dist\build
\Graphics\Rendering\Cairo\Internal\Surfaces\PNG.hs, dist\build\Graphics\Renderin
g\Cairo\Internal\Surfaces\PNG.o )
[12 of 17] Compiling Graphics.Rendering.Cairo.Internal.Surfaces.PS ( dist\build\
Graphics\Rendering\Cairo\Internal\Surfaces\PS.hs, dist\build\Graphics\Rendering\
Cairo\Internal\Surfaces\PS.o )
[13 of 17] Compiling Graphics.Rendering.Cairo.Internal.Surfaces.SVG ( dist\build
\Graphics\Rendering\Cairo\Internal\Surfaces\SVG.hs, dist\build\Graphics\Renderin
g\Cairo\Internal\Surfaces\SVG.o )
[14 of 17] Compiling Graphics.Rendering.Cairo.Internal.Surfaces.Surface ( dist\b
uild\Graphics\Rendering\Cairo\Internal\Surfaces\Surface.hs, dist\build\Graphics\
Rendering\Cairo\Internal\Surfaces\Surface.o )
[15 of 17] Compiling Graphics.Rendering.Cairo.Internal.Utilities ( dist\build\Gr
aphics\Rendering\Cairo\Internal\Utilities.hs, dist\build\Graphics\Rendering\Cair
o\Internal\Utilities.o )
[16 of 17] Compiling Graphics.Rendering.Cairo.Internal ( Graphics\Rendering\Cair
o\Internal.hs, dist\build\Graphics\Rendering\Cairo\Internal.o )
[17 of 17] Compiling Graphics.Rendering.Cairo ( Graphics\Rendering\Cairo.hs, dis
t\build\Graphics\Rendering\Cairo.o )
Registering cairo-0.12.0...
Installing library in C:\Documents and Settings\dreambook\Application
Data\cabal\cairo-0.12.0\ghc-7.0.3
Registering cairo-0.12.0...
setup.exe: internal error: unexpected package db stack: [UserPackageDB]
C:\DOCUME~1\DREAMB~1\LOCALS~1\Temp\glib-0.12.0808\glib-0.12.0\Gtk2HsSetup.hs:25:
2: warning: #warning Setup.hs is guessing the version of Cabal. If compilation o
f Setup.hs fails use -DCABAL_VERSION_MINOR=x for Cabal version 1.x.0 when buildi
ng (prefixed by --ghc-option= when using the 'cabal' command)
[1 of 2] Compiling Gtk2HsSetup ( C:\DOCUME~1\DREAMB~1\LOCALS~1\Temp\glib-0.
12.0808\glib-0.12.0\Gtk2HsSetup.hs, C:\DOCUME~1\DREAMB~1\LOCALS~1\Temp\glib-0.12
.0808\glib-0.12.0\dist\setup\Gtk2HsSetup.o )
[2 of 2] Compiling Main ( C:\DOCUME~1\DREAMB~1\LOCALS~1\Temp\glib-0.
12.0808\glib-0.12.0\Setup.hs, C:\DOCUME~1\DREAMB~1\LOCALS~1\Temp\glib-0.12.0808\
glib-0.12.0\dist\setup\Main.o )
Linking C:\DOCUME~1\DREAMB~1\LOCALS~1\Temp\glib-0.12.0808\glib-0.12.0\dist\setup
\setup.exe ...
Configuring glib-0.12.0...
Preprocessing library glib-0.12.0...
Building glib-0.12.0...
[ 1 of 20] Compiling System.Glib.Attributes ( System\Glib\Attributes.hs, dist\bu
ild\System\Glib\Attributes.o )
[ 2 of 20] Compiling System.Glib.Flags ( System\Glib\Flags.hs, dist\build\System
\Glib\Flags.o )
[ 3 of 20] Compiling System.Glib.FFI ( System\Glib\FFI.hs, dist\build\System\Gl
ib\FFI.o )
[ 4 of 20] Compiling System.Glib.Types ( dist\build\System\Glib\Types.hs, dist\b
uild\System\Glib\Types.o )
[ 5 of 20] Compiling System.Glib.GList ( dist\build\System\Glib\GList.hs, dist\b
uild\System\Glib\GList.o )
[ 6 of 20] Compiling System.Glib.GType ( dist\build\System\Glib\GType.hs, dist\b
uild\System\Glib\GType.o )
[ 7 of 20] Compiling System.Glib.GValue ( dist\build\System\Glib\GValue.hs, dist
\build\System\Glib\GValue.o )
[ 8 of 20] Compiling System.Glib.GParameter ( dist\build\System\Glib\GParameter.
hs, dist\build\System\Glib\GParameter.o )
[ 9 of 20] Compiling System.Glib.GTypeConstants ( dist\build\System\Glib\GTypeCo
nstants.hs, dist\build\System\Glib\GTypeConstants.o )
[10 of 20] Compiling System.Glib.UTFString ( System\Glib\UTFString.hs, dist\buil
d\System\Glib\UTFString.o )
[11 of 20] Compiling System.Glib.GObject ( dist\build\System\Glib\GObject.hs, di
st\build\System\Glib\GObject.o )
[12 of 20] Compiling System.Glib.GValueTypes ( dist\build\System\Glib\GValueType
s.hs, dist\build\System\Glib\GValueTypes.o )
[13 of 20] Compiling System.Glib.Properties ( dist\build\System\Glib\Properties.
hs, dist\build\System\Glib\Properties.o )
[14 of 20] Compiling System.Glib.StoreValue ( dist\build\System\Glib\StoreValue.
hs, dist\build\System\Glib\StoreValue.o )
System\Glib\StoreValue.hsc:38:1:
Warning: Module `Control.OldException' is deprecated:
Future versions of base will not support the old exceptions style
. Please switch to extensible exceptions.
System\Glib\StoreValue.hsc:38:1:
Warning: In the use of data constructor `AssertionFailed'
(imported from Control.OldException):
Deprecated: "Future versions of base will not support the old excep
tions style. Please switch to extensible exceptions."
[15 of 20] Compiling System.Glib.Signals ( dist\build\System\Glib\Signals.hs, di
st\build\System\Glib\Signals.o )
[16 of 20] Compiling System.Glib.MainLoop ( dist\build\System\Glib\MainLoop.hs,
dist\build\System\Glib\MainLoop.o )
[17 of 20] Compiling System.Glib.GError ( dist\build\System\Glib\GError.hs, dist
\build\System\Glib\GError.o )
System\Glib\GError.chs:93:1:
Warning: Module `Control.OldException' is deprecated:
Future versions of base will not support the old exceptions style
. Please switch to extensible exceptions.
System\Glib\GError.chs:93:1:
Warning: In the use of `catchDyn'
(imported from Control.OldException):
Deprecated: "Future versions of base will not support the old excep
tions style. Please switch to extensible exceptions."
System\Glib\GError.chs:93:1:
Warning: In the use of `throwDyn'
(imported from Control.OldException):
Deprecated: "Future versions of base will not support the old excep
tions style. Please switch to extensible exceptions."
[18 of 20] Compiling System.Glib.GDateTime ( dist\build\System\Glib\GDateTime.hs
, dist\build\System\Glib\GDateTime.o )
[19 of 20] Compiling System.Glib.Utils ( dist\build\System\Glib\Utils.hs, dist\b
uild\System\Glib\Utils.o )
[20 of 20] Compiling System.Glib ( System\Glib.hs, dist\build\System\Glib.o
)
Registering glib-0.12.0...
Installing library in C:\Documents and Settings\dreambook\Application
Data\cabal\glib-0.12.0\ghc-7.0.3
Registering glib-0.12.0...
setup.exe: internal error: unexpected package db stack: [UserPackageDB]
cabal: Error: some packages failed to install:
cairo-0.12.0 failed during the final install step. The exception was:
ExitFailure 1
gio-0.12.0 depends on glib-0.12.0 which failed to install.
glib-0.12.0 failed during the final install step. The exception was:
ExitFailure 1
gtk-0.12.0 depends on glib-0.12.0 which failed to install.
pango-0.12.0 depends on glib-0.12.0 which failed to install.
You're hitting a bug in Gtk2hsSetup.hs, the bug and a workaround is described here.
I would recommend adding yourself to that ticket on the trac so that you'll be notified when a fix becomes available.
Install those packages in the global package directory using the --global option.
For instance: cabal install cairo --global

Resources