I want to compile and run HPC Challenge benchmark on my server.
When I want to make hpcc-1.5.0 with mpicc compiler I get this error:
../../../../STREAM/stream.c:178:26: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘a’
static double * restrict a, * restrict b, * restrict c;
^
../../../../STREAM/stream.c: In function ‘checkSTREAMresults’:
../../../../STREAM/stream.c:263:16: error: ‘a’ undeclared (first use in this function)
if (fabs(a[j]/aj-1.0) > epsilon) {
^
../../../../STREAM/stream.c:263:16: note: each undeclared identifier is reported only once for each function it appears in
../../../../STREAM/stream.c:280:16: error: ‘b’ undeclared (first use in this function)
if (fabs(b[j]/bj-1.0) > epsilon) {
^
../../../../STREAM/stream.c:297:16: error: ‘c’ undeclared (first use in this function)
if (fabs(c[j]/cj-1.0) > epsilon) {
^
../../../../STREAM/stream.c: In function ‘computeSTREAMerrors’:
../../../../STREAM/stream.c: In function ‘HPCC_Stream’:
../../../../STREAM/stream.c: In function ‘tuned_STREAM_Copy’:
../../../../STREAM/stream.c: In function ‘tuned_STREAM_Scale’:
../../../../STREAM/stream.c: In function ‘tuned_STREAM_Add’:
../../../../STREAM/stream.c: In function ‘tuned_STREAM_Triad’:
make[1]: *** [../../../../STREAM/stream.o] Error 1
make[1]: Leaving directory `/root/hpcc-1.5.0/hpl/lib/arch/build'
make: *** [all] Error 2
It seems STREAM uses some variables that is not declared.
This is because of using restrict keywords for the array. To compile stream, you have to use -std=c99 option.
Add -std=c99 flag in your Make.$(arch) file in CCFLAGS section. Like this:
CCFLAGS = $(HPL_DEFS) -fomit-frame-pointer -O3 -funroll-loops -std=c99
Source: https://anilmaurya.wordpress.com/2016/04/26/hpc-1-5-0-compile-time-error/
Related
Hi I was trying to install and build the aws-c-common package provided by AWS.
However I encountered below errors when I'm trying to execute below command:
cmake --build . && cmake --build . --target install && cd ..
Which is the command that I'm following from AWS Documentation Option B.
The error are shown as below (The error logs are very long and I can only pasted a portion of it here. But basically I can see error with each different file with different error reason, but I'm not sure why is it happening since I followed all the previous steps in the guide)
[1/58] Building C object CMakeFiles/aws-c-common.dir/source/log_formatter.c.obj
FAILED: CMakeFiles/aws-c-common.dir/source/log_formatter.c.obj
C:\MinGW\bin\gcc.exe -DAWS_AFFINITY_METHOD=AWS_AFFINITY_METHOD_NONE -DAWS_COMMON_EXPORTS -DAWS_COMMON_USE_IMPORT_EXPORT -DHAVE_AVX2_INTRINSICS -DUSE_SIMD_ENCODING -DWINDOWS_KERNEL_LIB=Kernel32 -
Daws_c_common_EXPORTS -Ibuild/aws-c-common/include -Igenerated/include -O3 -DNDEBUG -Wall -Wstrict-prototypes -fno-omit-frame-pointer -pedantic -Wno-long-long -fPIC -fvisibility=hidden -std=gnu9
9 -MD -MT CMakeFiles/aws-c-common.dir/source/log_formatter.c.obj -MF CMakeFiles\aws-c-common.dir\source\log_formatter.c.obj.d -o CMakeFiles/aws-c-common.dir/source/log_formatter.c.obj -c build/a
ws-c-common/source/log_formatter.c
In file included from build/aws-c-common/include/aws/common/array_list.h:210:0,
from build/aws-c-common/include/aws/common/byte_buf.h:8,
from build/aws-c-common/include/aws/common/string.h:7,
from build/aws-c-common/source/log_formatter.c:9:
build/aws-c-common/include/aws/common/array_list.inl: In function 'aws_array_list_debug_print':
build/aws-c-common/include/aws/common/array_list.inl:99:48: warning: unknown conversion type character 'z' in format [-Wformat=]
"arraylist %p. Alloc %p. current_size %zu. length %zu. item_size %zu. data %p\n",
^
build/aws-c-common/include/aws/common/array_list.inl:99:60: warning: unknown conversion type character 'z' in format [-Wformat=]
"arraylist %p. Alloc %p. current_size %zu. length %zu. item_size %zu. data %p\n",
^
build/aws-c-common/include/aws/common/array_list.inl:99:75: warning: unknown conversion type character 'z' in format [-Wformat=]
"arraylist %p. Alloc %p. current_size %zu. length %zu. item_size %zu. data %p\n",
^
build/aws-c-common/include/aws/common/array_list.inl:99:85: warning: format '%p' expects argument of type 'void *', but argument 4 has type 'size_t {aka const unsigned int}' [-Wformat=]
"arraylist %p. Alloc %p. current_size %zu. length %zu. item_size %zu. data %p\n",
^
build/aws-c-common/include/aws/common/array_list.inl:99:9: warning: too many arguments for format [-Wformat-extra-args]
"arraylist %p. Alloc %p. current_size %zu. length %zu. item_size %zu. data %p\n",
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from build/aws-c-common/include/aws/common/byte_order.h:69:0,
from build/aws-c-common/include/aws/common/byte_buf.h:9,
from build/aws-c-common/include/aws/common/string.h:7,
from build/aws-c-common/source/log_formatter.c:9:
build/aws-c-common/include/aws/common/byte_order.inl: In function 'aws_hton64':
build/aws-c-common/include/aws/common/byte_order.inl:47:23: warning: implicit declaration of function 'htonl' [-Wimplicit-function-declaration]
return ((uint64_t)htonl(low)) << 32 | htonl(high);
^~~~~
build/aws-c-common/include/aws/common/byte_order.inl: In function 'aws_hton32':
build/aws-c-common/include/aws/common/byte_order.inl:63:38: warning: implicit declaration of function '_byteswap_ulong' [-Wimplicit-function-declaration]
return aws_is_big_endian() ? x : _byteswap_ulong(x);
^~~~~~~~~~~~~~~
build/aws-c-common/include/aws/common/byte_order.inl: In function 'aws_hton16':
build/aws-c-common/include/aws/common/byte_order.inl:145:38: warning: implicit declaration of function '_byteswap_ushort' [-Wimplicit-function-declaration]
return aws_is_big_endian() ? x : _byteswap_ushort(x);
^~~~~~~~~~~~~~~~
build/aws-c-common/source/log_formatter.c: In function 'aws_format_standard_log_line':
build/aws-c-common/source/log_formatter.c:155:29: warning: implicit declaration of function 'vsnprintf_s' [-Wimplicit-function-declaration]
int written_count = vsnprintf_s(
^~~~~~~~~~~
build/aws-c-common/source/log_formatter.c:158:13: error: '_TRUNCATE' undeclared (first use in this function)
_TRUNCATE,
^~~~~~~~~
build/aws-c-common/source/log_formatter.c:158:13: note: each undeclared identifier is reported only once for each function it appears in
[2/58] Building C object CMakeFiles/aws-c-common.dir/source/windows/rw_lock.c.obj
FAILED: CMakeFiles/aws-c-common.dir/source/windows/rw_lock.c.obj
C:\MinGW\bin\gcc.exe -DAWS_AFFINITY_METHOD=AWS_AFFINITY_METHOD_NONE -DAWS_COMMON_EXPORTS -DAWS_COMMON_USE_IMPORT_EXPORT -DHAVE_AVX2_INTRINSICS -DUSE_SIMD_ENCODING -DWINDOWS_KERNEL_LIB=Kernel32 -
Daws_c_common_EXPORTS -Ibuild/aws-c-common/include -Igenerated/include -O3 -DNDEBUG -Wall -Wstrict-prototypes -fno-omit-frame-pointer -pedantic -Wno-long-long -fPIC -fvisibility=hidden -std=gnu9
9 -MD -MT CMakeFiles/aws-c-common.dir/source/windows/rw_lock.c.obj -MF CMakeFiles\aws-c-common.dir\source\windows\rw_lock.c.obj.d -o CMakeFiles/aws-c-common.dir/source/windows/rw_lock.c.obj -c b
uild/aws-c-common/source/windows/rw_lock.c
build/aws-c-common/source/windows/rw_lock.c:9:22: fatal error: synchapi.h: No such file or directory
#include <synchapi.h>
^
compilation terminated.
[3/58] Building C object CMakeFiles/aws-c-common.dir/source/windows/clock.c.obj
FAILED: CMakeFiles/aws-c-common.dir/source/windows/clock.c.obj
C:\MinGW\bin\gcc.exe -DAWS_AFFINITY_METHOD=AWS_AFFINITY_METHOD_NONE -DAWS_COMMON_EXPORTS -DAWS_COMMON_USE_IMPORT_EXPORT -DHAVE_AVX2_INTRINSICS -DUSE_SIMD_ENCODING -DWINDOWS_KERNEL_LIB=Kernel32 -
Daws_c_common_EXPORTS -Ibuild/aws-c-common/include -Igenerated/include -O3 -DNDEBUG -Wall -Wstrict-prototypes -fno-omit-frame-pointer -pedantic -Wno-long-long -fPIC -fvisibility=hidden -std=gnu9
9 -MD -MT CMakeFiles/aws-c-common.dir/source/windows/clock.c.obj -MF CMakeFiles\aws-c-common.dir\source\windows\clock.c.obj.d -o CMakeFiles/aws-c-common.dir/source/windows/clock.c.obj -c build/a
ws-c-common/source/windows/clock.c
build/aws-c-common/source/windows/clock.c:13:8: error: unknown type name 'INIT_ONCE'
static INIT_ONCE s_timefunc_init_once = INIT_ONCE_STATIC_INIT;
^~~~~~~~~
build/aws-c-common/source/windows/clock.c:13:41: error: 'INIT_ONCE_STATIC_INIT' undeclared here (not in a function)
static INIT_ONCE s_timefunc_init_once = INIT_ONCE_STATIC_INIT;
^~~~~~~~~~~~~~~~~~~~~
build/aws-c-common/source/windows/clock.c:22:50: error: unknown type name 'PINIT_ONCE'
static BOOL CALLBACK s_get_system_time_init_once(PINIT_ONCE init_once, PVOID param, PVOID *context) {
^~~~~~~~~~
build/aws-c-common/source/windows/clock.c: In function 's_get_system_time_func_lazy_init':
build/aws-c-common/source/windows/clock.c:40:19: warning: implicit declaration of function 'InitOnceExecuteOnce' [-Wimplicit-function-declaration]
BOOL status = InitOnceExecuteOnce(&s_timefunc_init_once, s_get_system_time_init_once, NULL, NULL);
^~~~~~~~~~~~~~~~~~~
build/aws-c-common/source/windows/clock.c:40:62: error: 's_get_system_time_init_once' undeclared (first use in this function)
BOOL status = InitOnceExecuteOnce(&s_timefunc_init_once, s_get_system_time_init_once, NULL, NULL);
^~~~~~~~~~~~~~~~~~~~~~~~~~~
build/aws-c-common/source/windows/clock.c:40:62: note: each undeclared identifier is reported only once for each function it appears in
[4/58] Building C object CMakeFiles/aws-c-common.dir/source/windows/condition_variable.c.obj
FAILED: CMakeFiles/aws-c-common.dir/source/windows/condition_variable.c.obj
C:\MinGW\bin\gcc.exe -DAWS_AFFINITY_METHOD=AWS_AFFINITY_METHOD_NONE -DAWS_COMMON_EXPORTS -DAWS_COMMON_USE_IMPORT_EXPORT -DHAVE_AVX2_INTRINSICS -DUSE_SIMD_ENCODING -DWINDOWS_KERNEL_LIB=Kernel32 -
Daws_c_common_EXPORTS -Ibuild/aws-c-common/include -Igenerated/include -O3 -DNDEBUG -Wall -Wstrict-prototypes -fno-omit-frame-pointer -pedantic -Wno-long-long -fPIC -fvisibility=hidden -std=gnu9
9 -MD -MT CMakeFiles/aws-c-common.dir/source/windows/condition_variable.c.obj -MF CMakeFiles\aws-c-common.dir\source\windows\condition_variable.c.obj.d -o CMakeFiles/aws-c-common.dir/source/wind
ows/condition_variable.c.obj -c build/aws-c-common/source/windows/condition_variable.c
In file included from build/aws-c-common/include/aws/common/allocator.h:8:0,
from build/aws-c-common/include/aws/common/common.h:12,
from build/aws-c-common/include/aws/common/condition_variable.h:9,
from build/aws-c-common/source/windows/condition_variable.c:6:
build/aws-c-common/source/windows/condition_variable.c: In function 'aws_condition_variable_init':
build/aws-c-common/source/windows/condition_variable.c:17:30: error: 'CONDITION_VARIABLE' undeclared (first use in this function)
AWS_STATIC_ASSERT(sizeof(CONDITION_VARIABLE) == sizeof(condition_variable->condition_handle));
^
build/aws-c-common/include/aws/common/macros.h:18:40: note: in expansion of macro 'AWS_STATIC_ASSERT0'
#define AWS_STATIC_ASSERT1(cond, line) AWS_STATIC_ASSERT0(cond, AWS_CONCAT(at_line_, line))
^~~~~~~~~~~~~~~~~~
build/aws-c-common/include/aws/common/macros.h:19:33: note: in expansion of macro 'AWS_STATIC_ASSERT1'
#define AWS_STATIC_ASSERT(cond) AWS_STATIC_ASSERT1(cond, __LINE__)
^~~~~~~~~~~~~~~~~~
build/aws-c-common/source/windows/condition_variable.c:17:5: note: in expansion of macro 'AWS_STATIC_ASSERT'
AWS_STATIC_ASSERT(sizeof(CONDITION_VARIABLE) == sizeof(condition_variable->condition_handle));
^~~~~~~~~~~~~~~~~
build/aws-c-common/source/windows/condition_variable.c:17:30: note: each undeclared identifier is reported only once for each function it appears in
AWS_STATIC_ASSERT(sizeof(CONDITION_VARIABLE) == sizeof(condition_variable->condition_handle));
^
build/aws-c-common/include/aws/common/macros.h:18:40: note: in expansion of macro 'AWS_STATIC_ASSERT0'
#define AWS_STATIC_ASSERT1(cond, line) AWS_STATIC_ASSERT0(cond, AWS_CONCAT(at_line_, line))
^~~~~~~~~~~~~~~~~~
build/aws-c-common/include/aws/common/macros.h:19:33: note: in expansion of macro 'AWS_STATIC_ASSERT1'
#define AWS_STATIC_ASSERT(cond) AWS_STATIC_ASSERT1(cond, __LINE__)
^~~~~~~~~~~~~~~~~~
build/aws-c-common/source/windows/condition_variable.c:17:5: note: in expansion of macro 'AWS_STATIC_ASSERT'
AWS_STATIC_ASSERT(sizeof(CONDITION_VARIABLE) == sizeof(condition_variable->condition_handle));
^~~~~~~~~~~~~~~~~
build/aws-c-common/source/windows/condition_variable.c:20:5: warning: implicit declaration of function 'InitializeConditionVariable' [-Wimplicit-function-declaration]
InitializeConditionVariable(AWSCV_TO_WINDOWS(condition_variable));
^~~~~~~~~~~~~~~~~~~~~~~~~~~
build/aws-c-common/source/windows/condition_variable.c:13:32: error: 'PCONDITION_VARIABLE' undeclared (first use in this function)
#define AWSCV_TO_WINDOWS(pCV) (PCONDITION_VARIABLE) & (pCV)->condition_handle
^
build/aws-c-common/source/windows/condition_variable.c:20:33: note: in expansion of macro 'AWSCV_TO_WINDOWS'
InitializeConditionVariable(AWSCV_TO_WINDOWS(condition_variable));
^~~~~~~~~~~~~~~~
build/aws-c-common/source/windows/condition_variable.c: In function 'aws_condition_variable_notify_one':
build/aws-c-common/source/windows/condition_variable.c:32:5: warning: implicit declaration of function 'WakeConditionVariable' [-Wimplicit-function-declaration]
WakeConditionVariable(AWSCV_TO_WINDOWS(condition_variable));
^~~~~~~~~~~~~~~~~~~~~
build/aws-c-common/source/windows/condition_variable.c:13:32: error: 'PCONDITION_VARIABLE' undeclared (first use in this function)
#define AWSCV_TO_WINDOWS(pCV) (PCONDITION_VARIABLE) & (pCV)->condition_handle
^
build/aws-c-common/source/windows/condition_variable.c:32:27: note: in expansion of macro 'AWSCV_TO_WINDOWS'
WakeConditionVariable(AWSCV_TO_WINDOWS(condition_variable));
^~~~~~~~~~~~~~~~
build/aws-c-common/source/windows/condition_variable.c: In function 'aws_condition_variable_notify_all':
build/aws-c-common/source/windows/condition_variable.c:38:5: warning: implicit declaration of function 'WakeAllConditionVariable' [-Wimplicit-function-declaration]
WakeAllConditionVariable(AWSCV_TO_WINDOWS(condition_variable));
^~~~~~~~~~~~~~~~~~~~~~~~
build/aws-c-common/source/windows/condition_variable.c:13:32: error: 'PCONDITION_VARIABLE' undeclared (first use in this function)
#define AWSCV_TO_WINDOWS(pCV) (PCONDITION_VARIABLE) & (pCV)->condition_handle
^
build/aws-c-common/source/windows/condition_variable.c:38:30: note: in expansion of macro 'AWSCV_TO_WINDOWS'
WakeAllConditionVariable(AWSCV_TO_WINDOWS(condition_variable));
^~~~~~~~~~~~~~~~
build/aws-c-common/source/windows/condition_variable.c: In function 'aws_condition_variable_wait':
build/aws-c-common/source/windows/condition_variable.c:46:9: warning: implicit declaration of function 'SleepConditionVariableSRW' [-Wimplicit-function-declaration]
if (SleepConditionVariableSRW(AWSCV_TO_WINDOWS(condition_variable), AWSMUTEX_TO_WINDOWS(mutex), INFINITE, 0)) {
^~~~~~~~~~~~~~~~~~~~~~~~~
build/aws-c-common/source/windows/condition_variable.c:13:32: error: 'PCONDITION_VARIABLE' undeclared (first use in this function)
#define AWSCV_TO_WINDOWS(pCV) (PCONDITION_VARIABLE) & (pCV)->condition_handle
^
build/aws-c-common/source/windows/condition_variable.c:46:35: note: in expansion of macro 'AWSCV_TO_WINDOWS'
if (SleepConditionVariableSRW(AWSCV_TO_WINDOWS(condition_variable), AWSMUTEX_TO_WINDOWS(mutex), INFINITE, 0)) {
^~~~~~~~~~~~~~~~
In file included from build/aws-c-common/source/windows/condition_variable.c:9:0:
build/aws-c-common/include/aws/common/mutex.h:12:42: error: 'PSRWLOCK' undeclared (first use in this function)
# define AWSMUTEX_TO_WINDOWS(pMutex) (PSRWLOCK) & (pMutex)->mutex_handle
^
build/aws-c-common/source/windows/condition_variable.c:46:73: note: in expansion of macro 'AWSMUTEX_TO_WINDOWS'
if (SleepConditionVariableSRW(AWSCV_TO_WINDOWS(condition_variable), AWSMUTEX_TO_WINDOWS(mutex), INFINITE, 0)) {
^~~~~~~~~~~~~~~~~~~
build/aws-c-common/source/windows/condition_variable.c: In function 'aws_condition_variable_wait_for':
build/aws-c-common/source/windows/condition_variable.c:13:32: error: 'PCONDITION_VARIABLE' undeclared (first use in this function)
#define AWSCV_TO_WINDOWS(pCV) (PCONDITION_VARIABLE) & (pCV)->condition_handle
^
build/aws-c-common/source/windows/condition_variable.c:63:35: note: in expansion of macro 'AWSCV_TO_WINDOWS'
if (SleepConditionVariableSRW(AWSCV_TO_WINDOWS(condition_variable), AWSMUTEX_TO_WINDOWS(mutex), time_ms, 0)) {
^~~~~~~~~~~~~~~~
In file included from build/aws-c-common/source/windows/condition_variable.c:9:0:
build/aws-c-common/include/aws/common/mutex.h:12:42: error: 'PSRWLOCK' undeclared (first use in this function)
# define AWSMUTEX_TO_WINDOWS(pMutex) (PSRWLOCK) & (pMutex)->mutex_handle
^
build/aws-c-common/source/windows/condition_variable.c:63:73: note: in expansion of macro 'AWSMUTEX_TO_WINDOWS'
if (SleepConditionVariableSRW(AWSCV_TO_WINDOWS(condition_variable), AWSMUTEX_TO_WINDOWS(mutex), time_ms, 0)) {
^~~~~~~~~~~~~~~~~~~
[5/58] Building C object CMakeFiles/aws-c-common.dir/source/windows/file.c.obj
FAILED: CMakeFiles/aws-c-common.dir/source/windows/file.c.obj
C:\MinGW\bin\gcc.exe -DAWS_AFFINITY_METHOD=AWS_AFFINITY_METHOD_NONE -DAWS_COMMON_EXPORTS -DAWS_COMMON_USE_IMPORT_EXPORT -DHAVE_AVX2_INTRINSICS -DUSE_SIMD_ENCODING -DWINDOWS_KERNEL_LIB=Kernel32 -
Daws_c_common_EXPORTS -Ibuild/aws-c-common/include -Igenerated/include -O3 -DNDEBUG -Wall -Wstrict-prototypes -fno-omit-frame-pointer -pedantic -Wno-long-long -fPIC -fvisibility=hidden -std=gnu9
9 -MD -MT CMakeFiles/aws-c-common.dir/source/windows/file.c.obj -MF CMakeFiles\aws-c-common.dir\source\windows\file.c.obj.d -o CMakeFiles/aws-c-common.dir/source/windows/file.c.obj -c build/aws-
c-common/source/windows/file.c
build/aws-c-common/source/windows/file.c: In function 'aws_fopen':
build/aws-c-common/source/windows/file.c:18:17: error: 'EINVAL' undeclared (first use in this function)
errno = EINVAL;
^~~~~~
build/aws-c-common/source/windows/file.c:18:17: note: each undeclared identifier is reported only once for each function it appears in
build/aws-c-common/source/windows/file.c:27:9: warning: implicit declaration of function '_wfopen_s' [-Wimplicit-function-declaration]
if (_wfopen_s(&file, w_file_path, w_mode)) {
^~~~~~~~~
Does anyone know how to resolve this?
Thank you.
I' m trying to setup a simple tool to measure different aspects of a system. I build a project which can log an accelerometer, gyroscope and a magnetometer. I want full control of the the program so I decided not to use any usr/local kind of libraries and keep all files in the project folder. All files all working. I want to make the structure of my program as follows: https://www.dropbox.com/s/59s3si8spvkdq98/filestructure.png (not enough REP). I don't have much experience in making Makefiles, except changing a few variables. I work in the Embedded environment and mostly with IDE's.
I tried building my project with the following Makefile:
# Project name
NAME = TEST
# Tools
CC = gcc
CFLAGS = -o
# Paths
DRV_PATH = drivers
SRC_PATH = src
LIB_PATH = libs
# includes
INCLUDES = -I $(DRV_PATH) -I $(LIB_PATH) -I $(SRC_PATH)
# what files do we need to compile?
# libraries
MY_LIB = $(LIB_PATH)/bcm2835.c
# main files
MAIN = main.c
# src files
#MY_SRC = $(SRC_PATH)/vector.c
MY_SRC += $(SRC_PATH)/dcm.c
# select drivers to compile
DRV_SRC = $(DRV_PATH)/adxl345.c
DRV_SRC += $(DRV_PATH)/itg3200.c
DRV_SRC += $(DRV_PATH)/hmc5883l.c
DRV_SRC += $(DRV_PATH)/gy-85.c
DRV_SRC += $(DRV_PATH)/nrf24l01.c
# bundle files
ALL_SRC = $(MY_LIB) $(DRV_SRC) $(MY_SRC) $(MAIN)
OBJ = $(ALL:.c=.o)
BIN = $(ALL:.c=)
# make commands
all:
$(CC) $(CFLAGS) $(NAME) $(ALL_SRC)
debug:
$(CC) $(CFLAGS) $(NAME) $(ALL_SRC) -DDEBUG=1
imudebug:
$(CC) $(CFLAGS) $(NAME) $(ALL_SRC) -DIMUDEBUG=1
nrfdebug:
$(CC) $(CFLAGS) $(NAME) $(ALL_SRC) -DNRFDEBUG=1
I use the different make commands to generate some debug output.
The config file currently includes all files and is as follows:
#ifndef CONFIG_H
#define CONFIG_H
/* includes */
#include <stdio.h>
#include <math.h>
/* libs */
#include <bcm2835.h>
/* drivers */
#include "gy-85.h"
#include "adxl345.h"
#include "itg3200.h"
#include "hmcl5883l.h"
#include "nrf24l01.h"
/* src */
#include "dcm.h"
#endif // __CONFIG_H__
And the dcm.h file looks as follows. I tried t keep all .h files like this:
#ifndef DCM_H
#define DCM_H
#include <bcm2835.h>
#include <stdio.h>
#include <math.h>
#include "gy-85.h"
double pitch, roll, yaw;
double DCM_Matrix[3][3];
uint64_t stamp;
void resetFusion(void);
#endif
This is my make result:
gcc -o TEST libs/bcm2835.c drivers/adxl345.c drivers/itg3200.c drivers/hmc5883l.c drivers/gy-85.c drivers/nrf24l01.c src/dcm.c main.c
In file included from drivers/adxl345.c:1:0:
drivers/adxl345.h:4:21: fatal error: bcm2835.h: No such file or directory
compilation terminated.
In file included from drivers/itg3200.c:1:0:
drivers/itg3200.h:4:21: fatal error: bcm2835.h: No such file or directory
compilation terminated.
drivers/hmc5883l.c: In function ‘magInit’:
drivers/hmc5883l.c:7:30: error: ‘MAG_ADDR’ undeclared (first use in this function)
drivers/hmc5883l.c:7:30: note: each undeclared identifier is reported only once for each function it appears in
drivers/hmc5883l.c:14:17: error: ‘MODE’ undeclared (first use in this function)
drivers/hmc5883l.c:14:23: error: ‘CONTINUOUS’ undeclared (first use in this function)
drivers/hmc5883l.c:22:17: error: ‘CONA’ undeclared (first use in this function)
drivers/hmc5883l.c:22:23: error: ‘RATE_50HZ’ undeclared (first use in this function)
drivers/hmc5883l.c: In function ‘magRead’:
drivers/hmc5883l.c:37:30: error: ‘MAG_ADDR’ undeclared (first use in this function)
drivers/hmc5883l.c:38:18: error: ‘DATA’ undeclared (first use in this function)
drivers/hmc5883l.c: In function ‘magGetRegister’:
drivers/hmc5883l.c:60:13: error: ‘BCM2835_I2C_REASON_OK’ undeclared (first use in this function)
drivers/hmc5883l.c:61:3: warning: incompatible implicit declaration of built-in function ‘printf’ [enabled by default]
drivers/hmc5883l.c: At top level:
drivers/hmc5883l.c:71:6: warning: conflicting types for ‘magGetRegisters’ [enabled by default]
drivers/hmc5883l.c:38:2: note: previous implicit declaration of ‘magGetRegisters’ was here
drivers/hmc5883l.c: In function ‘magGetRegisters’:
drivers/hmc5883l.c:79:13: error: ‘BCM2835_I2C_REASON_OK’ undeclared (first use in this function)
drivers/hmc5883l.c:80:3: warning: incompatible implicit declaration of built-in function ‘printf’ [enabled by default]
drivers/hmc5883l.c: At top level:
drivers/hmc5883l.c:97:6: warning: conflicting types for ‘magSetRegister’ [enabled by default]
drivers/hmc5883l.c:14:2: note: previous implicit declaration of ‘magSetRegister’ was here
drivers/hmc5883l.c: In function ‘magSetRegister’:
drivers/hmc5883l.c:107:13: error: ‘BCM2835_I2C_REASON_OK’ undeclared (first use in this function)
drivers/hmc5883l.c:108:3: warning: incompatible implicit declaration of built-in function ‘printf’ [enabled by default]
drivers/gy-85.c: In function ‘gyInit’:
drivers/gy-85.c:15:30: error: ‘BCM2835_I2C_CLOCK_DIVIDER_2500’ undeclared (first use in this function)
drivers/gy-85.c:15:30: note: each undeclared identifier is reported only once for each function it appears in
drivers/gy-85.c: In function ‘gyUpdate’:
drivers/gy-85.c:29:2: error: unknown type name ‘int16_t’
drivers/gy-85.c:30:2: error: unknown type name ‘uint8_t’
drivers/gy-85.c:32:9: error: ‘int16_t’ undeclared (first use in this function)
drivers/gy-85.c:32:18: error: expected expression before ‘)’ token
drivers/gy-85.c:40:18: error: expected expression before ‘)’ token
drivers/gy-85.c:47:18: error: expected expression before ‘)’ token
drivers/gy-85.c:61:2: warning: return from incompatible pointer type [enabled by default]
In file included from drivers/nrf24l01.c:1:0:
drivers/nrf24l01.h:5:21: fatal error: bcm2835.h: No such file or directory
compilation terminated.
In file included from src/dcm.c:1:0:
src/dcm.h:4:21: fatal error: bcm2835.h: No such file or directory
compilation terminated.
In file included from main.c:1:0:
config.h:9:21: fatal error: bcm2835.h: No such file or directory
compilation terminated.
make: *** [all] Error 1
If you can point out the main problem with my file structure I would be so glad!
Current error list:
gcc -o TEST -I libs -I drivers -I src libs/bcm2835.c drivers/adxl345.c drivers/itg3200.c drivers/hmc5883l.c drivers/gy-85.c drivers/nrf24l01.c src/dcm.c main.c
drivers/gy-85.c: In function ‘gyUpdate’:
drivers/gy-85.c:63:2: warning: return from incompatible pointer type [enabled by default]
main.c: In function ‘main’:
main.c:51:4: warning: passing argument 1 of ‘nrf24Transmit’ from incompatible pointer type [enabled by default]
drivers/nrf24l01.h:145:9: note: expected ‘uint8_t *’ but argument is of type ‘uint64_t *’
/tmp/ccOWR401.o:(.bss+0x0): multiple definition of `accelRaw'
/tmp/cc1gy1Bh.o:(.bss+0x0): first defined here
/tmp/ccOWR401.o:(.bss+0x8): multiple definition of `accelBias'
/tmp/cc1gy1Bh.o:(.bss+0x8): first defined here
/tmp/ccyZlhJe.o:(.bss+0x0): multiple definition of `accelRaw'
/tmp/cc1gy1Bh.o:(.bss+0x0): first defined here
/tmp/ccyZlhJe.o:(.bss+0x8): multiple definition of `accelBias'
/tmp/cc1gy1Bh.o:(.bss+0x8): first defined here
/tmp/ccUbOIyA.o:(.bss+0x0): multiple definition of `accelRaw'
/tmp/cc1gy1Bh.o:(.bss+0x0): first defined here
/tmp/ccUbOIyA.o:(.bss+0x8): multiple definition of `accelBias'
/tmp/cc1gy1Bh.o:(.bss+0x8): first defined here
/tmp/ccyZlhJe.o: In function `resetFusion':
dcm.c:(.text+0x38): undefined reference to `atan2'
collect2: ld returned 1 exit status
make: *** [all] Error 1
You don't have your includes in your rule
INCLUDES = -I $(DRV_PATH) -I $(LIB_PATH) -I $(SRC_PATH)
This just seems to dangle. Simplest solution to my eyes is to move down your CFLAGS definition and add in the includes:
INCLUDES = -I $(DRV_PATH) -I $(LIB_PATH) -I $(SRC_PATH)
CFLAGS = -o $(INCLUDES)
This way you don't have to change anything else. Of course, there are alternatives, this one just looks easiest.
When I compile the following program I get errors :
gcc tester.c -o tester
tester.c: In function ‘main’:
tester.c:7:17: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘ptr_X’
tester.c:7:17: error: ‘ptr_X’ undeclared (first use in this function)
tester.c:7:17: note: each undeclared identifier is reported only once for each function it appears in
tester.c:10:17: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘ptr_Y’
tester.c:10:17: error: ‘ptr_Y’ undeclared (first use in this function)
#include <stdio.h>
int main() {
int x = 10;
int y = 20;
int *restrict ptr_X;
ptr_X = &x;
int *restrict ptr_Y;
ptr_Y = &y;
printf("%d\n",*ptr_X);
printf("%d\n",*ptr_Y);
}
Why am I getting these errors ?
Not all compilers are compliant with the C99 standard. For example Microsoft's compiler, does not support the C99 standard at all. If you are using MSVC on a x86 platform you will not have access to this critical optimization option.
When using GCC, remember to enable the C99 standard by adding -std=c99 to your compilation flags. In code that cannot be compiled with C99, use either __restrict or __restrict__ to enable the keyword as a GCC extension.
From here.
Restrict is part of C99, and therefore you have to compile it as a C99 program by specifying -std=c99 flag to gcc.
gcc -std=c99 tester.c -o tester
I want to make m3u8-segmenter for Http Live Stream: https://github.com/johnf/m3u8-segmenter
There are errors when I make, the errors are:
gcc -g -O -Wall -Wstrict-prototypes -Wmissing-prototypes -Waggregate-return -Wcast-align -Wcast-qual -Wnested-externs -Wshadow -Wbad-function-cast -Wwrite-strings -Werror m3u8-segmenter.c -o m3u8-segmenter -lavformat -lavcodec -lavutil
m3u8-segmenter.c: In function ‘add_output_stream’:
m3u8-segmenter.c:82:14: error: ‘CODEC_TYPE_AUDIO’ undeclared (first use in this function)
m3u8-segmenter.c:82:14: note: each undeclared identifier is reported only once for each function it appears in
m3u8-segmenter.c:94:14: error: ‘CODEC_TYPE_VIDEO’ undeclared (first use in this function)
m3u8-segmenter.c: In function ‘main’:
m3u8-segmenter.c:338:5: error: ‘av_open_input_file’ is deprecated (declared at /usr/local/include/libavformat/avformat.h:1090) [-Werror=deprecated-declarations]
m3u8-segmenter.c:352:5: error: implicit declaration of function ‘guess_format’ [-Werror=implicit-function-declaration]
m3u8-segmenter.c:352:5: error: nested extern declaration of ‘guess_format’ [-Werror=nested-externs]
m3u8-segmenter.c:352:10: error: assignment makes pointer from integer without a cast [-Werror]
m3u8-segmenter.c:371:18: error: ‘CODEC_TYPE_VIDEO’ undeclared (first use in this function)
m3u8-segmenter.c:376:18: error: ‘CODEC_TYPE_AUDIO’ undeclared (first use in this function)
m3u8-segmenter.c:387:5: error: ‘av_set_parameters’ is deprecated (declared at /usr/local/include/libavformat/avformat.h:1434) [-Werror=deprecated-declarations]
m3u8-segmenter.c:392:5: error: ‘dump_format’ is deprecated (declared at /usr/local/include/libavformat/avformat.h:1559) [-Werror=deprecated-declarations]
m3u8-segmenter.c:406:5: error: ‘url_fopen’ is deprecated (declared at /usr/local/include/libavformat/avio.h:279) [-Werror=deprecated-declarations]
m3u8-segmenter.c:411:5: error: ‘av_write_header’ is deprecated (declared at /usr/local/include/libavformat/avformat.h:1492) [-Werror=deprecated-declarations]
m3u8-segmenter.c:444:67: error: ‘PKT_FLAG_KEY’ undeclared (first use in this function)
m3u8-segmenter.c:455:13: error: ‘put_flush_packet’ is deprecated (declared at /usr/local/include/libavformat/avio.h:293) [-Werror=deprecated-declarations]
m3u8-segmenter.c:456:13: error: ‘url_fclose’ is deprecated (declared at /usr/local/include/libavformat/avio.h:280) [-Werror=deprecated-declarations]
m3u8-segmenter.c:476:13: error: ‘url_fopen’ is deprecated (declared at /usr/local/include/libavformat/avio.h:279) [-Werror=deprecated-declarations]
m3u8-segmenter.c:482:13: error: ‘av_write_header’ is deprecated (declared at /usr/local/include/libavformat/avformat.h:1492) [-Werror=deprecated-declarations]
m3u8-segmenter.c:514:5: error: ‘url_fclose’ is deprecated (declared at /usr/local/include/libavformat/avio.h:280) [-Werror=deprecated-declarations]
cc1: all warnings being treated as errors
make: *** [all] Error 1
You're getting those errors because for some reason, this block in libav_compat.h took effect:
/* Support older versions of ffmpeg and libav */
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(52, 64, 0)
#define AVMEDIA_TYPE_AUDIO CODEC_TYPE_AUDIO
#define AVMEDIA_TYPE_VIDEO CODEC_TYPE_VIDEO
#define AV_PKT_FLAG_KEY PKT_FLAG_KEY
#endif
But whichever headers are supposed to define CODEC_TYPE_AUDIO and CODEC_TYPE_VIDEO don't. From the comment there, it looks like you probably should update your other software (ffmpeg and/or libav) and then try again.
This is probably a very difficult problem to troubleshoot with the information I can practically provide, but I'm hoping someone might be able to at least point me in a possible direction.
I'm trying to install HTK (http://htk.eng.cam.ac.uk/), which, according to this page needs to be installed using gcc 3.4. Their method of implementing backwards compatibility:
#yum install compat-gcc-34-c++ compat-gcc-34
won't work for me as I'm running Ubuntu (On that note, I take it I can't simply install YUM and the subsequent package, since it's an entirely different distro, but if I'm wrong I'd love to hear it).
I instead installed two versions of gcc 3.4 - 3.4.0 and 3.4.6 using instructions from this site. I then added the lines suggested by that page to the top of the makefile (on this note, what's the difference between makefile and makefile.in? I tried adding the lines to the top of both files regardless), both for version 3.4.0 and 3.4.6, but both failed. I also tried, on the off-chance, compiling it with my current version (4.4.1), but that also failed. I got the errors:
(cd HTKLib && make HTKLib.a) \
|| case "" in *k*) fail=yes;; *) exit 1;; esac;
make[1]: Entering directory `/home/charles/bin/htk-3.4/HTKLib'
gcc -ansi -D_SVID_SOURCE -DOSS_AUDIO -D'ARCH="i686"' -Wall -Wno-switch -g -O2 -I. -c -o HGraf.o HGraf.c
HGraf.c:73:77: error: X11/Xlib.h: No such file or directory
HGraf.c:74:23: error: X11/Xutil.h: No such file or directory
HGraf.c:75:21: error: X11/Xos.h: No such file or directory
HGraf.c:77:27: error: X11/keysymdef.h: No such file or directory
HGraf.c:87: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
HGraf.c:88: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘rootW’
HGraf.c:91: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘theCmap’
HGraf.c:92: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘theGC’
HGraf.c:93: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘gcs’
HGraf.c:95: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
HGraf.c:96: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘report’
HGraf.c:97: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘hints’
HGraf.c:111: error: ‘GXcopy’ undeclared here (not in a function)
HGraf.c:111: error: ‘GXor’ undeclared here (not in a function)
HGraf.c:111: error: ‘GXxor’ undeclared here (not in a function)
HGraf.c:111: error: ‘GXinvert’ undeclared here (not in a function)
HGraf.c:151: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
HGraf.c: In function ‘InstallFonts’:
HGraf.c:164: error: ‘FontInfo’ undeclared (first use in this function)
HGraf.c:164: error: (Each undeclared identifier is reported only once
HGraf.c:164: error: for each function it appears in.)
HGraf.c:164: warning: implicit declaration of function ‘XLoadQueryFont’
HGraf.c:164: error: ‘theDisp’ undeclared (first use in this function)
HGraf.c:167: error: ‘DefaultFont’ undeclared (first use in this function)
HGraf.c: At top level:
HGraf.c:176: error: expected ‘)’ before ‘*’ token
HGraf.c: In function ‘HGetEvent’:
HGraf.c:219: error: ‘XEvent’ undeclared (first use in this function)
HGraf.c:219: error: expected ‘;’ before ‘xev’
HGraf.c:223: warning: implicit declaration of function ‘XFlush’
HGraf.c:223: error: ‘theDisp’ undeclared (first use in this function)
HGraf.c:225: warning: implicit declaration of function ‘XEventsQueued’
HGraf.c:225: error: ‘QueuedAfterFlush’ undeclared (first use in this function)
HGraf.c:226: warning: implicit declaration of function ‘XNextEvent’
HGraf.c:226: error: ‘xev’ undeclared (first use in this function)
HGraf.c:228: error: ‘theWindow’ undeclared (first use in this function)
HGraf.c:230: error: ‘ButtonPress’ undeclared (first use in this function)
HGraf.c:235: error: ‘ButtonRelease’ undeclared (first use in this function)
HGraf.c:240: error: ‘MotionNotify’ undeclared (first use in this function)
HGraf.c:245: error: ‘KeyPress’ undeclared (first use in this function)
HGraf.c:249: warning: implicit declaration of function ‘DecodeKeyPress’
HGraf.c:251: error: ‘KeyRelease’ undeclared (first use in this function)
HGraf.c:257: error: ‘Expose’ undeclared (first use in this function)
HGraf.c: In function ‘HEventsPending’:
HGraf.c:281: error: ‘theDisp’ undeclared (first use in this function)
HGraf.c:281: error: ‘QueuedAfterFlush’ undeclared (first use in this function)
HGraf.c: In function ‘HMousePos’:
HGraf.c:288: error: ‘Window’ undeclared (first use in this function)
HGraf.c:288: error: expected ‘;’ before ‘root’
HGraf.c:293: warning: implicit declaration of function ‘XQueryPointer’
HGraf.c:293: error: ‘theDisp’ undeclared (first use in this function)
HGraf.c:293: error: ‘theWindow’ undeclared (first use in this function)
HGraf.c:293: error: ‘root’ undeclared (first use in this function)
HGraf.c:293: error: ‘child’ undeclared (first use in this function)
HGraf.c: In function ‘InstallColours’:
HGraf.c:311: error: ‘XColor’ undeclared (first use in this function)
HGraf.c:311: error: expected ‘;’ before ‘greyDef’
HGraf.c:317: warning: implicit declaration of function ‘XParseColor’
HGraf.c:317: error: ‘theDisp’ undeclared (first use in this function)
HGraf.c:317: error: ‘theCmap’ undeclared (first use in this function)
HGraf.c:317: error: ‘colourDef’ undeclared (first use in this function)
HGraf.c:320: warning: implicit declaration of function ‘XAllocColor’
HGraf.c:334: error: ‘whiteDef’ undeclared (first use in this function)
HGraf.c:334: warning: implicit declaration of function ‘XQueryColor’
HGraf.c:335: error: ‘blackDef’ undeclared (first use in this function)
HGraf.c:341: error: ‘greyDef’ undeclared (first use in this function)
HGraf.c: In function ‘HSetColour’:
HGraf.c:361: warning: implicit declaration of function ‘XSetForeground’
HGraf.c:361: error: ‘theDisp’ undeclared (first use in this function)
HGraf.c:361: error: ‘gcs’ undeclared (first use in this function)
HGraf.c: In function ‘HSetGrey’:
HGraf.c:370: error: ‘theDisp’ undeclared (first use in this function)
HGraf.c:370: error: ‘gcs’ undeclared (first use in this function)
HGraf.c: In function ‘HDrawLines’:
HGraf.c:388: warning: implicit declaration of function ‘XDrawLines’
HGraf.c:388: error: ‘theDisp’ undeclared (first use in this function)
HGraf.c:388: error: ‘theWindow’ undeclared (first use in this function)
HGraf.c:388: error: ‘theGC’ undeclared (first use in this function)
HGraf.c:388: error: ‘XPoint’ undeclared (first use in this function)
HGraf.c:388: error: expected expression before ‘)’ token
HGraf.c: In function ‘HDrawRectangle’:
HGraf.c:395: warning: implicit declaration of function ‘XDrawRectangle’
HGraf.c:395: error: ‘theDisp’ undeclared (first use in this function)
HGraf.c:395: error: ‘theWindow’ undeclared (first use in this function)
HGraf.c:395: error: ‘theGC’ undeclared (first use in this function)
HGraf.c: In function ‘HFillRectangle’:
HGraf.c:402: warning: implicit declaration of function ‘XFillRectangle’
HGraf.c:402: error: ‘theDisp’ undeclared (first use in this function)
HGraf.c:402: error: ‘theWindow’ undeclared (first use in this function)
HGraf.c:402: error: ‘theGC’ undeclared (first use in this function)
HGraf.c: In function ‘HDrawLine’:
HGraf.c:408: warning: implicit declaration of function ‘XDrawLine’
HGraf.c:408: error: ‘theDisp’ undeclared (first use in this function)
HGraf.c:408: error: ‘theWindow’ undeclared (first use in this function)
HGraf.c:408: error: ‘theGC’ undeclared (first use in this function)
HGraf.c: In function ‘HFillPolygon’:
HGraf.c:414: warning: implicit declaration of function ‘XFillPolygon’
HGraf.c:414: error: ‘theDisp’ undeclared (first use in this function)
HGraf.c:414: error: ‘theWindow’ undeclared (first use in this function)
HGraf.c:414: error: ‘theGC’ undeclared (first use in this function)
HGraf.c:414: error: ‘XPoint’ undeclared (first use in this function)
HGraf.c:414: error: expected expression before ‘)’ token
HGraf.c: In function ‘HDrawArc’:
HGraf.c:427: warning: implicit declaration of function ‘XDrawArc’
HGraf.c:427: error: ‘theDisp’ undeclared (first use in this function)
HGraf.c:427: error: ‘theWindow’ undeclared (first use in this function)
HGraf.c:427: error: ‘theGC’ undeclared (first use in this function)
HGraf.c: In function ‘HFillArc’:
HGraf.c:440: warning: implicit declaration of function ‘XFillArc’
HGraf.c:440: error: ‘theDisp’ undeclared (first use in this function)
HGraf.c:440: error: ‘theWindow’ undeclared (first use in this function)
HGraf.c:440: error: ‘theGC’ undeclared (first use in this function)
HGraf.c: In function ‘HPrintf’:
HGraf.c:451: warning: implicit declaration of function ‘XDrawString’
HGraf.c:451: error: ‘theDisp’ undeclared (first use in this function)
HGraf.c:451: error: ‘theWindow’ undeclared (first use in this function)
HGraf.c:451: error: ‘theGC’ undeclared (first use in this function)
HGraf.c: In function ‘HCopyArea’:
HGraf.c:457: warning: implicit declaration of function ‘XCopyArea’
HGraf.c:457: error: ‘theDisp’ undeclared (first use in this function)
HGraf.c:457: error: ‘theWindow’ undeclared (first use in this function)
HGraf.c:457: error: ‘theGC’ undeclared (first use in this function)
HGraf.c: In function ‘HPlotVector’:
HGraf.c:476: error: ‘theDisp’ undeclared (first use in this function)
HGraf.c:476: error: ‘theWindow’ undeclared (first use in this function)
HGraf.c:476: error: ‘theGC’ undeclared (first use in this function)
HGraf.c: In function ‘HSetFontSize’:
HGraf.c:490: error: ‘CurrentFont’ undeclared (first use in this function)
HGraf.c:490: error: ‘DefaultFont’ undeclared (first use in this function)
HGraf.c:499: error: ‘FontInfo’ undeclared (first use in this function)
HGraf.c:502: warning: implicit declaration of function ‘XSetFont’
HGraf.c:502: error: ‘theDisp’ undeclared (first use in this function)
HGraf.c:502: error: ‘gcs’ undeclared (first use in this function)
HGraf.c: In function ‘HSetLineWidth’:
HGraf.c:511: warning: implicit declaration of function ‘XSetLineAttributes’
HGraf.c:511: error: ‘theDisp’ undeclared (first use in this function)
HGraf.c:511: error: ‘gcs’ undeclared (first use in this function)
HGraf.c:511: error: ‘LineSolid’ undeclared (first use in this function)
HGraf.c:511: error: ‘JoinRound’ undeclared (first use in this function)
HGraf.c:511: error: ‘FillSolid’ undeclared (first use in this function)
HGraf.c: In function ‘HSetXMode’:
HGraf.c:517: error: ‘theGC’ undeclared (first use in this function)
HGraf.c:517: error: ‘gcs’ undeclared (first use in this function)
HGraf.c: In function ‘CentreX’:
HGraf.c:523: warning: implicit declaration of function ‘XTextWidth’
HGraf.c:523: error: ‘CurrentFont’ undeclared (first use in this function)
HGraf.c: In function ‘CentreY’:
HGraf.c:529: error: ‘CurrentFont’ undeclared (first use in this function)
HGraf.c: In function ‘HTextWidth’:
HGraf.c:535: error: ‘CurrentFont’ undeclared (first use in this function)
HGraf.c: In function ‘HTextHeight’:
HGraf.c:541: error: ‘CurrentFont’ undeclared (first use in this function)
HGraf.c: In function ‘HDrawImage’:
HGraf.c:550: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
HGraf.c:550: error: ‘xi’ undeclared (first use in this function)
HGraf.c:557: warning: implicit declaration of function ‘XDestroyImage’
HGraf.c:558: warning: implicit declaration of function ‘XGetImage’
HGraf.c:558: error: ‘theDisp’ undeclared (first use in this function)
HGraf.c:558: error: ‘theWindow’ undeclared (first use in this function)
HGraf.c:558: error: ‘AllPlanes’ undeclared (first use in this function)
HGraf.c:558: error: ‘XYPixmap’ undeclared (first use in this function)
HGraf.c:562: warning: implicit declaration of function ‘XPutPixel’
HGraf.c:564: warning: implicit declaration of function ‘XPutImage’
HGraf.c:564: error: ‘theGC’ undeclared (first use in this function)
HGraf.c: In function ‘HFlush’:
HGraf.c:570: error: ‘theDisp’ undeclared (first use in this function)
HGraf.c: In function ‘InitGCs’:
HGraf.c:780: error: ‘XGCValues’ undeclared (first use in this function)
HGraf.c:780: error: expected ‘;’ before ‘values’
HGraf.c:783: error: ‘GCLineWidth’ undeclared (first use in this function)
HGraf.c:783: error: ‘GCFunction’ undeclared (first use in this function)
HGraf.c:783: error: ‘GCForeground’ undeclared (first use in this function)
HGraf.c:785: error: ‘values’ undeclared (first use in this function)
HGraf.c:788: error: ‘gcs’ undeclared (first use in this function)
HGraf.c:788: warning: implicit declaration of function ‘XCreateGC’
HGraf.c:788: error: ‘theDisp’ undeclared (first use in this function)
HGraf.c:788: error: ‘theWindow’ undeclared (first use in this function)
HGraf.c:790: error: ‘GCPlaneMask’ undeclared (first use in this function)
HGraf.c: In function ‘InitGlobals’:
HGraf.c:800: warning: implicit declaration of function ‘DefaultScreen’
HGraf.c:800: error: ‘theDisp’ undeclared (first use in this function)
HGraf.c:801: error: ‘theCmap’ undeclared (first use in this function)
HGraf.c:801: warning: implicit declaration of function ‘DefaultColormap’
HGraf.c:802: error: ‘rootW’ undeclared (first use in this function)
HGraf.c:802: warning: implicit declaration of function ‘RootWindow’
HGraf.c:803: error: ‘theGC’ undeclared (first use in this function)
HGraf.c:803: warning: implicit declaration of function ‘DefaultGC’
HGraf.c:804: error: ‘theVisual’ undeclared (first use in this function)
HGraf.c:804: warning: implicit declaration of function ‘DefaultVisual’
HGraf.c:805: warning: implicit declaration of function ‘DisplayCells’
HGraf.c:806: warning: implicit declaration of function ‘DisplayWidth’
HGraf.c:807: warning: implicit declaration of function ‘DisplayHeight’
HGraf.c:808: warning: implicit declaration of function ‘DisplayPlanes’
HGraf.c:809: warning: implicit declaration of function ‘WhitePixel’
HGraf.c:810: warning: implicit declaration of function ‘BlackPixel’
HGraf.c: In function ‘MakeXGraf’:
HGraf.c:817: error: ‘Window’ undeclared (first use in this function)
HGraf.c:817: error: expected ‘;’ before ‘window’
HGraf.c:818: error: ‘XSetWindowAttributes’ undeclared (first use in this function)
HGraf.c:818: error: expected ‘;’ before ‘setwinattr’
HGraf.c:823: error: ‘theDisp’ undeclared (first use in this function)
HGraf.c:823: warning: implicit declaration of function ‘XOpenDisplay’
HGraf.c:824: warning: implicit declaration of function ‘XDisplayName’
HGraf.c:828: error: ‘parent’ undeclared (first use in this function)
HGraf.c:829: error: ‘window’ undeclared (first use in this function)
HGraf.c:829: warning: implicit declaration of function ‘XCreateSimpleWindow’
HGraf.c:831: error: ‘CWBackingStore’ undeclared (first use in this function)
HGraf.c:831: error: ‘setwinattr’ undeclared (first use in this function)
HGraf.c:831: error: ‘WhenMapped’ undeclared (first use in this function)
HGraf.c:832: warning: implicit declaration of function ‘XChangeWindowAttributes’
HGraf.c:834: error: ‘hints’ undeclared (first use in this function)
HGraf.c:834: error: ‘PPosition’ undeclared (first use in this function)
HGraf.c:834: error: ‘PSize’ undeclared (first use in this function)
HGraf.c:834: error: ‘PMaxSize’ undeclared (first use in this function)
HGraf.c:834: error: ‘PMinSize’ undeclared (first use in this function)
HGraf.c:841: warning: implicit declaration of function ‘XSetStandardProperties’
HGraf.c:841: error: ‘None’ undeclared (first use in this function)
HGraf.c:843: warning: implicit declaration of function ‘XSelectInput’
HGraf.c:843: error: ‘ExposureMask’ undeclared (first use in this function)
HGraf.c:843: error: ‘KeyPressMask’ undeclared (first use in this function)
HGraf.c:843: error: ‘ButtonPressMask’ undeclared (first use in this function)
HGraf.c:844: error: ‘ButtonReleaseMask’ undeclared (first use in this function)
HGraf.c:844: error: ‘PointerMotionHintMask’ undeclared (first use in this function)
HGraf.c:844: error: ‘PointerMotionMask’ undeclared (first use in this function)
HGraf.c:845: warning: implicit declaration of function ‘XMapWindow’
HGraf.c:845: error: ‘theWindow’ undeclared (first use in this function)
HGraf.c:850: error: ‘report’ undeclared (first use in this function)
HGraf.c:851: error: ‘Expose’ undeclared (first use in this function)
HGraf.c:852: warning: implicit declaration of function ‘XSendEvent’
HGraf.c:852: error: ‘False’ undeclared (first use in this function)
HGraf.c: In function ‘TermHGraf’:
HGraf.c:861: error: ‘theDisp’ undeclared (first use in this function)
HGraf.c:862: warning: implicit declaration of function ‘XCloseDisplay’
make[1]: *** [HGraf.o] Error 1
make[1]: Leaving directory `/home/charles/bin/htk-3.4/HTKLib'
make: *** [HTKLib/HTKLib.a] Error 1
Thank you for any help you can provide.
The very first error may indicate the cause:
error: X11/Xlib.h: No such file or directory
At one time one needed to set $INCLUDE_PATH for gcc.
It looks to me that you are missing the X11 development packages.
So, the presence of a makefile.in indicates that the program is using autoconf. That being the case, I suggest you put both the makefile and makefile.in back the way they were, and instead redo the configure step:
GCC_VERSION=3.4.0 PREFIX=/usr/local/gcc/${GCC_VERSION}/bin/ CC=${PREFIX}gcc CPP=${PREFIX}g++ ./configure
Obviously, you should edit that to match the actual version of the compiler and path where you installed it, along with adding any extra configure arguments you need.
Are you sure you have the X11-devel package installed? Looks like an abject lack of X11 header files.
The first set of errors is
HGraf.c:73:77: error: X11/Xlib.h: No such file or directory
HGraf.c:74:23: error: X11/Xutil.h: No such file or directory
HGraf.c:75:21: error: X11/Xos.h: No such file or directory
HGraf.c:77:27: error: X11/keysymdef.h: No such file or directory
i.e. your compiler can't find the X11 headers. These will probably be somewhere like /usr/X11R6/include. Try adding that include path to your make command, like
make CFLAGS="$CFLAGS -I/usr/X11R6/include"
If the makefile is nonstandard you might have to edit it to insert this path. If you've run a configure script reconfigure with
./configure CFLAGS="$CFLAGS -I/usr/X11R6/include" # Include any other options
Install the gcc-3.4 from Ubuntu repos (sudo apt-get install gcc-4.3).
Then configure the project using ./configure CC="gcc-4.3" and make as usual.
This might not work, but point you in the right direction.
EDIT: The X11 development libraries on Ubuntu are named libx11-dev but they might not be the only development libraries you are missing: read the errors and try to guess what other libraries you are missing (if you note that a header is missing try searching http://packages.ubuntu.com for the file name and add the relative package using sudo apt-get install).