www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Error when compiling with C libs

reply barbosso <barb your.io> writes:
I can compile tilengine examples with clang, but with ldc I get 
this error.
Please explain the problem.

ldc -betterC -gcc=clang -release -O3 -L-s -flto=full 
-Xcc=-I./Tilengine/include -L-L./Tilengine/build 
-L-l:libTilengine.a -L-lSDL2 -L-lpng -L-lm -L-lz tilengine_main.d

/usr/include/bits/floatn-common.h(214): Error: illegal 
combination of type specifiers
/usr/include/bits/floatn-common.h(251): Error: illegal 
combination of type specifiers
/usr/include/bits/floatn-common.h(268): Error: illegal 
combination of type specifiers
/usr/include/bits/floatn-common.h(285): Error: illegal 
combination of type specifiers
/usr/include/bits/floatn-common.h(285): Error: illegal type 
combination
Oct 13
next sibling parent reply Sergey <kornburn yandex.ru> writes:
On Sunday, 13 October 2024 at 13:49:49 UTC, barbosso wrote:
 I can compile tilengine examples with clang, but with ldc I get 
 this error.
Did you try this bindings? https://github.com/thechampagne/dtilengine
Oct 13
parent barbosso <barb your.io> writes:
On Sunday, 13 October 2024 at 14:55:51 UTC, Sergey wrote:
 On Sunday, 13 October 2024 at 13:49:49 UTC, barbosso wrote:
 I can compile tilengine examples with clang, but with ldc I 
 get this error.
Did you try this bindings? https://github.com/thechampagne/dtilengine
I want betterC without bindings
Oct 13
prev sibling parent reply barbosso <barb your.io> writes:
On Sunday, 13 October 2024 at 13:49:49 UTC, barbosso wrote:
 I can compile tilengine examples with clang, but with ldc I get 
 this error.
 Please explain the problem.

 ldc -betterC -gcc=clang -release -O3 -L-s -flto=full 
 -Xcc=-I./Tilengine/include -L-L./Tilengine/build 
 -L-l:libTilengine.a -L-lSDL2 -L-lpng -L-lm -L-lz 
 tilengine_main.d

 /usr/include/bits/floatn-common.h(214): Error: illegal 
 combination of type specifiers
 /usr/include/bits/floatn-common.h(251): Error: illegal 
 combination of type specifiers
 /usr/include/bits/floatn-common.h(268): Error: illegal 
 combination of type specifiers
 /usr/include/bits/floatn-common.h(285): Error: illegal 
 combination of type specifiers
 /usr/include/bits/floatn-common.h(285): Error: illegal type 
 combination
error in line ```typedef float _Float32;``` clang can compile that line, but dmd or ldc can not! This is definatly compiler error!
Oct 13
parent reply Sergey <kornburn yandex.ru> writes:
On Sunday, 13 October 2024 at 20:06:44 UTC, barbosso wrote:
 error in line
 ```typedef float _Float32;```
 clang can compile that line,
 but dmd or ldc can not!
 This is definatly compiler error!
It is not an error.. This is just lack in the implementation. https://github.com/dlang/dmd/blob/f5fa64a8863e08673cf78a608d28b88e8df832f2/druntime/src/importc.h#L175 Somehow it is working on macOS - aarch64, and not working on Linux 864
Oct 13
next sibling parent barbosso <barb your.io> writes:
On Sunday, 13 October 2024 at 21:28:41 UTC, Sergey wrote:
 On Sunday, 13 October 2024 at 20:06:44 UTC, barbosso wrote:
 error in line
 ```typedef float _Float32;```
 clang can compile that line,
 but dmd or ldc can not!
 This is definatly compiler error!
It is not an error.. This is just lack in the implementation. https://github.com/dlang/dmd/blob/f5fa64a8863e08673cf78a608d28b88e8df832f2/druntime/src/importc.h#L175 Somehow it is working on macOS - aarch64, and not working on Linux 864
I found possible solution This error occure with inclusion of "/usr/include/bits/floatn-common.h" system lib to prevent error you can define __GNUC__ to be greater than 7 (for example - comment definition) //lib.c #define __GNUC__ 8 #include \<bits/floatn-common.h> // lib.c:1:9: warning: '__GNUC__' macro redefined [-Wmacro-redefined] 1 | #define __GNUC__ 8 | ^ \<built-in>:7:9: note: previous definition is here 7 | #define __GNUC__ 4 |
Oct 15
prev sibling parent barbosso <barb your.io> writes:
On Sunday, 13 October 2024 at 21:28:41 UTC, Sergey wrote:
 On Sunday, 13 October 2024 at 20:06:44 UTC, barbosso wrote:
 error in line
 ```typedef float _Float32;```
 clang can compile that line,
 but dmd or ldc can not!
 This is definatly compiler error!
It is not an error.. This is just lack in the implementation. https://github.com/dlang/dmd/blob/f5fa64a8863e08673cf78a608d28b88e8df832f2/druntime/src/importc.h#L175 Somehow it is working on macOS - aarch64, and not working on Linux 864
I found possible solution This error occure with inclusion of "/usr/include/bits/floatn-common.h" system lib to prevent error you can define __GNUC__ to be greater than 7 (for example - comment definition) //lib.c #define __GNUC__ 8 #include <bits/floatn-common.h> // lib.c:1:9: warning: '__GNUC__' macro redefined [-Wmacro-redefined] 1 | #define __GNUC__ 8 | ^ <built-in>:7:9: note: previous definition is here 7 | #define __GNUC__ 4 |
Oct 15