HaxeFoundation / HaxeFoundation/hxcpp
hxcpp compilerflag -I seems to overwrite old values
- Dominant language
- C++
- Stars
- 330
- Forks
- 227
- Avg merge
- 2d 16h
- Merged PRs (30d)
- 18
Description
I am trying to use hxcpp target to build some code using glib.
By using the following build xml
```xml
```
I was able to do `#include "glib.h"` successfuly but unfortunately I've got the following error:
```
Compiling group: haxe
g++ -Iinclude -I /usr/include/glib-2.0 -c -fvisibility=hidden -O2 -fpic -fPIC -Wno-overflow
-DHX_LINUX -DHXCPP_M64 -DHXCPP_VISIT_ALLOCS(haxe) -DHXCPP_API_LEVEL=331(haxe)
-m64 -DHXCPP_M64 -I/home/ovidiu/haxelib/hxcpp/4,0,4/include ... tags=[haxe,static]
- src/glib/Main.cpp
Error: In file included from /usr/include/glib-2.0/glib/galloca.h:32:0,
from /usr/include/glib-2.0/glib.h:30,
from include/glib/Main.h:13,
from ./src/glib/Main.cpp:5:
/usr/include/glib-2.0/glib/gtypes.h:32:24: fatal error: glibconfig.h: No such file or
directory
#include
^
compilation terminated.
Error: Build failed
```
As my configuration reported by `pkg-config --cflags glib-2.0` is actually:
`-I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include `, I also added the second include path: **/usr/lib64/glib-2.0/include/** (which is the parent folder of glibconfig.h ... /usr/lib64/glib-2.0/include/glibconfig.h), so the build xml for compilation is now:
```xml
```
Unfortuntely for some reason this will prevent including glib.h from /usr/include/glib-2.0/glib.h, basically canceling the effect of adding the first compiler flag.
It looks like the second compilerflag overwrites the value set by the first compilerflag instead of appending to it. Please tell me if there is a bug or I am doing something wrong here.
Thanks!
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the issue with the shown build XML, especially the two compilerflag entries under the files tag, and compare the generated g++ command with the pkg-config include paths. Start by tracing how compilerflag name="-I" values are collected; done means both /usr/include/glib-2.0 and /usr/lib64/glib-2.0/include appear in the command and glib.h compiles successfully.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100