Configuring NetCDF with CMake to build a model on Ubuntu - linux

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

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

crosstools-ng: compiling toolchain for x86_64 linux on OSX - error when installing kernel headers

I'm trying to create a toolchain for x86_64 linux on a 64 bit Mac running OSX 10.9.5 and using crosstool-ng-1.22.0. I have tried building using a number of the samples (x86_64-w64-mingw32,x86_64-pc-linux-gnu and x86_64-unknown-linux-gnu) but I am running into build errors, as shown below. I am not building the gold linker, nor am I attempting to link statically, and I am building on a case-sensitive file system. The build.log and config are shown after the error listing.
It looks as though the build environment is perhaps looking for OSX header files (within /usr/include) when installing/building the kernel headers, rather than Linux ones, but I don't know what to do to fix this.
Can anyone please offer advice for what I need to do to build successfully?
$ ct-ng build
[INFO ] Performing some trivial sanity checks
[INFO ] Build started 20160825.084703
[INFO ] Building environment variables
[WARN ] Directory '/Volumes/CaseSensitiveLinux/ct-ng/src' does not exist.
[WARN ] Will not save downloaded tarballs to local storage.
[EXTRA] Preparing working directories
[EXTRA] Installing user-supplied crosstool-NG configuration
[EXTRA] =================================================================
[EXTRA] Dumping internal crosstool-NG configuration
[EXTRA] Building a toolchain for:
[EXTRA] build = x86_64-apple-darwin13.4.0
[EXTRA] host = x86_64-apple-darwin13.4.0
[EXTRA] target = x86_64-unknown-linux-gnu
[EXTRA] Dumping internal crosstool-NG configuration: done in 0.00s (at 00:05)
[INFO ] =================================================================
[INFO ] Retrieving needed toolchain components' tarballs
[INFO ] Retrieving needed toolchain components' tarballs: done in 1.00s (at 00:06)
[INFO ] =================================================================
[INFO ] Extracting and patching toolchain components
[INFO ] Extracting and patching toolchain components: done in 0.00s (at 00:06)
[INFO ] =================================================================
[INFO ] Installing ncurses for build
[EXTRA] Configuring ncurses
[EXTRA] Building ncurses
[EXTRA] Installing ncurses
[INFO ] Installing ncurses for build: done in 22.00s (at 00:28)
[INFO ] =================================================================
[INFO ] Installing gettext for build
[EXTRA] Configuring gettext
[EXTRA] Building gettext
[EXTRA] Installing gettext
[INFO ] Installing gettext for build: done in 228.00s (at 04:17)
[INFO ] =================================================================
[INFO ] Installing GMP for host
[EXTRA] Configuring GMP
[EXTRA] Building GMP
[EXTRA] Installing GMP
[INFO ] Installing GMP for host: done in 36.00s (at 04:53)
[INFO ] =================================================================
[INFO ] Installing MPFR for host
[EXTRA] Configuring MPFR
[EXTRA] Building MPFR
[EXTRA] Installing MPFR
[INFO ] Installing MPFR for host: done in 23.00s (at 05:16)
[INFO ] =================================================================
[INFO ] Installing ISL for host
[EXTRA] Configuring ISL
[EXTRA] Building ISL
[EXTRA] Installing ISL
[INFO ] Installing ISL for host: done in 15.00s (at 05:31)
[INFO ] =================================================================
[INFO ] Installing MPC for host
[EXTRA] Configuring MPC
[EXTRA] Building MPC
[EXTRA] Installing MPC
[INFO ] Installing MPC for host: done in 11.00s (at 05:42)
[INFO ] =================================================================
[INFO ] Installing expat for host
[EXTRA] Configuring expat
[EXTRA] Building expat
[EXTRA] Installing expat
[INFO ] Installing expat for host: done in 7.00s (at 05:49)
[INFO ] =================================================================
[INFO ] Installing gettext for host
[EXTRA] Configuring gettext
[EXTRA] Building gettext
[EXTRA] Installing gettext
[INFO ] Installing gettext for host: done in 196.00s (at 09:05)
[INFO ] =================================================================
[INFO ] Installing binutils for host
[EXTRA] Configuring binutils
[EXTRA] Building binutils
[EXTRA] Installing binutils
[INFO ] Installing binutils for host: done in 51.00s (at 09:56)
[INFO ] =================================================================
[INFO ] Installing pass-1 core C gcc compiler
[EXTRA] Configuring core C gcc compiler
[EXTRA] Building gcc
[EXTRA] Installing gcc
[EXTRA] Housekeeping for final gcc compiler
[INFO ] Installing pass-1 core C gcc compiler: done in 154.00s (at 12:30)
[INFO ] =================================================================
[INFO ] Installing kernel headers
[EXTRA] Installing kernel headers
[ERROR] /usr/include/bits/types.h:43:25: error: typedef redefinition with different types ('long' vs 'long long')
[ERROR] /usr/include/bits/types.h:44:27: error: typedef redefinition with different types ('unsigned long' vs 'unsigned long long')
[ERROR] /Volumes/CaseSensitiveLinux/ct-ng/.build/src/linux-3.12.50/arch/x86/tools/relocs.h:15:10: fatal error: 'endian.h' file not found
[ERROR] make[3]: *** [arch/x86/tools/relocs_32.o] Error 1
[ERROR] make[2]: *** [archscripts] Error 2
[ERROR] make[1]: *** [sub-make] Error 2
[ERROR]
[ERROR] >>
[ERROR] >> Build failed in step 'Installing kernel headers'
[ERROR] >> called in step '(top-level)'
[ERROR] >>
[ERROR] >> Error happened in: CT_DoExecLog[scripts/functions#216]
[ERROR] >> called from: do_kernel_install[scripts/build/kernel/linux.sh#119]
[ERROR] >> called from: do_kernel_headers[scripts/build/kernel/linux.sh#91]
[ERROR] >> called from: main[scripts/crosstool-NG.sh#646]
[ERROR] >>
[ERROR] >> For more info on this error, look at the file: 'build.log'
[ERROR] >> There is a list of known issues, some with workarounds, in:
[ERROR] >> '/usr/local/Cellar/crosstool-ng/1.22.0_1/share/doc/crosstool-ng/crosstool-ng-1.22.0/B - Known issues.txt'
[ERROR]
[ERROR] (elapsed: 12:32.00)
[12:32] / make: *** [build] Error 1
Here is the relevant part of the build.log:
[DEBUG] ==> Executing: 'ln' '-sfv' 'x86_64-unknown-linux-gnu-gcc' '/Volumes/CaseSensitiveLinux/ct-ng/.build/x86_64-unknown-linux-gnu/buildtools/bin/x86_64-unknown-linux-gnu-cc'
[ALL ] /Volumes/CaseSensitiveLinux/ct-ng/.build/x86_64-unknown-linux-gnu/buildtools/bin/x86_64-unknown-linux-gnu-cc -> x86_64-unknown-linux-gnu-gcc
[INFO ] Installing pass-1 core C gcc compiler: done in 154.00s (at 12:30)
[INFO ] =================================================================
[INFO ] Installing kernel headers
[DEBUG] Using kernel's headers_install
[EXTRA] Installing kernel headers
[DEBUG] ==> Executing: '/usr/bin/make' '-C' '/Volumes/CaseSensitiveLinux/ct-ng/.build/src/linux-3.12.50' 'CROSS_COMPILE=x86_64-unknown-linux-gnu-' 'O=/Volumes/CaseSensitiveLinux/ct-ng/.build/x86_64-unknown-linux-gnu/build/build-kernel-headers' 'ARCH=x86' 'INSTALL_HDR_PATH=/Volumes/CaseSensitiveLinux/ct-ng/x-tools/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/sysroot/usr' 'V=0' 'headers_install'
[ALL ] CHK include/generated/uapi/linux/version.h
[ALL ] UPD include/generated/uapi/linux/version.h
[ALL ] HOSTCC scripts/basic/fixdep
[ALL ] WRAP arch/x86/include/generated/asm/clkdev.h
[ALL ] SYSHDR arch/x86/syscalls/../include/generated/uapi/asm/unistd_32.h
[ALL ] SYSHDR arch/x86/syscalls/../include/generated/uapi/asm/unistd_64.h
[ALL ] SYSHDR arch/x86/syscalls/../include/generated/uapi/asm/unistd_x32.h
[ALL ] SYSTBL arch/x86/syscalls/../include/generated/asm/syscalls_32.h
[ALL ] HOSTCC arch/x86/tools/relocs_32.o
[ALL ] In file included from /Volumes/CaseSensitiveLinux/ct-ng/.build/src/linux-3.12.50/arch/x86/tools/relocs_32.c:1:
[ALL ] In file included from /Volumes/CaseSensitiveLinux/ct-ng/.build/src/linux-3.12.50/arch/x86/tools/relocs.h:13:
[ALL ] In file included from /usr/include/byteswap.h:24:
[ALL ] In file included from /usr/include/bits/byteswap.h:27:
[ERROR] /usr/include/bits/types.h:43:25: error: typedef redefinition with different types ('long' vs 'long long')
[ALL ] typedef signed long int __int64_t;
[ALL ] ^
[ALL ] /usr/include/i386/_types.h:46:20: note: previous definition is here
[ALL ] typedef long long __int64_t;
[ALL ] ^
[ALL ] In file included from /Volumes/CaseSensitiveLinux/ct-ng/.build/src/linux-3.12.50/arch/x86/tools/relocs_32.c:1:
[ALL ] In file included from /Volumes/CaseSensitiveLinux/ct-ng/.build/src/linux-3.12.50/arch/x86/tools/relocs.h:13:
[ALL ] In file included from /usr/include/byteswap.h:24:
[ALL ] In file included from /usr/include/bits/byteswap.h:27:
[ERROR] /usr/include/bits/types.h:44:27: error: typedef redefinition with different types ('unsigned long' vs 'unsigned long long')
[ALL ] typedef unsigned long int __uint64_t;
[ALL ] ^
[ALL ] /usr/include/i386/_types.h:47:28: note: previous definition is here
[ALL ] typedef unsigned long long __uint64_t;
[ALL ] ^
[ALL ] In file included from /Volumes/CaseSensitiveLinux/ct-ng/.build/src/linux-3.12.50/arch/x86/tools/relocs_32.c:1:
[ERROR] /Volumes/CaseSensitiveLinux/ct-ng/.build/src/linux-3.12.50/arch/x86/tools/relocs.h:15:10: fatal error: 'endian.h' file not found
[ALL ] #include <endian.h>
[ALL ] ^
[ALL ] 3 errors generated.
[ERROR] make[3]: *** [arch/x86/tools/relocs_32.o] Error 1
[ERROR] make[2]: *** [archscripts] Error 2
[ERROR] make[1]: *** [sub-make] Error 2
[ERROR]
[ERROR] >>
[ERROR] >> Build failed in step 'Installing kernel headers'
[ERROR] >> called in step '(top-level)'
[ERROR] >>
[ERROR] >> Error happened in: CT_DoExecLog[scripts/functions#216]
[ERROR] >> called from: do_kernel_install[scripts/build/kernel/linux.sh#119]
[ERROR] >> called from: do_kernel_headers[scripts/build/kernel/linux.sh#91]
[ERROR] >> called from: main[scripts/crosstool-NG.sh#646]
[ERROR] >>
[ERROR] >> For more info on this error, look at the file: 'build.log'
[ERROR] >> There is a list of known issues, some with workarounds, in:
[ERROR] >> '/usr/local/Cellar/crosstool-ng/1.22.0_1/share/doc/crosstool-ng/crosstool-ng-1.22.0/B - Known issues.txt'
[ERROR]
[ERROR] (elapsed: 12:32.00)
Finally, here is the config file:
$ cat .config
#
# Automatically generated file; DO NOT EDIT.
# Crosstool-NG Configuration
#
CT_CONFIGURE_has_make381=y
CT_CONFIGURE_has_xz=y
CT_CONFIGURE_has_svn=y
CT_MODULES=y
#
# Paths and misc options
#
#
# crosstool-NG behavior
#
# CT_OBSOLETE is not set
# CT_EXPERIMENTAL is not set
# CT_DEBUG_CT is not set
#
# Paths
#
CT_LOCAL_TARBALLS_DIR="/Volumes/CaseSensitiveLinux/ct-ng/src"
CT_SAVE_TARBALLS=y
CT_WORK_DIR="/Volumes/CaseSensitiveLinux/ct-ng/.build"
CT_PREFIX_DIR="/Volumes/CaseSensitiveLinux/ct-ng/x-tools/${CT_TARGET}"
CT_INSTALL_DIR="${CT_PREFIX_DIR}"
CT_RM_RF_PREFIX_DIR=y
CT_REMOVE_DOCS=y
CT_INSTALL_DIR_RO=y
CT_STRIP_HOST_TOOLCHAIN_EXECUTABLES=y
# CT_STRIP_TARGET_TOOLCHAIN_EXECUTABLES is not set
#
# Downloading
#
# CT_FORBID_DOWNLOAD is not set
# CT_FORCE_DOWNLOAD is not set
CT_CONNECT_TIMEOUT=10
# CT_ONLY_DOWNLOAD is not set
# CT_USE_MIRROR is not set
#
# Extracting
#
# CT_FORCE_EXTRACT is not set
CT_OVERIDE_CONFIG_GUESS_SUB=y
# CT_ONLY_EXTRACT is not set
CT_PATCH_BUNDLED=y
# CT_PATCH_LOCAL is not set
# CT_PATCH_BUNDLED_LOCAL is not set
# CT_PATCH_LOCAL_BUNDLED is not set
# CT_PATCH_BUNDLED_FALLBACK_LOCAL is not set
# CT_PATCH_LOCAL_FALLBACK_BUNDLED is not set
# CT_PATCH_NONE is not set
CT_PATCH_ORDER="bundled"
#
# Build behavior
#
CT_PARALLEL_JOBS=0
CT_LOAD=""
CT_USE_PIPES=y
CT_EXTRA_CFLAGS_FOR_BUILD=""
CT_EXTRA_LDFLAGS_FOR_BUILD=""
CT_EXTRA_CFLAGS_FOR_HOST=""
CT_EXTRA_LDFLAGS_FOR_HOST=""
# CT_CONFIG_SHELL_SH is not set
# CT_CONFIG_SHELL_ASH is not set
CT_CONFIG_SHELL_BASH=y
# CT_CONFIG_SHELL_CUSTOM is not set
CT_CONFIG_SHELL="${bash}"
#
# Logging
#
# CT_LOG_ERROR is not set
# CT_LOG_WARN is not set
# CT_LOG_INFO is not set
CT_LOG_EXTRA=y
# CT_LOG_ALL is not set
# CT_LOG_DEBUG is not set
CT_LOG_LEVEL_MAX="EXTRA"
# CT_LOG_SEE_TOOLS_WARN is not set
CT_LOG_PROGRESS_BAR=y
CT_LOG_TO_FILE=y
CT_LOG_FILE_COMPRESS=y
#
# Target options
#
CT_ARCH="x86"
CT_ARCH_SUPPORTS_32=y
CT_ARCH_SUPPORTS_64=y
CT_ARCH_SUPPORTS_WITH_ARCH=y
CT_ARCH_SUPPORTS_WITH_CPU=y
CT_ARCH_SUPPORTS_WITH_TUNE=y
CT_ARCH_DEFAULT_32=y
CT_ARCH_ARCH=""
CT_ARCH_CPU=""
CT_ARCH_TUNE=""
# CT_ARCH_32 is not set
CT_ARCH_64=y
CT_ARCH_BITNESS=64
CT_TARGET_CFLAGS=""
CT_TARGET_LDFLAGS=""
# CT_ARCH_alpha is not set
# CT_ARCH_arm is not set
# CT_ARCH_avr is not set
# CT_ARCH_m68k is not set
# CT_ARCH_mips is not set
# CT_ARCH_nios2 is not set
# CT_ARCH_powerpc is not set
# CT_ARCH_s390 is not set
# CT_ARCH_sh is not set
# CT_ARCH_sparc is not set
CT_ARCH_x86=y
# CT_ARCH_xtensa is not set
CT_ARCH_alpha_AVAILABLE=y
CT_ARCH_arm_AVAILABLE=y
CT_ARCH_avr_AVAILABLE=y
CT_ARCH_m68k_AVAILABLE=y
CT_ARCH_microblaze_AVAILABLE=y
CT_ARCH_mips_AVAILABLE=y
CT_ARCH_nios2_AVAILABLE=y
CT_ARCH_powerpc_AVAILABLE=y
CT_ARCH_s390_AVAILABLE=y
CT_ARCH_sh_AVAILABLE=y
CT_ARCH_sparc_AVAILABLE=y
CT_ARCH_x86_AVAILABLE=y
CT_ARCH_xtensa_AVAILABLE=y
CT_ARCH_SUFFIX=""
#
# Generic target options
#
# CT_MULTILIB is not set
CT_ARCH_USE_MMU=y
#
# Target optimisations
#
CT_ARCH_FLOAT=""
#
# Toolchain options
#
#
# General toolchain options
#
CT_FORCE_SYSROOT=y
CT_USE_SYSROOT=y
CT_SYSROOT_NAME="sysroot"
CT_SYSROOT_DIR_PREFIX=""
# CT_STATIC_TOOLCHAIN is not set
CT_TOOLCHAIN_PKGVERSION=""
CT_TOOLCHAIN_BUGURL=""
#
# Tuple completion and aliasing
#
CT_TARGET_VENDOR="unknown"
CT_TARGET_ALIAS_SED_EXPR=""
CT_TARGET_ALIAS=""
#
# Toolchain type
#
CT_CROSS=y
# CT_CANADIAN is not set
CT_TOOLCHAIN_TYPE="cross"
#
# Build system
#
CT_BUILD=""
CT_BUILD_PREFIX=""
CT_BUILD_SUFFIX=""
#
# Misc options
#
# CT_TOOLCHAIN_ENABLE_NLS is not set
#
# Operating System
#
CT_KERNEL_SUPPORTS_SHARED_LIBS=y
CT_KERNEL="linux"
CT_KERNEL_VERSION="3.12.50"
# CT_KERNEL_bare_metal is not set
CT_KERNEL_linux=y
CT_KERNEL_bare_metal_AVAILABLE=y
CT_KERNEL_linux_AVAILABLE=y
# CT_KERNEL_V_4_3 is not set
# CT_KERNEL_V_4_2 is not set
# CT_KERNEL_V_4_1 is not set
# CT_KERNEL_V_3_18 is not set
# CT_KERNEL_V_3_14 is not set
CT_KERNEL_V_3_12=y
# CT_KERNEL_V_3_10 is not set
# CT_KERNEL_V_3_4 is not set
# CT_KERNEL_V_3_2 is not set
# CT_KERNEL_V_2_6_32 is not set
# CT_KERNEL_LINUX_CUSTOM is not set
CT_KERNEL_windows_AVAILABLE=y
#
# Common kernel options
#
CT_SHARED_LIBS=y
#
# linux other options
#
CT_KERNEL_LINUX_VERBOSITY_0=y
# CT_KERNEL_LINUX_VERBOSITY_1 is not set
# CT_KERNEL_LINUX_VERBOSITY_2 is not set
CT_KERNEL_LINUX_VERBOSE_LEVEL=0
CT_KERNEL_LINUX_INSTALL_CHECK=y
#
# Binary utilities
#
CT_ARCH_BINFMT_ELF=y
CT_BINUTILS="binutils"
CT_BINUTILS_binutils=y
#
# GNU binutils
#
# CT_CC_BINUTILS_SHOW_LINARO is not set
CT_BINUTILS_V_2_25_1=y
# CT_BINUTILS_V_2_25 is not set
# CT_BINUTILS_V_2_24 is not set
# CT_BINUTILS_V_2_23_2 is not set
# CT_BINUTILS_V_2_23_1 is not set
# CT_BINUTILS_V_2_22 is not set
# CT_BINUTILS_V_2_21_53 is not set
# CT_BINUTILS_V_2_21_1a is not set
# CT_BINUTILS_V_2_20_1a is not set
# CT_BINUTILS_V_2_19_1a is not set
# CT_BINUTILS_V_2_18a is not set
CT_BINUTILS_VERSION="2.25.1"
CT_BINUTILS_2_25_1_or_later=y
CT_BINUTILS_2_25_or_later=y
CT_BINUTILS_2_24_or_later=y
CT_BINUTILS_2_23_or_later=y
CT_BINUTILS_2_22_or_later=y
CT_BINUTILS_2_21_or_later=y
CT_BINUTILS_2_20_or_later=y
CT_BINUTILS_2_19_or_later=y
CT_BINUTILS_2_18_or_later=y
CT_BINUTILS_HAS_HASH_STYLE=y
CT_BINUTILS_HAS_GOLD=y
CT_BINUTILS_GOLD_SUPPORTS_ARCH=y
CT_BINUTILS_GOLD_SUPPORT=y
CT_BINUTILS_HAS_PLUGINS=y
CT_BINUTILS_HAS_PKGVERSION_BUGURL=y
CT_BINUTILS_FORCE_LD_BFD=y
CT_BINUTILS_LINKER_LD=y
# CT_BINUTILS_LINKER_LD_GOLD is not set
# CT_BINUTILS_LINKER_GOLD_LD is not set
CT_BINUTILS_LINKERS_LIST="ld"
CT_BINUTILS_LINKER_DEFAULT="bfd"
CT_BINUTILS_PLUGINS=y
CT_BINUTILS_EXTRA_CONFIG_ARRAY=""
# CT_BINUTILS_FOR_TARGET is not set
#
# binutils other options
#
#
# C-library
#
CT_LIBC="glibc"
CT_LIBC_VERSION="2.22"
CT_LIBC_glibc=y
# CT_LIBC_musl is not set
# CT_LIBC_uClibc is not set
CT_LIBC_avr_libc_AVAILABLE=y
CT_LIBC_glibc_AVAILABLE=y
CT_THREADS="nptl"
# CT_CC_GLIBC_SHOW_LINARO is not set
CT_LIBC_GLIBC_V_2_22=y
# CT_LIBC_GLIBC_V_2_21 is not set
# CT_LIBC_GLIBC_V_2_20 is not set
# CT_LIBC_GLIBC_V_2_19 is not set
# CT_LIBC_GLIBC_V_2_18 is not set
# CT_LIBC_GLIBC_V_2_17 is not set
# CT_LIBC_GLIBC_V_2_16_0 is not set
# CT_LIBC_GLIBC_V_2_15 is not set
# CT_LIBC_GLIBC_V_2_14_1 is not set
# CT_LIBC_GLIBC_V_2_14 is not set
# CT_LIBC_GLIBC_V_2_13 is not set
# CT_LIBC_GLIBC_V_2_12_2 is not set
# CT_LIBC_GLIBC_V_2_12_1 is not set
# CT_LIBC_GLIBC_V_2_11_1 is not set
# CT_LIBC_GLIBC_V_2_11 is not set
# CT_LIBC_GLIBC_V_2_10_1 is not set
# CT_LIBC_GLIBC_V_2_9 is not set
# CT_LIBC_GLIBC_V_2_8 is not set
CT_LIBC_GLIBC_2_21_or_later=y
CT_LIBC_GLIBC_2_20_or_later=y
CT_LIBC_GLIBC_2_17_or_later=y
CT_LIBC_mingw_AVAILABLE=y
CT_LIBC_musl_AVAILABLE=y
CT_LIBC_newlib_AVAILABLE=y
CT_LIBC_none_AVAILABLE=y
CT_LIBC_uClibc_AVAILABLE=y
CT_LIBC_SUPPORT_THREADS_ANY=y
CT_LIBC_SUPPORT_THREADS_NATIVE=y
#
# Common C library options
#
CT_THREADS_NATIVE=y
CT_LIBC_XLDD=y
#
# glibc other options
#
# CT_LIBC_GLIBC_PORTS_EXTERNAL is not set
CT_LIBC_glibc_familly=y
CT_LIBC_GLIBC_EXTRA_CONFIG_ARRAY=""
CT_LIBC_GLIBC_CONFIGPARMS=""
CT_LIBC_GLIBC_EXTRA_CFLAGS=""
CT_LIBC_EXTRA_CC_ARGS=""
# CT_LIBC_DISABLE_VERSIONING is not set
CT_LIBC_OLDEST_ABI=""
CT_LIBC_GLIBC_FORCE_UNWIND=y
CT_LIBC_ADDONS_LIST=""
# CT_LIBC_LOCALES is not set
CT_LIBC_GLIBC_KERNEL_VERSION_NONE=y
# CT_LIBC_GLIBC_KERNEL_VERSION_AS_HEADERS is not set
# CT_LIBC_GLIBC_KERNEL_VERSION_CHOSEN is not set
CT_LIBC_GLIBC_MIN_KERNEL=""
#
# C compiler
#
CT_CC="gcc"
CT_CC_CORE_PASSES_NEEDED=y
CT_CC_CORE_PASS_1_NEEDED=y
CT_CC_CORE_PASS_2_NEEDED=y
CT_CC_gcc=y
# CT_CC_GCC_SHOW_LINARO is not set
CT_CC_GCC_V_5_2_0=y
# CT_CC_GCC_V_4_9_3 is not set
# CT_CC_GCC_V_4_8_5 is not set
# CT_CC_GCC_V_4_7_4 is not set
# CT_CC_GCC_V_4_6_4 is not set
# CT_CC_GCC_V_4_5_4 is not set
# CT_CC_GCC_V_4_4_7 is not set
# CT_CC_GCC_V_4_3_6 is not set
# CT_CC_GCC_V_4_2_4 is not set
CT_CC_GCC_4_2_or_later=y
CT_CC_GCC_4_3_or_later=y
CT_CC_GCC_4_4_or_later=y
CT_CC_GCC_4_5_or_later=y
CT_CC_GCC_4_6_or_later=y
CT_CC_GCC_4_7_or_later=y
CT_CC_GCC_4_8_or_later=y
CT_CC_GCC_4_9_or_later=y
CT_CC_GCC_5=y
CT_CC_GCC_5_or_later=y
CT_CC_GCC_HAS_GRAPHITE=y
CT_CC_GCC_USE_GRAPHITE=y
CT_CC_GCC_HAS_LTO=y
CT_CC_GCC_USE_LTO=y
CT_CC_GCC_HAS_PKGVERSION_BUGURL=y
CT_CC_GCC_HAS_BUILD_ID=y
CT_CC_GCC_HAS_LNK_HASH_STYLE=y
CT_CC_GCC_ENABLE_PLUGINS=y
CT_CC_GCC_USE_GMP_MPFR=y
CT_CC_GCC_USE_MPC=y
CT_CC_GCC_HAS_LIBQUADMATH=y
CT_CC_GCC_HAS_LIBSANITIZER=y
CT_CC_GCC_VERSION="5.2.0"
# CT_CC_LANG_FORTRAN is not set
CT_CC_GCC_ENABLE_CXX_FLAGS=""
CT_CC_GCC_CORE_EXTRA_CONFIG_ARRAY=""
CT_CC_GCC_EXTRA_CONFIG_ARRAY=""
CT_CC_GCC_EXTRA_ENV_ARRAY=""
# CT_CC_GCC_STATIC_LIBSTDCXX is not set
# CT_CC_GCC_SYSTEM_ZLIB is not set
#
# Optimisation features
#
#
# Settings for libraries running on target
#
CT_CC_GCC_ENABLE_TARGET_OPTSPACE=y
# CT_CC_GCC_LIBMUDFLAP is not set
# CT_CC_GCC_LIBGOMP is not set
# CT_CC_GCC_LIBSSP is not set
# CT_CC_GCC_LIBQUADMATH is not set
# CT_CC_GCC_LIBSANITIZER is not set
#
# Misc. obscure options.
#
CT_CC_CXA_ATEXIT=y
# CT_CC_GCC_DISABLE_PCH is not set
CT_CC_GCC_SJLJ_EXCEPTIONS=m
CT_CC_GCC_LDBL_128=m
# CT_CC_GCC_BUILD_ID is not set
# CT_CC_GCC_LNK_HASH_STYLE_DEFAULT is not set
# CT_CC_GCC_LNK_HASH_STYLE_SYSV is not set
# CT_CC_GCC_LNK_HASH_STYLE_GNU is not set
CT_CC_GCC_LNK_HASH_STYLE_BOTH=y
CT_CC_GCC_LNK_HASH_STYLE="both"
CT_CC_GCC_DEC_FLOAT_AUTO=y
# CT_CC_GCC_DEC_FLOAT_BID is not set
# CT_CC_GCC_DEC_FLOAT_DPD is not set
# CT_CC_GCC_DEC_FLOATS_NO is not set
CT_CC_SUPPORT_CXX=y
CT_CC_SUPPORT_FORTRAN=y
CT_CC_SUPPORT_JAVA=y
CT_CC_SUPPORT_ADA=y
CT_CC_SUPPORT_OBJC=y
CT_CC_SUPPORT_OBJCXX=y
CT_CC_SUPPORT_GOLANG=y
#
# Additional supported languages:
#
CT_CC_LANG_CXX=y
# CT_CC_LANG_JAVA is not set
#
# Debug facilities
#
# CT_DEBUG_dmalloc is not set
# CT_DEBUG_duma is not set
CT_DEBUG_gdb=y
CT_GDB_CROSS=y
# CT_GDB_CROSS_STATIC is not set
# CT_GDB_CROSS_SIM is not set
CT_GDB_CROSS_PYTHON=y
CT_GDB_CROSS_EXTRA_CONFIG_ARRAY=""
# CT_GDB_NATIVE is not set
CT_GDB_GDBSERVER=y
CT_GDB_GDBSERVER_HAS_IPA_LIB=y
CT_GDB_GDBSERVER_STATIC=y
#
# gdb version
#
# CT_DEBUG_GDB_SHOW_LINARO is not set
CT_GDB_V_7_10=y
# CT_GDB_V_7_9_1 is not set
# CT_GDB_V_7_9 is not set
# CT_GDB_V_7_8_2 is not set
# CT_GDB_V_7_8_1 is not set
# CT_GDB_V_7_8 is not set
# CT_GDB_V_7_7_1 is not set
# CT_GDB_V_7_7 is not set
# CT_GDB_V_7_6_1 is not set
# CT_GDB_V_7_5_1 is not set
# CT_GDB_V_7_4_1 is not set
# CT_GDB_V_7_4 is not set
# CT_GDB_V_7_3_1 is not set
# CT_GDB_V_7_3a is not set
# CT_GDB_V_7_2a is not set
# CT_GDB_V_7_1a is not set
# CT_GDB_V_7_0_1a is not set
# CT_GDB_V_7_0a is not set
# CT_GDB_V_6_8a is not set
CT_GDB_7_2_or_later=y
CT_GDB_7_0_or_later=y
CT_GDB_HAS_PKGVERSION_BUGURL=y
CT_GDB_HAS_PYTHON=y
CT_GDB_INSTALL_GDBINIT=y
CT_GDB_VERSION="7.10"
# CT_DEBUG_ltrace is not set
# CT_DEBUG_strace is not set
#
# Companion libraries
#
CT_COMPLIBS_NEEDED=y
CT_LIBICONV_NEEDED=y
CT_GETTEXT_NEEDED=y
CT_GMP_NEEDED=y
CT_MPFR_NEEDED=y
CT_ISL_NEEDED=y
CT_MPC_NEEDED=y
CT_EXPAT_NEEDED=y
CT_NCURSES_NEEDED=y
CT_COMPLIBS=y
CT_LIBICONV=y
CT_GETTEXT=y
CT_GMP=y
CT_MPFR=y
CT_ISL=y
CT_MPC=y
CT_EXPAT=y
CT_NCURSES=y
CT_LIBICONV_V_1_14=y
CT_LIBICONV_VERSION="1.14"
CT_GETTEXT_V_0_19_6=y
CT_GETTEXT_VERSION="0.19.6"
CT_GMP_V_6_0_0=y
# CT_GMP_V_5_1_3 is not set
# CT_GMP_V_5_1_1 is not set
# CT_GMP_V_5_0_2 is not set
# CT_GMP_V_5_0_1 is not set
# CT_GMP_V_4_3_2 is not set
# CT_GMP_V_4_3_1 is not set
# CT_GMP_V_4_3_0 is not set
CT_GMP_5_0_2_or_later=y
CT_GMP_VERSION="6.0.0a"
CT_MPFR_V_3_1_3=y
# CT_MPFR_V_3_1_2 is not set
# CT_MPFR_V_3_1_0 is not set
# CT_MPFR_V_3_0_1 is not set
# CT_MPFR_V_3_0_0 is not set
# CT_MPFR_V_2_4_2 is not set
# CT_MPFR_V_2_4_1 is not set
# CT_MPFR_V_2_4_0 is not set
CT_MPFR_VERSION="3.1.3"
CT_ISL_V_0_14=y
# CT_ISL_V_0_12_2 is not set
CT_ISL_V_0_14_or_later=y
CT_ISL_V_0_12_or_later=y
CT_ISL_VERSION="0.14"
CT_MPC_V_1_0_3=y
# CT_MPC_V_1_0_2 is not set
# CT_MPC_V_1_0_1 is not set
# CT_MPC_V_1_0 is not set
# CT_MPC_V_0_9 is not set
# CT_MPC_V_0_8_2 is not set
# CT_MPC_V_0_8_1 is not set
# CT_MPC_V_0_7 is not set
CT_MPC_VERSION="1.0.3"
CT_EXPAT_V_2_1_0=y
CT_EXPAT_VERSION="2.1.0"
CT_NCURSES_V_6_0=y
CT_NCURSES_VERSION="6.0"
#
# Companion libraries common options
#
# CT_COMPLIBS_CHECK is not set
#
# Companion tools
#
#
# READ HELP before you say 'Y' below !!!
#
# CT_COMP_TOOLS is not set
It turns out that you need to provide an implementation of endian.h (with thanks to Waldemar Brodkorb on the crosstool-ng mailing list) for his steer. There were additional edits required to get a successful build - glibc was the main problem. I got a script to do the build for me working (OSX 10.9) and have posted it on Github.

Error trying to link with osgText and freetype

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...

using scons for literate programming

Using noweb, I would either like to generate a document file (or a source file) from a noweb input file **.nw
From hand I would do something like that:
notangle my_program.nw > my_program.cpp
g++ -c my_program.o my_program.cpp
ln -o myapp ... my_program.o ...
Now I like to ask whether I can use scons to automate this.
Imagine, my project directory is on $MYPROJECT. THere we have "$MYPROJECT/SConstruct".
Now I defined a scons tool "tangle.py" (simplified from "noweb.py).
Here we have "$MYPROJECT/site_scons/site_tools/tangle.py"
import SCons.Builder
def cpp_emit (target,source, env):
# I dont know what to do here ... please help
return (target,source)
# Tangle to .cpp
__noweb_tangle_builder = SCons.Builder.Builder(
action='/usr/bin/notangle $SOURCES >$TARGET',
suffix='.cpp',
src_suffix='.nw',
emitter=cpp_emit)
# -----------------------
def generate(env):
env['BUILDERS']['tangle']= __noweb_tangle_builder
def exists(env):
return 1
This tool generates a cpp-file from a nw-file.
But if I do something like
def cpp_emit (target,source, env):
new_source=target[0].name
new_target=new_source.rstrip(".cpp")+".o"
target.append(new_target)
source.append(new_source)
return (target, source)
I get into a dependency circle. SCons will find and abort with an error message.
Doing ...
def cpp_emit (target,source, env):
new_source=target[0].name
# someprogram.cpp -> someprogram.o
new_target=new_source.rstrip(".cpp")+".o"
# lets avoid dependency cycle
t = []
t.append(new_target)
source.append(new_source)
# oops, we dropped target test.cpp. It wont be generated.
return (t, source)
... the tool would stop generating a cpp file from a nw file. (Cpp target dropped)
Do you know a working way to do use scons for literate programming?
thank you for reading.
Leonard
Here is the tool that I created. Note the use of env['BUILDERS']['Object'].src_builder to allow env.Program() to accept noweb files.
# site_cons/site_tools/tangle.py
import SCons.Builder
__all__=['generate', 'exists']
tangle_builder = SCons.Builder.Builder(
action='$NOTANGLE $SOURCES > $TARGET',
suffix = '.cpp',
src_suffix = '.nw')
def generate(env):
env['NOTANGLE'] = exists(env)
env['BUILDERS']['Tangle'] = tangle_builder
if 'Object' in env['BUILDERS']:
env['BUILDERS']['Object'].src_builder.append('Tangle')
def exists(env):
if 'NOTANGLE' in env:
return env['NOTANGLE']
return env.WhereIs('notangle')
And its use:
# SConstruct
env = Environment(tools=['default', 'tangle'])
env.Program('my_program.nw')
Here is the output of the above SConstruct:
$ scons -Q
/usr/bin/notangle my_program.nw > my_program.cpp
g++ -o my_program.o -c my_program.cpp
g++ -o my_program my_program.o
$ scons -c
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Cleaning targets ...
Removed my_program.cpp
Removed my_program.o
Removed my_program
scons: done cleaning targets.
Seems like you're trying to add the object file without actually compiling the cpp file.
I made a small example that should help clear up the situation. Basically, since you configured the suffix, and src_suffix in the call to Builder, the sources and targets are correctly setup by SCons, and you dont need the emitter.
def cpp_emit (target,source, env):
for t in target:
print 'Emitter target: %s' % (t)
for s in source:
print 'Emitter source: %s' % (s.name)
return (target,source)
# Tangle to .cpp
builder = Builder(
action='/home/notroot/projects/sandbox/Emitter/builder.sh $SOURCES $TARGET',
suffix='.cc',
src_suffix='.nw',
emitter=cpp_emit)
env = Environment()
env['BUILDERS']['tangle'] = builder
tangleTarget = env.tangle(target='main.cc', source='main.nw')
env.Object(source=tangleTarget)
And here is the output:
$ scons
scons: Reading SConscript files ...
Emitter target: main.cc
Emitter source: main.nw
scons: done reading SConscript files.
scons: Building targets ...
/home/notroot/projects/sandbox/Emitter/builder.sh main.nw main.cc
g++ -o main.o -c main.cc
scons: done building targets.
$ scons -c
scons: Reading SConscript files ...
Emitter target: main.cc
Emitter source: main.nw
scons: done reading SConscript files.
scons: Cleaning targets ...
Removed main.cc
Removed main.o
scons: done cleaning targets.
I did the following to get the Builder to generate the cc file and compile it, but it doesnt clean the object file.
import os
def cpp_emit(target,source, env):
for s in source:
print 'Emitter source: %s' % (s.name)
for t in target:
print 'Emitter target: %s' % (t)
return (target,source)
def build_function(target, source, env):
# Code to build "target" from "source"
for t in target:
print 'Builder target: %s' % (t.name)
for s in source:
print 'Builder source: %s' % (s.name)
buildStr='/home/notroot/projects/sandbox/Emitter/builder.sh %s %s' % (source[0].name, target[0].name)
os.system(buildStr)
trgt = env.Object(source=target[0])
# return 0 or None upon success
return None
# Tangle to .cc and .o
builder = Builder(
action=build_function,
suffix='.cc',
src_suffix='.nw',
emitter=cpp_emit)
env = Environment()
env['BUILDERS']['tangle'] = builder
tangleTarget = env.tangle(target='main.cc', source='main.nw')
Here is the output:
$ scons
scons: Reading SConscript files ...
Emitter source: main.nw
Emitter target: main.cc
scons: done reading SConscript files.
scons: Building targets ...
build_function(["main.cc"], ["main.nw"])
Builder target: main.cc
Builder source: main.nw
scons: done building targets.
$ scons -c
scons: Reading SConscript files ...
Emitter source: main.nw
Emitter target: main.cc
scons: done reading SConscript files.
scons: Cleaning targets ...
Removed main.cc
scons: done cleaning targets.
In this second example, if you add the object file as a target, you will get the following error (rightly so)
scons: *** [main.cc] Multiple ways to build the same target were specified for: main.o (from ['main.nw'] and from ['main.cc'])

Resources