Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

windows: could not build on Windows 7 #16

Closed
yageek opened this issue Jan 18, 2016 · 33 comments
Closed

windows: could not build on Windows 7 #16

yageek opened this issue Jan 18, 2016 · 33 comments

Comments

@yageek
Copy link

yageek commented Jan 18, 2016

Impossible for me to build (MVSC 2010):

Microsoft (R) C/C++ Optimizing Compiler Version 18.00.31101 for x86
Copyright (C) Microsoft Corporation.  All rights reserved.

cl : Command line warning D9024 : unrecognized source file type 'C:\Users\username\AppData\Local\Programs\Git\Fo;.obj\common_areaevents.c.o', object file assum
ed
cl : Command line warning D9024 : unrecognized source file type 'C:/', object file assumed
cl : Command line warning D9024 : unrecognized source file type 'D:/', object file assumed
cl : Command line warning D9024 : unrecognized source file type '_UI_EXTERN=__declspec(dllexport) extern', object file assumed
cl : Command line warning D9024 : unrecognized source file type 'C:/Users/username/AppData/Local/Programs/Git/W4', object file assumed
cl : Command line warning D9024 : unrecognized source file type 'C:/Users/username/AppData/Local/Programs/Git/wd4100', object file assumed
cl : Command line warning D9024 : unrecognized source file type 'C:/Users/username/AppData/Local/Programs/Git/TC', object file assumed
cl : Command line warning D9024 : unrecognized source file type 'C:/Users/username/AppData/Local/Programs/Git/bigobj', object file assumed
cl : Command line warning D9024 : unrecognized source file type 'C:/Users/username/AppData/Local/Programs/Git/nologo', object file assumed
cl : Command line warning D9024 : unrecognized source file type 'C:/Users/username/AppData/Local/Programs/Git/RTC1', object file assumed
cl : Command line warning D9024 : unrecognized source file type 'C:/Users/username/AppData/Local/Programs/Git/RTCc', object file assumed
cl : Command line warning D9024 : unrecognized source file type 'C:/Users/username/AppData/Local/Programs/Git/RTCs', object file assumed
cl : Command line warning D9024 : unrecognized source file type 'C:/Users/username/AppData/Local/Programs/Git/RTCu', object file assumed
cl : Command line warning D9024 : unrecognized source file type 'C:/Users/username/AppData/Local/Programs/Git/Zi', object file assumed
cl : Command line warning D9024 : unrecognized source file type 'C:/Users/username/AppData/Local/Programs/Git/Fd.obj/common_areaevents.c.o.pdb', object file as
sumed
areaevents.c
Microsoft (R) Incremental Linker Version 12.00.31101.0
Copyright (C) Microsoft Corporation.  All rights reserved.

/out:common_areaevents.c.exe
C:\Users\username\AppData\Local\Programs\Git\Fo;.obj\common_areaevents.c.o
C:/
areaevents.obj
D:/
"_UI_EXTERN=__declspec(dllexport) extern"
C:/Users/username/AppData/Local/Programs/Git/W4
C:/Users/username/AppData/Local/Programs/Git/wd4100
C:/Users/username/AppData/Local/Programs/Git/TC
C:/Users/username/AppData/Local/Programs/Git/bigobj
C:/Users/username/AppData/Local/Programs/Git/nologo
C:/Users/username/AppData/Local/Programs/Git/RTC1
C:/Users/username/AppData/Local/Programs/Git/RTCc
C:/Users/username/AppData/Local/Programs/Git/RTCs
C:/Users/username/AppData/Local/Programs/Git/RTCu
C:/Users/username/AppData/Local/Programs/Git/Zi
C:/Users/username/AppData/Local/Programs/Git/Fd.obj/common_areaevents.c.o.pdb
LINK : fatal error LNK1181: cannot open input file 'C:\Users\username\AppData\Local\Programs\Git\Fo;.obj\common_areaevents.c.o'
make[1]: *** [.obj/common_areaevents.c.o] Erreur 2
make: *** [libui] Erreur 2

C:\Users\username\libui-master>make > log
Microsoft (R) C/C++ Optimizing Compiler Version 18.00.31101 for x86
Copyright (C) Microsoft Corporation.  All rights reserved.

cl : Command line warning D9024 : unrecognized source file type 'C:\Users\username\AppData\Local\Programs\Git\Fo;.obj\common_areaevents.c.o', object file assum
ed
cl : Command line warning D9024 : unrecognized source file type 'C:/', object file assumed
cl : Command line warning D9024 : unrecognized source file type 'D:/', object file assumed
cl : Command line warning D9024 : unrecognized source file type '_UI_EXTERN=__declspec(dllexport) extern', object file assumed
cl : Command line warning D9024 : unrecognized source file type 'C:/Users/username/AppData/Local/Programs/Git/W4', object file assumed
cl : Command line warning D9024 : unrecognized source file type 'C:/Users/username/AppData/Local/Programs/Git/wd4100', object file assumed
cl : Command line warning D9024 : unrecognized source file type 'C:/Users/username/AppData/Local/Programs/Git/TC', object file assumed
cl : Command line warning D9024 : unrecognized source file type 'C:/Users/username/AppData/Local/Programs/Git/bigobj', object file assumed
cl : Command line warning D9024 : unrecognized source file type 'C:/Users/username/AppData/Local/Programs/Git/nologo', object file assumed
cl : Command line warning D9024 : unrecognized source file type 'C:/Users/username/AppData/Local/Programs/Git/RTC1', object file assumed
cl : Command line warning D9024 : unrecognized source file type 'C:/Users/username/AppData/Local/Programs/Git/RTCc', object file assumed
cl : Command line warning D9024 : unrecognized source file type 'C:/Users/username/AppData/Local/Programs/Git/RTCs', object file assumed
cl : Command line warning D9024 : unrecognized source file type 'C:/Users/username/AppData/Local/Programs/Git/RTCu', object file assumed
cl : Command line warning D9024 : unrecognized source file type 'C:/Users/username/AppData/Local/Programs/Git/Zi', object file assumed
cl : Command line warning D9024 : unrecognized source file type 'C:/Users/username/AppData/Local/Programs/Git/Fd.obj/common_areaevents.c.o.pdb', object file as
sumed
make[1]: *** [.obj/common_areaevents.c.o] Erreur 2
make: *** [libui] Erreur 2
@andlabs
Copy link
Owner

andlabs commented Jan 18, 2016

Huh. What version of GNU make are you using? And what shows up if you do gmake -n?

@yageek
Copy link
Author

yageek commented Jan 18, 2016

Make version:

GNU Make 3.81

make -n Output: Download

@andlabs
Copy link
Owner

andlabs commented Jan 18, 2016

What happens if you run

cl /Fo:.obj/common_areaevents.c.o /c common/areaevents.c  /D "_UI_EXTERN=__declspec(dllexport) extern" /W4 /wd4100 /TC /bigobj /nologo /RTC1 /RTCc /RTCs /RTCu /Zi /Fd.obj/common_areaevents.c.o.pdb

yourself? What about

cl /Fo:.obj\common_areaevents.c.o /c common\areaevents.c  /D "_UI_EXTERN=__declspec(dllexport) extern" /W4 /wd4100 /TC /bigobj /nologo /RTC1 /RTCc /RTCs /RTCu /Zi /Fd.obj\common_areaevents.c.o.pdb

?

@yageek
Copy link
Author

yageek commented Jan 18, 2016

It compiles without prompting an error.

@yageek yageek changed the title windows: couls not build on Windows 7 windows: could not build on Windows 7 Jan 18, 2016
@andlabs
Copy link
Owner

andlabs commented Jan 18, 2016

Hm, so something is wrong with the way make is issuing the command. Here's an idea: try compiling this program:

#include <stdio.h>

int main(int argc, char *argv[])
{
    int i;

    for (i = 0; i < argc; i++)
        printf("%s\n", argv[i]);
    return 0;
}

as, for example, maketest.exe, then change build\GNUbasemsvc.mk from

$(OBJDIR)/%.c.o: $$(subst _,/,%).c $(HFILES) | $(OBJDIR)
ifeq ($(NODEBUG),1)
        @cl /Fo:$@ /c $< $(CFLAGS)
else
        @cl /Fo:$@ /c $< $(CFLAGS) /Fd$@.pdb

to

$(OBJDIR)/%.c.o: $$(subst _,/,%).c $(HFILES) | $(OBJDIR)
ifeq ($(NODEBUG),1)
        @maketest.exe cl /Fo:$@ /c $< $(CFLAGS)
else
        @maketest.exe cl /Fo:$@ /c $< $(CFLAGS) /Fd$@.pdb

What does make say this time? I'll do the same on my system (Windows 7, MSVC 2013, GNU make 4.1) and compare the results,

@yageek
Copy link
Author

yageek commented Jan 18, 2016

I used main.exe as executable file:

/usr/bin/bash: main.exe: command not found
make[1]: *** [.obj/common_areaevents.c.o] Erreur 127
make: *** [libui] Erreur 2

@andlabs
Copy link
Owner

andlabs commented Jan 18, 2016

Try /path/to/main.exe instead. (Which environment is this, cygwin or msys? It shouldn't make a difference since this is using the MSVC compiler, but I haven't tested the effects of building with one of these, so it's good to know...)

@yageek
Copy link
Author

yageek commented Jan 18, 2016

Output replace by ./main.exe:

C:\Users\username\libui-master>make libui
C:\Users\username\libui-master\main.exe
C:\Users\username\AppData\Local\Programs\Git\Fo;.obj\common_areaevents.c.o
C:/
common/areaevents.c
D:/
_UI_EXTERN=__declspec(dllexport) extern
C:/Users/username/AppData/Local/Programs/Git/W4
C:/Users/username/AppData/Local/Programs/Git/wd4100
C:/Users/username/AppData/Local/Programs/Git/TC
C:/Users/username/AppData/Local/Programs/Git/bigobj
C:/Users/username/AppData/Local/Programs/Git/nologo
C:/Users/username/AppData/Local/Programs/Git/RTC1
C:/Users/username/AppData/Local/Programs/Git/RTCc
C:/Users/username/AppData/Local/Programs/Git/RTCs
C:/Users/username/AppData/Local/Programs/Git/RTCu
C:/Users/username/AppData/Local/Programs/Git/Zi
C:/Users/username/AppData/Local/Programs/Git/Fd.obj/common_areaevents.c.o.pdb
process_begin: CreateProcess(NULL, echo ====== Compiled common/areaevents.c, ...) failed.
make (e=2): The system cannot find the file specified.
make[1]: *** [.obj/common_areaevents.c.o] Erreur 2
make: *** [libui] Erreur 2

@andlabs
Copy link
Owner

andlabs commented Jan 18, 2016

Okay, so whatever shell you're using is for whatever reason expanding the /xxx into full pathnames (and converting : to ;, which is how pathname lists are converted on Windows), which is confusing cl. Which environment is this again, cygwin or msys?

@yageek
Copy link
Author

yageek commented Jan 18, 2016

I installed MinGW32 and make binary for windows.

I launch the make from cmd.exe.

@andlabs
Copy link
Owner

andlabs commented Jan 18, 2016

http://www.mingw.org/wiki/Posix_path_conversion this explains what's going on

I'm not sure how to override this. I'll have to find out...

@andlabs
Copy link
Owner

andlabs commented Jan 18, 2016

How did you install MinGW32? Is there a command mingw32-make? What happens if you run that instead of just plain make?

@yageek
Copy link
Author

yageek commented Jan 19, 2016

There is no difference apparently:

C:\Users\username\libui-master>mingw32-make
C:\Users\username\libui-master\main.exe
C:\Users\username\AppData\Local\Programs\Git\Fo;.obj\common_areaevents.c.o
C:/
common/areaevents.c
D:/
_UI_EXTERN=__declspec(dllexport) extern
C:/Users/username/AppData/Local/Programs/Git/W4
C:/Users/username/AppData/Local/Programs/Git/wd4100
C:/Users/username/AppData/Local/Programs/Git/TC
C:/Users/username/AppData/Local/Programs/Git/bigobj
C:/Users/username/AppData/Local/Programs/Git/nologo
C:/Users/username/AppData/Local/Programs/Git/RTC1
C:/Users/username/AppData/Local/Programs/Git/RTCc
C:/Users/username/AppData/Local/Programs/Git/RTCs
C:/Users/username/AppData/Local/Programs/Git/RTCu
C:/Users/username/AppData/Local/Programs/Git/Zi
C:/Users/username/AppData/Local/Programs/Git/Fd.obj/common_areaevents.c.o.pdb
process_begin: CreateProcess(NULL, echo ====== Compiled common/areaevents.c, ...) failed.
make (e=2): The system cannot find the file specified.
build/GNUbasemsvc.mk:64: recipe for target '.obj/common_areaevents.c.o' failed
mingw32-make[1]: *** [.obj/common_areaevents.c.o] Error 2
GNUmakefile:51: recipe for target 'libui' failed
mingw32-make: *** [libui] Error 2

@andlabs
Copy link
Owner

andlabs commented Jan 19, 2016

And could you link the MinGW package you downloaded?

@yageek
Copy link
Author

yageek commented Jan 19, 2016

I used the MinGW Synaptics like installer for Windows.

mingw32-base-20133072200
mingw32-binutils 2.25.1-1
mingw32-gcc 4.8.1-4
mingw32-libgcc 4.8.1-4
mingw32-libltdl 2.4-1
mingw32-libtool 2.4-1
mingw32-mingwrt 3.21
mingw32-w32api 3.17-2
mingw32-make 3.82.90-2-cvs-2012092
msys-bash 3.1.23-1-msys-1.0.18
msys-core 1.0.18-1-msys1.0.18
msys-coreutils 5.97-3-msys-1.0.18
msys-m4 1.4.16-2-msys-1.0.17
msys-make 3.81-3-msys-1.0.13

@andlabs
Copy link
Owner

andlabs commented Jan 19, 2016

And is this vanilla MinGW or MinGW-w64, or some other variant of MinGW?

@yageek
Copy link
Author

yageek commented Jan 19, 2016

I used the installer provided on http://www.mingw.org/ and called mingw-get-setup.exe.
I think it is the 32 bits version.

@andlabs
Copy link
Owner

andlabs commented Jan 19, 2016

Okay, thanks. I'll need to investigate options to deal with this myself. At worst I'll have to bar broken MinGW setups from being used. Maybe at some point in the future I'll switch to a proper build system...

In the meantime, you can download a GNU make source repository and build it using the MSVC compiler by running the included build_w32.bat from the VS development command line.

@andlabs
Copy link
Owner

andlabs commented Jan 19, 2016

Actually hm. cvtres doesn't seem to be necessary, and the other commands all allow using - instead of / for arguments. I'll flip the switch and ask you to try again I suppose. If that works, that'll be the fix...

andlabs added a commit that referenced this issue Jan 19, 2016
1) cvtres is no longer used directly. MSDN says to send the .res files to link.exe; that runs cvtres for us (at least it seems to, accoring to Google results for error LNK1158). It'll also avoid some of the weird warnings in cvtres, like CVT4001.

2) (and more important, but it depended on 1) Command-line switches are now passed using - instead of /. This is because some versions of MinGW are buggy and treat anything that starts with a / as a MSYS filename that needs to be converted to a Windows pathname.

Update #16.
@andlabs
Copy link
Owner

andlabs commented Jan 19, 2016

Okay, try the latest master with your MinGW-provided make and see if it builds. If it does, I'll close this issue as fixed, and no need to build a custom GNU make. :)

@yageek
Copy link
Author

yageek commented Jan 20, 2016

I tested with the last master:

C:\Users\username\libui-master>mingw32-make
areaevents.c

c1 : fatal error C1083: Cannot open source file: 'D:/': No such file or directory
_UI_EXTERN=__declspec(dllexport) extern
c1 : fatal error C1083: Cannot open source file: '_UI_EXTERN=__declspec(dllexport) extern': No such file or directory
Generating Code...
build/GNUbasemsvc.mk:78: recipe for target '.obj/common_areaevents.c.o' failed
mingw32-make[1]: *** [.obj/common_areaevents.c.o] Error 2
GNUmakefile:51: recipe for target 'libui' failed
mingw32-make: *** [libui] Error 2

It sounds better as areaevents.c succeeded to compile.

@andlabs
Copy link
Owner

andlabs commented Jan 20, 2016

Oops, missed a spot. Sorry! ^^ Try again now.

@yageek
Copy link
Author

yageek commented Jan 20, 2016

On cmd.exe I have this error each time I launched:

process_begin: [....] failed.

But on MSys terminal it succeeded to compile the dll.

I have a small error when it tries to compile the ressources files:

===== Compiled windows/ressources.rc
link: invalid option -- o

@andlabs
Copy link
Owner

andlabs commented Jan 20, 2016

Are you running cmd.exe directly instead of the Visual Studio command line environment? If so, that's your issue; you need to use the shortcuts in the Start menu to set up the environment variables correctly.

That error is in the linker; I'll have to figure out what's going on there...

@yageek
Copy link
Author

yageek commented Jan 20, 2016

Using the shortcut provided as Open Visual Studio 2012 Tools Command Prompt is the same.
I have to launch MSys.bat.

@jfcg
Copy link

jfcg commented May 16, 2016

see #17

@andlabs
Copy link
Owner

andlabs commented May 16, 2016

@jfcg how is that related?

@yageek actually reading all this again, what happens when you run link.exe? I wonder if your linker isn't the right linker...

@yageek
Copy link
Author

yageek commented May 17, 2016

I don't have access to my Windows project anymore :(

Le Monday, May 16, 2016, Pietro Gagliardi notifications@github.com a
écrit :

@jfcg https://github.com/jfcg how is that related?

@yageek https://github.com/yageek actually reading all this again, what
happens when you run link.exe? I wonder if your linker isn't the right
linker...


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#16 (comment)

@itfanr
Copy link

itfanr commented May 20, 2016

@andlabs could you push the dll to repository?It is difficult for me to build a libui.dll. Thanks.

@Overv
Copy link

Overv commented May 20, 2016

It works for me on Windows 10 with the following steps. No cygwin or msys required.

  1. Manually download GNU Make here and put its dependency DLLs libintl and libiconv into the bin directory.
  2. Add the bin directory to your path.
  3. Open the Visual Studio command prompt, navigate to the root directory of libui and run make.

@andlabs
Copy link
Owner

andlabs commented May 20, 2016

Yes, that is exactly how you are supposed to build libui for now, except I build my GNU Make from source using the included build_w32.bat script (also run from the VS command line). I might make that more clear in the README later.

@itfanr
Copy link

itfanr commented May 20, 2016

@andlabs Yes, what @Overv said is right,and it is the easier way to install make.exe.The dependency DLLs libintl and libiconv have been installed the bin directory automatically.

I have compiled the .cpp to .o ,but failed to link them with many error about c:\program files (x86)\microsoft sdks\windows\v7.1a\include\commctrl.inl.

@andlabs
Copy link
Owner

andlabs commented May 25, 2016

The issues here seem to be resolved so I am going to close this issue. Reopen it if I am wrong in doing so.

@andlabs andlabs closed this as completed May 25, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants