dao icon indicating copy to clipboard operation
dao copied to clipboard

[Windows][MinGW 4.9.1] Cannot compile: "invalid option -- M"

Open arkdemon opened this issue 10 years ago • 19 comments

Hello! I tried compiling DAO by using this command: mingw32-make -f Makefile.daomake mingw" but it does not work. I get the following error: "invalid option -- M" (which refers to "-DMINGW" of line 149 of file dao-master\tools\daomake\bootstrap\Makefile)

I wanted to know which files I have to include to build DAO. Or is it possible to use CMake? (I may be able to generate one for Window MinGW when I have the time, but it might be in several weeks)

I really like the syntax of the script language and it also seems to have all the features I need as well as looking pretty fast ^^

PS: As I use Qt Creator as IDE, I tried including all the files in the folder kernel and compiling it. It compiles fine but I do not know how to run a script.I also found a lot of warnings in the code about unused variables, which can be removed easily.

arkdemon avatar May 03 '15 11:05 arkdemon

I guess you should try an earlier MinGW, like 4.8 or so -- it has always been buggy. MinGW 4.8.2 I have works fine with the exact same command. CMake is currently not supported, so building with daomake is basically the only option.

Night-walker avatar May 03 '15 12:05 Night-walker

Thank you :) I thought it might be the problem but I was too lazy to reinstall MinGW...

arkdemon avatar May 03 '15 13:05 arkdemon

I still get the error with MinGW 4.8.1-4 from http://sourceforge.net/projects/mingw/files/ (mingw-get-setup.exe)

arkdemon avatar May 03 '15 13:05 arkdemon

OK, can you post full make log? How does expanded command line which triggers the error look like? If you're sure it's because of "-DMINGW", you could (as a temporary workaround) try removing this switch and adding #define MINGW at the top of kernel/dao.h.

Night-walker avatar May 03 '15 19:05 Night-walker

Hi! sorry but I can't do it right now. I'll send it to you later (normally this weekend)

arkdemon avatar May 05 '15 19:05 arkdemon

Hi! I fixed the issue by 'manually' adding all the files in a CMake project. Here is a small CMakeLists project (without the demos) (it should also be portable) (I only tested it on my computer so it might be buggy/not work):

CMakeLists.txt:

cmake_minimum_required(VERSION 2.8) project(dao)

set(DAO_BUILD_TYPE "Debug" CACHE STRING "Set dao's build type: Debug, Release, ...") set(DAO_LIB_TYPE "STATIC" CACHE STRING "Set library's type: STATIC or SHARED")

option(DAO_ENABLE_CONCURRENCY "Enable concurrency" ON) option(DAO_ENABLE_NUMARRAY "Enable numarrays" ON)

SET(CMAKE_BUILD_TYPE ${DAO_BUILD_TYPE} ) SET(CMAKE_BINARY_DIR ${CMAKE_SOURCE_DIR}) SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/lib) SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/lib) SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin)

#Definitions - I don't know all of them if(DAO_ENABLE_CONCURRENCY) add_definitions(-DDAO_WITH_CONCURRENT -DDAO_WITH_THREAD) endif()

if(DAO_ENABLE_NUMARRAY) add_definitions(-DDAO_WITH_NUMARRAY) endif()

#set sources: .c and .h (.h are optional - I put them there so that they show up in qt creator) FILE( GLOB_RECURSE DAO_SOURCES "kernel/.c" "modules/.c" "kernel/.h" "modules/.h")

#create library with DAO_SOURCES as source and build type DAO_BUILD_TYPE add_library(${PROJECT_NAME} ${DAO_LIB_TYPE} ${DAO_SOURCES})

#include directories (for the dao lib) INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/kernel") INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/modules")

SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")

arkdemon avatar May 08 '15 19:05 arkdemon

Here is the log if you like: EDIT: removed logs for clarity

EDIT: I think the problem comes from SYSCFLAGS and SYSLIBS. I am going to run some tests tomorow.

arkdemon avatar May 08 '15 20:05 arkdemon

I still don't see what's the problem with mingw32-make, mine does not report invalid flag given the same command line. The variant without -DMINGW clearly fails because you don't have CC variable pointed to the name of the compiler you're using -- "set CC=gcc" should do the trick.

Night-walker avatar May 09 '15 07:05 Night-walker

Adding CC=gcc made it compile! Thank you!

But to compile the help module I get this error: /usr/bin/sh: -c: line 0: syntax error near unexpected token `en'

/usr/bin/sh: -c: line 0: `C:/Users/Me/Downloads/dao-master/bin/dao --path=\C:/Users/Me/Downloads/dao-master/modules/help/\ -e \load help; help::set_language(en); help::set_font(monospace); help::export(,./doc/html/en)'

EDIT: I made it work I don't know how. I also compiled dao-modules but regex does not work.

Btw, I also got the error: daoPlatforms-mingw.o:daoPlatforms.c:(.text+0x136): undefined reference to `_imp__timeGetTime@0' that I fixed by replacing #ifdef WIN32 to #ifded MSVC

arkdemon avatar May 09 '15 08:05 arkdemon

I also compiled dao-modules but regex does not work.

The reason of that is the incomplete makefile; I wasn't sure how to write makefile.dao in this case (the module was written by me), so I postponed the issue. If you want to use it, the instructions in README.md should help.

Night-walker avatar May 09 '15 09:05 Night-walker

Actually it was only to point it out: I don't use it. I am quite impressed by the huge number of modules though x). There seems to be just about everything and it seems easy to add custom modules for diffeent applications. (I don't know if it pretentious to say it - if so, it is not my intention): You guys did a magnificient job! The language is really fantastic and so is the 'standard 'library'!

PS: I don't know if it is the right place to ask but:

  1. in which module is std.listMeth? or an equivalent? (or is it deprecated?)
  2. What does DaoCXX do? Does it compile C++ code? or converts c++ code to the dao language? or something else?
  3. how can I compile DaoCXX?
  4. and DaoJIT?

Thank you!

arkdemon avatar May 09 '15 10:05 arkdemon

  1. in which module is std.listMeth? or an equivalent? (or is it deprecated?)

I guess there isn't one anymore... Documentation is a work in progress, so some things can only be known from the sources for the moment. Or from us adepts of arcane Dao knowledge :)

  1. What does DaoCXX do? Does it compile C++ code? or converts c++ code to the dao language? or something else?

If I remember correctly it is related to LLVM-backed JIT compilation provided by DaoJIT.

  1. how can I compile DaoCXX?

You need Clang ("set CC=clang"), then DaoCXX should be included in the build process. Haven't tried to build it for a long time though.

  1. and DaoJIT?

Should be the same as with DaoCXX.

Night-walker avatar May 09 '15 13:05 Night-walker

Thank you for your mystical advice, wise adept. It has enlightened my poor soul :p

EDIT: is it normal that 'load os' in script crashes?

arkdemon avatar May 09 '15 13:05 arkdemon

EDIT: is it normal that 'load os' in script crashes?

No, it's not (at least it works for me). Could you please put here a valgrind or gdb stack trace or any similar report?

dumblob avatar May 09 '15 14:05 dumblob

How do I create a gdb stack trace?

arkdemon avatar May 09 '15 14:05 arkdemon

Don't bother. There's a piece of code there which is running amok. Will try to sort it out.

Night-walker avatar May 09 '15 14:05 Night-walker

I have 2 logs for the same 'execution' (1 week duration) Log 1 (EDIT: I think it is more related to qt creator) : http://pastebin.com/n0ab3t52 Log 2 : http://pastebin.com/usGcXvN6 REEDIT: modified logs - they were adding up to the previous ones :3

arkdemon avatar May 09 '15 14:05 arkdemon

It's an API issue caused by the silly way things get linked on Windows. I temporarily disabled os::PipeStream; when @daokoder shows up, he'll be able to fix the API and get things back to normal.

Night-walker avatar May 09 '15 14:05 Night-walker

Ok, thank you. EDIT: How did you disable it?

arkdemon avatar May 09 '15 14:05 arkdemon