Terraspace / UASM

UASM - Macro Assembler
http://www.terraspace.co.uk/uasm.html
Other
220 stars 49 forks source link

Linux build fails. Both GccUnix.mak and Makefile_Linux fails. #97

Closed Un1Gfn closed 5 years ago

Un1Gfn commented 5 years ago

$ git rev-parse HEAD

f55763e062c9cc98c6e562d2d07232516de46a20

$ make -f GccUnix.mak

gcc -D __UNIX__ -c -IH -D __UNIX__ -DNDEBUG -O2  -o GccUnixR/main.o main.c
In file included from H/codegenv2.h:4,
                 from main.c:17:
H/expreval.h:105:24: error: field ‘instr’ has incomplete type
     enum special_token instr;       /* operator token */
                        ^~~~~
H/expreval.h:108:21: error: field ‘mem_type’ has incomplete type
     enum memtype    mem_type;       /* memory type if expr is a memory ref. */
                     ^~~~~~~~
H/expreval.h:140:55: error: array type has incomplete element type ‘struct asm_tok’
 ern ret_code     EvalOperand( int *, struct asm_tok[], int, struct expr *, uint_8 );
                                                    ^

In file included from main.c:17:
H/codegenv2.h:357:53: warning: ‘struct code_info’ declared inside parameter list will not be visible outside of this definition or declaration
 xtern ret_code CodeGenV2(const char* instr, struct code_info *CodeInfo, uint_32 oldofs, uint_32 opCount, struct expr opExpr[4]);
                                                    ^~~~~~~~~

H/codegenv2.h:365:69: warning: ‘struct code_info’ declared inside parameter list will not be visible outside of this definition or declaration
                 int srcRegNo, int dstRegNo, struct code_info *CodeInfo);
                                                    ^~~~~~~~~

H/codegenv2.h:366:67: warning: ‘struct opnd_item’ declared inside parameter list will not be visible outside of this definition or declaration
    MatchOperand(struct code_info *CodeInfo, struct opnd_item op, struct expr opExpr);
                                                    ^~~~~~~~~

H/codegenv2.h:366:39: warning: ‘struct code_info’ declared inside parameter list will not be visible outside of this definition or declaration
 enum op_type      MatchOperand(struct code_info *CodeInfo, struct opnd_item op, struct expr opExpr);
                                       ^~~~~~~~~
H/codegenv2.h:368:65: warning: ‘struct code_info’ declared inside parameter list will not be visible outside of this definition or declaration
 OPND_Size_Override(struct Instr_Def* instr, struct code_info* CodeInfo);
                                                    ^~~~~~~~~

H/codegenv2.h:369:65: warning: ‘struct code_info’ declared inside parameter list will not be visible outside of this definition or declaration
 ADDR_Size_Override(struct Instr_Def* instr, struct code_info* CodeInfo);
                                                    ^~~~~~~~~

H/codegenv2.h:378:68: warning: ‘struct code_info’ declared inside parameter list will not be visible outside of this definition or declaration
 , bool needX, bool needRR, uint_32 opCount, struct code_info* CodeInfo);     /* Build EVEX prefix bytes      */
                                                    ^~~~~~~~~

H/codegenv2.h:381:67: warning: ‘struct code_info’ declared inside parameter list will not be visible outside of this definition or declaration
 t expr opExpr[4], bool* needB, bool* needX, struct code_info *CodeInfo);    /* Build Memory encoding ModRM/SIB bytes   */
                                                    ^~~~~~~~~

make: *** [GccUnix.mak:34: GccUnixR/main.o] Error 1

$ sed -i 's/CC = clang-3.8/CC = clang/' Makefile_Linux; make -f Makefile_Linux

clang -D __UNIX__ -c -IH -D __UNIX__ -DNDEBUG -O2 -ansi -funsigned-char -fwritable-strings -o GccUnixR/main.o main.c
In file included from main.c:17:
In file included from H/codegenv2.h:4:
H/expreval.h:105:24: error: field has incomplete type
      'enum special_token'
    enum special_token instr;       /* operator token */
                       ^
H/expreval.h:105:10: note: forward declaration of
      'enum special_token'
    enum special_token instr;       /* operator token */
         ^
H/expreval.h:108:21: error: field has incomplete type
      'enum memtype'
    enum memtype    mem_type;       /* memory type if expr ...
                    ^
H/expreval.h:108:10: note: forward declaration of 'enum memtype'
    enum memtype    mem_type;       /* memory type if expr ...
         ^
H/expreval.h:140:55: error: array has incomplete element type
      'struct asm_tok'
extern ret_code     EvalOperand( int *, struct asm_tok[], int, str...
                                                      ^
H/globals.h:886:12: note: forward declaration of 'struct asm_tok'
    struct asm_tok      *tokenarray;     /* start token buffer */
           ^
In file included from main.c:17:
H/codegenv2.h:357:53: warning: declaration of 'struct code_info'
      will not be visible outside of this function [-Wvisibility]
extern ret_code CodeGenV2(const char* instr, struct code_in...
                                                    ^
H/codegenv2.h:365:69: warning: declaration of 'struct code_info'
      will not be visible outside of this function [-Wvisibility]
  ...int srcRegNo, int dstRegNo, struct code_info *CodeInfo);
                                        ^
H/codegenv2.h:366:39: warning: declaration of 'struct code_info'
      will not be visible outside of this function [-Wvisibility]
enum op_type      MatchOperand(struct code_info *CodeInfo, ...
                                      ^
H/codegenv2.h:366:67: warning: declaration of 'struct opnd_item'
      will not be visible outside of this function [-Wvisibility]
  ...MatchOperand(struct code_info *CodeInfo, struct opnd_item o...
                                                     ^
H/codegenv2.h:368:65: warning: declaration of 'struct code_info'
      will not be visible outside of this function [-Wvisibility]
  ...Instr_Def* instr, struct code_info* CodeInfo);
                              ^
H/codegenv2.h:369:65: warning: declaration of 'struct code_info'
      will not be visible outside of this function [-Wvisibility]
  ...Instr_Def* instr, struct code_info* CodeInfo);
                              ^
H/codegenv2.h:378:68: warning: declaration of 'struct code_info'
      will not be visible outside of this function [-Wvisibility]
  ...bool needX, bool needRR, uint_32 opCount, struct code_info...
                                                      ^
H/codegenv2.h:381:67: warning: declaration of 'struct code_info'
      will not be visible outside of this function [-Wvisibility]
  ...expr opExpr[4], bool* needB, bool* needX, struct code_info ...
                                                      ^
8 warnings and 3 errors generated.
make: *** [Makefile_Linux:34: GccUnixR/main.o] Error 1
Un1Gfn commented 5 years ago

Hi.

v2.47.1 succeeds so I've made an AUR package for it.

v2.48b v2.48a v2.48 v2.47.2 all fail on Linux.

See Tracis CI.

I tried to use UASM.vcxproj on Linux with vcproj2cmake, dotnet-vcxproj and vcxproj2cmake. Fail, fail and fail.

However I found Windows builds for v2.48.

Improve GccUnix.mak/Makefile_Linux?

john-terraspace commented 5 years ago

Hi,

There are a number of changes that are still to be migrated across to the Linux and OSX builds, it will most definitely NOT be Windows only 😊

We normally do the Windows updates first as it has far more users so it’s better for feedback and testing, right now I’m doing a 2.48.1 patch. Once that is done then I’ll migrate the necessary build changes to Linux and OSX and update them too.

From: Darren Wu notifications@github.com Sent: Saturday, February 16, 2019 2:35 PM To: Terraspace/UASM UASM@noreply.github.com Cc: Subscribed subscribed@noreply.github.com Subject: Re: [Terraspace/UASM] Linux build fails. Both GccUnix.mak and Makefile_Linux fails. (#97)

v2.48b https://github.com/Terraspace/UASM/tree/v2.48b v2.48a https://github.com/Terraspace/UASM/tree/v2.48a v2.48 https://github.com/Terraspace/UASM/tree/v2.48 v2.47.2 https://github.com/Terraspace/UASM/tree/v2.47.2 all fail on Linux

See Tracis CI https://travis-ci.org/Terraspace/UASM/branches

However there are Windows builds for v2.48 http://www.terraspace.co.uk/uasm.html#p2

I tried to use UASM.vcxproj https://github.com/Terraspace/UASM/blob/master/UASM.vcxproj on Linux with vcproj2cmake https://sourceforge.net/projects/vcproj2cmake/ , dotnet-vcxproj https://github.com/roozbehid/dotnet-vcxproj and vcxproj2cmake https://github.com/ainvyu/vcxproj2cmake . Fail, fail and fail.

Should we blame GccUnix.mak/Makefile_Linux?

Or maybe the code is not going to Windows-only?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Terraspace/UASM/issues/97#issuecomment-464351755 , or mute the thread https://github.com/notifications/unsubscribe-auth/AQGQVOXMSYcqA4fW1z5843SHGcpT4J8Oks5vOBcMgaJpZM4a_AiI .

Un1Gfn commented 5 years ago

Roger that :)

On Sun, Feb 17, 2019, 02:50 John Hankinson notifications@github.com wrote:

Hi,

There are a number of changes that are still to be migrated across to the Linux and OSX builds, it will most definitely NOT be Windows only 😊

We normally do the Windows updates first as it has far more users so it’s better for feedback and testing, right now I’m doing a 2.48.1 patch. Once that is done then I’ll migrate the necessary build changes to Linux and OSX and update them too.

From: Darren Wu notifications@github.com Sent: Saturday, February 16, 2019 2:35 PM To: Terraspace/UASM UASM@noreply.github.com Cc: Subscribed subscribed@noreply.github.com Subject: Re: [Terraspace/UASM] Linux build fails. Both GccUnix.mak and Makefile_Linux fails. (#97)

v2.48b https://github.com/Terraspace/UASM/tree/v2.48b v2.48a < https://github.com/Terraspace/UASM/tree/v2.48a> v2.48 < https://github.com/Terraspace/UASM/tree/v2.48> v2.47.2 < https://github.com/Terraspace/UASM/tree/v2.47.2> all fail on Linux

See Tracis CI https://travis-ci.org/Terraspace/UASM/branches

However there are Windows builds for v2.48 < http://www.terraspace.co.uk/uasm.html#p2>

I tried to use UASM.vcxproj < https://github.com/Terraspace/UASM/blob/master/UASM.vcxproj> on Linux with vcproj2cmake https://sourceforge.net/projects/vcproj2cmake/ , dotnet-vcxproj https://github.com/roozbehid/dotnet-vcxproj and vcxproj2cmake https://github.com/ainvyu/vcxproj2cmake . Fail, fail and fail.

Should we blame GccUnix.mak/Makefile_Linux?

Or maybe the code is not going to Windows-only?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub < https://github.com/Terraspace/UASM/issues/97#issuecomment-464351755> , or mute the thread < https://github.com/notifications/unsubscribe-auth/AQGQVOXMSYcqA4fW1z5843SHGcpT4J8Oks5vOBcMgaJpZM4a_AiI> .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Terraspace/UASM/issues/97#issuecomment-464371566, or mute the thread https://github.com/notifications/unsubscribe-auth/AbMzTNIuFeKh5RFCvF6pkfvv_kbJTyTKks5vOFLYgaJpZM4a_AiI .

azatkabcs commented 5 years ago

UASM sources from your git-repo https://github.com/Terraspace/UASM (master branch) can’t be built @ linux or freebsd (CentOS 7, FreeBSD 11 @ x86_64).

We tried gcc && GccUnix.mak, and have some errors. The same problems you have in github issues.

BTW, we tried to fix these errors, bug succeeded only in building UASM, that produces lame binaries (crashing at call to asm-functions). Patch attached. uasm.tar.gz

Hope, our patch will help you.

john-terraspace commented 5 years ago

2.49 is built for linux using GCC and Clang tested. gccmod.inc and a tweaked makefile works.

cybardev commented 3 years ago
❯ make -f gccLinux64.mak
gcc -D __UNIX__ -c -IH -D __UNIX__ -DNDEBUG -O2 -funsigned-char -Wwrite-strings -o GccUnixR/dbgcv.o dbgcv.c
In file included from dbgcv.c:13:
H/memalloc.h:49: warning: "alloca" redefined
   49 |  #define alloca(x)  __builtin_alloca(x)
      | 
In file included from /usr/include/stdlib.h:568,
                 from H/globals.h:38,
                 from dbgcv.c:12:
/usr/include/alloca.h:35: note: this is the location of the previous definition
   35 | # define alloca(size) __builtin_alloca (size)
      | 
dbgcv.c:20:10: fatal error: direct.h: No such file or directory
   20 | #include <direct.h>
      |          ^~~~~~~~~~
compilation terminated.
make: *** [gccLinux64.mak:34: GccUnixR/dbgcv.o] Error 1

This error occurs when building with gccLinux64.mak. Any suggestions on how to solve this? I tried looking online and saw direct.h is a Windows-only thing; don't know if that's an issue...

spvkgn commented 3 years ago

@cybarspace Try v2.50 branch, built successful on Ubuntu.

cybardev commented 3 years ago

@cybarspace Try v2.50 branch, built successful on Ubuntu.

Affirmative. Build successful and running. Thanks a lot. :relaxed: