On Tue, Apr 16, 2019 at 9:56 PM Nitish Saboo <nitish.sabo...@gmail.com> wrote: > > I am new to GO.Can I get little help on this ?
It's really hard to know what the answer is. One thing you can try is adding a #cgo CFLAGS line with a -I option pointing to your syslog-ng directory. See https://golang.org/cmd/cgo. Ian > On Wednesday, April 17, 2019 at 12:09:30 AM UTC+5:30, Nitish Saboo wrote: >> >> 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 my syslog-ng-3.6.2 directory where >> main.go is present but it is still 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 >> >> >> nitish@nitish-VirtualBox:~$ cd >> Documents/goworkspace/src/forgithub/syslog-ng-3.6.2/ >> >> >> 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 >> flags to point it to the config.h? >> >> 2)Can you please guide me in the right direction to fix compilation issue, >> as in where am i missing the piece of link ? >> >> >> Thanks, >> >> Nitish >> >> >> >> > -- > You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to golang-nuts+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.