fatal error: 'config.h' file not found #2682

Hi,

I am using syslog-ng-3.6.2 (https://src.fedoraproject.org/lookaside/pkgs/syslog-ng/syslog-ng_3.6.2.tar.gz/6928e9be3499a2e9ae52ea8aa204b165/).
I want to use syslog-ng header files in my project.
This is my repository : https://github.com/nitishsaboo/Testing
syslog-node.c is a file where I am using syslog-ng’s header files.
The match function in ‘syslog-node.c’ is being called from ‘main.go’ file.

When I run ‘go build’ it fails with the following error:

forgithub

syslog-node.c:2:10: fatal error: config.h: No such file or directory
#include “config.h”
^~~~~~~~~~
compilation terminated.

However, ‘config.h’ file is present in syslog-ng-3.6.2 directory where main.go is present but still it is not able to find ‘config.h’.

nitish@nitish-VirtualBox:~/Documents/goworkspace/src/forgithub$ ls
common.gypi syslog-ng-3.13.2 syslog-node.c
deps syslog-ng-3.13.2.tar.gz syslog-node.gyp
eventlog-0.2.13 syslog-ng-3.6.2 syslog-node.h
eventlog_0.2.13.tar.gz syslog-ng_3.6.2.tar.gz
main.go syslog-node1.h

nitish@nitish-VirtualBox:~/Documents/goworkspace/src/forgithub/syslog-ng-3.6.2$ ls
aclocal.m4 CONTRIBUTING.md m4 syslog-ng
AUTHORS COPYING Makefile syslog-ng-ctl
autogen.sh debian Makefile.am syslog-ng.pc
compile depcomp Makefile.in syslog-ng.pc.in
config.guess dist.conf missing syslog-ng.spec
config.h dist.conf.in Mk syslog-ng.spec.in
config.h.in doc modules test-driver
config.log INSTALL NEWS.md tests
config.status install-sh pkg-config-0.29 tgz2build
config.sub lib pkgconfig.tgz VERSION
configure libtest scl ylwrap
configure.ac libtool scripts
contrib ltmain.sh stamp-h1

go build -x:

WORK=/tmp/go-build995828799
mkdir -p $WORK/b001/
cd /home/nitish/Documents/goworkspace/src/forgithub
CGO_LDFLAGS=’"-g" “-O2”’ /usr/local/go/pkg/tool/linux_amd64/cgo -objdir $WORK/b001/ -importpath forgithub – -I $WORK/b001/ -g -O2 -I ./syslog-ng-3.6.2/include ./main.go
cd $WORK
gcc -fno-caret-diagnostics -c -x c - || true
gcc -Qunused-arguments -c -x c - || true
gcc -fdebug-prefix-map=a=b -c -x c - || true
gcc -gno-record-gcc-switches -c -x c - || true
cd $WORK/b001
TERM=‘dumb’ gcc -I /home/nitish/Documents/goworkspace/src/forgithub -fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK/b001=/tmp/go-build -gno-record-gcc-switches -I ./ -g -O2 -I /home/nitish/Documents/goworkspace/src/forgithub/syslog-ng-3.6.2/include -o ./_x001.o -c _cgo_export.c
TERM=‘dumb’ gcc -I /home/nitish/Documents/goworkspace/src/forgithub -fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK/b001=/tmp/go-build -gno-record-gcc-switches -I ./ -g -O2 -I /home/nitish/Documents/goworkspace/src/forgithub/syslog-ng-3.6.2/include -o ./_x002.o -c main.cgo2.c
cd /home/nitish/Documents/goworkspace/src/forgithub
TERM=‘dumb’ gcc -I . -fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK/b001=/tmp/go-build -gno-record-gcc-switches -I $WORK/b001/ -g -O2 -I ./syslog-ng-3.6.2/include -o $WORK/b001/_x003.o -c syslog-node.c

forgithub

syslog-node.c:2:10: fatal error: config.h: No such file or directory
#include “config.h”
^~~~~~~~~~
compilation terminated.

1)Do you think there is some issue with the GO code where I need to add some flag to point it to the config.h?
2)Can you please guide me in the right direction to fix this compilation issue, as in where am i missing the piece of link ?

Thanks

Here it includes the folder include but this doesn’t show then you ls above. Maybe you could change this path to point to the parent folder ./syslog-ng-3.6.2 or move config.h into a folder called include

Hi Johan

Made recommended changes to the file main.go.You can see the file in my repository : https://github.com/nitishsaboo/Testing

Now ‘go build -x’ is failing with the following error:

WORK=/tmp/go-build838755651
mkdir -p $WORK/b001/
cd /home/nitish/Documents/goworkspace/src/forgithub
CGO_LDFLAGS=’"-g" “-O2”’ /usr/local/go/pkg/tool/linux_amd64/cgo -objdir $WORK/b001/ -importpath forgithub – -I $WORK/b001/ -g -O2 -I/tmp/install/syslog-ng-3.6.2/ -I/usr/local/include/syslog-ng/ -I/usr/local/include/syslog-ng/compat/ -I/tmp/install/syslog-ng-3.6.2/lib/compat/ -I/tmp/install/syslog-ng-3.6.2/lib/ivykis/ -I/usr/local/include/syslog-ng/ivykis/ -I/usr/local/include/eventlog/ -I/usr/include/glib-2.0/ -I/tmp/install/syslog-ng-3.6.2/modules/ ./main.go
cd $WORK
gcc -fno-caret-diagnostics -c -x c - || true
gcc -Qunused-arguments -c -x c - || true
gcc -fdebug-prefix-map=a=b -c -x c - || true
gcc -gno-record-gcc-switches -c -x c - || true
cd $WORK/b001
TERM=‘dumb’ gcc -I /home/nitish/Documents/goworkspace/src/forgithub -fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK/b001=/tmp/go-build -gno-record-gcc-switches -I ./ -g -O2 -I/tmp/install/syslog-ng-3.6.2/ -I/usr/local/include/syslog-ng/ -I/usr/local/include/syslog-ng/compat/ -I/tmp/install/syslog-ng-3.6.2/lib/compat/ -I/tmp/install/syslog-ng-3.6.2/lib/ivykis/ -I/usr/local/include/syslog-ng/ivykis/ -I/usr/local/include/eventlog/ -I/usr/include/glib-2.0/ -I/tmp/install/syslog-ng-3.6.2/modules/ -o ./_x001.o -c _cgo_export.c
TERM=‘dumb’ gcc -I /home/nitish/Documents/goworkspace/src/forgithub -fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK/b001=/tmp/go-build -gno-record-gcc-switches -I ./ -g -O2 -I/tmp/install/syslog-ng-3.6.2/ -I/usr/local/include/syslog-ng/ -I/usr/local/include/syslog-ng/compat/ -I/tmp/install/syslog-ng-3.6.2/lib/compat/ -I/tmp/install/syslog-ng-3.6.2/lib/ivykis/ -I/usr/local/include/syslog-ng/ivykis/ -I/usr/local/include/eventlog/ -I/usr/include/glib-2.0/ -I/tmp/install/syslog-ng-3.6.2/modules/ -o ./_x002.o -c main.cgo2.c
cd /home/nitish/Documents/goworkspace/src/forgithub
TERM=‘dumb’ gcc -I . -fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK/b001=/tmp/go-build -gno-record-gcc-switches -I $WORK/b001/ -g -O2 -I/tmp/install/syslog-ng-3.6.2/ -I/usr/local/include/syslog-ng/ -I/usr/local/include/syslog-ng/compat/ -I/tmp/install/syslog-ng-3.6.2/lib/compat/ -I/tmp/install/syslog-ng-3.6.2/lib/ivykis/ -I/usr/local/include/syslog-ng/ivykis/ -I/usr/local/include/eventlog/ -I/usr/include/glib-2.0/ -I/tmp/install/syslog-ng-3.6.2/modules/ -o $WORK/b001/_x003.o -c syslog-node.c

forgithub

In file included from /usr/local/include/syslog-ng/apphook.h:28:0,
from syslog-node.c:3:
/usr/local/include/syslog-ng/syslog-ng.h:58:14: error: unknown type name ‘gchar’
extern const gchar *module_path;
^~~~~
In file included from syslog-node.c:3:0:
/usr/local/include/syslog-ng/apphook.h:40:37: error: unknown type name ‘gint’; did you mean ‘uint’?
typedef void (*ApplicationHookFunc)(gint type, gpointer user_data);
^~~~
uint
/usr/local/include/syslog-ng/apphook.h:40:48: error: unknown type name ‘gpointer’
typedef void (*ApplicationHookFunc)(gint type, gpointer user_data);
^~~~~~~~
/usr/local/include/syslog-ng/apphook.h:42:32: error: unknown type name ‘gint’; did you mean ‘uint’?
void register_application_hook(gint type, ApplicationHookFunc func, gpointer user_data);
^~~~
uint
/usr/local/include/syslog-ng/apphook.h:42:43: error: unknown type name ‘ApplicationHookFunc’
void register_application_hook(gint type, ApplicationHookFunc func, gpointer user_data);
^~~~~~~~~~~~~~~~~~~
/usr/local/include/syslog-ng/apphook.h:42:69: error: unknown type name ‘gpointer’
void register_application_hook(gint type, ApplicationHookFunc func, gpointer user_data);
^~~~~~~~
In file included from syslog-node.c:5:0:
/usr/local/include/syslog-ng/tags.h:30:9: error: unknown type name ‘guint16’
typedef guint16 LogTagId;
^~~~~~~
/usr/local/include/syslog-ng/tags.h:43:37: error: unknown type name ‘gchar’
LogTagId log_tags_get_by_name(const gchar *name);
^~~~~
/usr/local/include/syslog-ng/tags.h:44:7: error: unknown type name ‘gchar’
const gchar *log_tags_get_by_id(LogTagId id);
^~~~~
In file included from /usr/local/include/syslog-ng/gsockaddr.h:29:0,
from /usr/local/include/syslog-ng/logmsg.h:29,
from syslog-node.c:6:
/usr/local/include/syslog-ng/atomic.h:31:3: error: unknown type name ‘gint’
gint counter;
^~~~
/usr/local/include/syslog-ng/atomic.h:40:15: error: unknown type name ‘gboolean’
static inline gboolean
^~~~~~~~
/usr/local/include/syslog-ng/atomic.h:46:15: error: unknown type name ‘gint’
static inline gint

Can you please guide me as in which library I am missing here and what needs to be done in this case?

Thanks

It’s also possible that you have cgo enabled by default

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.