Compiling on Windows 7 has issues

57 views
Skip to first unread message

Sha

unread,
Nov 10, 2017, 10:19:45 AM11/10/17
to lemon-lang
I am on Windows 7, using tdm64-gcc-5.1.0-2 and SmartGit make.

This is what I see, when I compile Lemon:


$ make
CC ./src/main.c
./src/lemon.c: In function 'lemon_type_hash':
./src/lemon.c:447:9: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
  return (unsigned long)key;
         ^
CC ./src/lemon.c
CC ./src/hash.c
CC ./src/shell.c
CC ./src/mpool.c
CC ./src/arena.c
CC ./src/table.c
CC ./src/token.c
CC ./src/input.c
CC ./src/lexer.c
CC ./src/scope.c
CC ./src/syntax.c
CC ./src/parser.c
CC ./src/symbol.c
CC ./src/extend.c
CC ./src/compiler.c
CC ./src/peephole.c
CC ./src/generator.c
CC ./src/allocator.c
CC ./src/collector.c
CC ./src/machine.c
CC ./src/lnil.c
CC ./src/ltype.c
CC ./src/lkarg.c
CC ./src/lvarg.c
CC ./src/ltable.c
CC ./src/lvkarg.c
CC ./src/larray.c
CC ./src/lframe.c
CC ./src/lclass.c
CC ./src/lsuper.c
./src/lobject.c: In function 'lobject_default':
./src/lobject.c:948:43: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
   return linteger_create_from_long(lemon, (long)self);
                                           ^
CC ./src/lobject.c
CC ./src/lmodule.c
CC ./src/lnumber.c
CC ./src/lstring.c
CC ./src/linteger.c
CC ./src/lboolean.c
CC ./src/linstance.c
CC ./src/literator.c
CC ./src/lfunction.c
CC ./src/lsentinel.c
CC ./src/laccessor.c
CC ./src/lexception.c
CC ./src/lcoroutine.c
CC ./src/ldictionary.c
CC ./src/lcontinuation.c
CC ./lib/builtin.c
In file included from ./lib/os.c:19:0:
C:/TDM-GCC-64/x86_64-w64-mingw32/include/winsock2.h:15:2: warning: #warning Please include winsock2.h before windows.h [-Wcpp]
 #warning Please include winsock2.h before windows.h
  ^
CC ./lib/os.c
./lib/socket.c:14:0: warning: "_WIN32_WINNT" redefined
 #define _WIN32_WINNT 0x501
 ^
In file included from C:/TDM-GCC-64/x86_64-w64-mingw32/include/crtdefs.h:10:0,
                 from C:/TDM-GCC-64/x86_64-w64-mingw32/include/stddef.h:7,
                 from C:/TDM-GCC-64/lib/gcc/x86_64-w64-mingw32/5.1.0/include/stddef.h:1,
                 from ./src/lemon.h:4,
                 from ./lib/socket.c:1:
C:/TDM-GCC-64/x86_64-w64-mingw32/include/_mingw.h:225:0: note: this is the location of the previous definition
 #define _WIN32_WINNT 0x502
 ^
In file included from ./lib/socket.c:16:0:
C:/TDM-GCC-64/x86_64-w64-mingw32/include/Winsock2.h:15:2: warning: #warning Please include winsock2.h before windows.h [-Wcpp]
 #warning Please include winsock2.h before windows.h
  ^
CC ./lib/socket.c
gcc -std=c89 -pedantic -Wall -Wextra -Wno-unused-parameter -I. -I./src -DWINDOWS -O2 -flto -DNDEBUG -DMODULE_OS -DMODULE_SOCKET -shared obj/lemon.o obj/hash.o obj/shell.o obj/mpool.o obj/arena.o obj/table.o obj/token.o obj/input.o obj/lexer.o obj/scope.o obj/syntax.o obj/parser.o obj/symbol.o obj/extend.o obj/compiler.o obj/peephole.o obj/generator.o obj/allocator.o obj/collector.o obj/machine.o obj/lnil.o obj/ltype.o obj/lkarg.o obj/lvarg.o obj/ltable.o obj/lvkarg.o obj/larray.o obj/lframe.o obj/lclass.o obj/lsuper.o obj/lobject.o obj/lmodule.o obj/lnumber.o obj/lstring.o obj/linteger.o obj/lboolean.o obj/linstance.o obj/literator.o obj/lfunction.o obj/lsentinel.o obj/laccessor.o obj/lexception.o obj/lcoroutine.o obj/ldictionary.o obj/lcontinuation.o obj/builtin.o obj/os.o obj/socket.o -lm -lws2_32 -o liblemon.dll
C:\Users\sha\AppData\Local\Temp\ccAj9x2F.ltrans30.ltrans.o:<artificial>:(.text+0x1a6): undefined reference to `__imp_PathFileExistsA'
collect2.exe: error: ld returned 1 exit status
make: *** [liblemon.dll] Error 1

$

Sha

unread,
Nov 10, 2017, 10:38:04 AM11/10/17
to lemon-lang

I am aware that it is not finding the correct library (in this case shlwapi.lib) and am trying to get the appropriate SDK installed before I can proceed.

Sha

unread,
Nov 10, 2017, 10:58:51 AM11/10/17
to lemon-lang

I was able to get it to compile when I changed line 8 of the Makefile to:

      LDFLAGS += -lws2_32 -lshlwapi

No issues so far....

~ sha


On Friday, November 10, 2017 at 9:38:04 AM UTC-6, Sha wrote:

I am aware that it is not finding the correct library (in this case shlwapi.lib) and am trying to get the appropriate SDK installed before I can proceed.

On Friday, November 10, 2017 at 9:19:45 AM UTC-6, Sha wrote:
I am on Windows 7, using tdm64-gcc-5.1.0-2 and SmartGit make.

admin

unread,
Nov 11, 2017, 3:29:07 PM11/11/17
to lemon-lang

I added -lShlwapi to Makefile,It should be ok now, I forget merge Windows version's Makefile.

Sha

unread,
Nov 12, 2017, 9:07:08 PM11/12/17
to lemon-lang
The fix worked! Thanks...
Reply all
Reply to author
Forward
0 new messages