Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Makefiles Won't Work Correctly

This thread is locked; no one can reply to it. rss feed Print
Makefiles Won't Work Correctly
TorrentFire
Member #10,970
May 2009

I should note that I am a newbie at Programming. I've never compiled libraries OR used make before. I have looked into tutorials, but the only ones I find are how to create makefiles, not how make works how to set-up for using make (or NMAKE on windows systems.)

So, I've been trying to install some libraries to use in Microsoft Visual Studios 2005. (Specifically FBlend and ALOGG), however I keep running into different problems, and I think it's because I don't have something set up correctly.

I've tried to run make two separate ways:

1. Visual Studio 2005 Command Prompt -> NMAKE

This usually throws syntax errors for the makefiles at me. I am running the correct makefiles (Usually called makefile.vc), and I run the fix batchfiles before trying to run make. Fix always works, then when I run NMAKE I get syntax errors about the makefile.

2. Ubuntu Terminal -> Make

This gives me syntax errors as well.

I've tried fixing the syntax errors, but I really don't think there are even errors there. I've tried compiling many libraries, and they never have correct syntax? I think it's a problem on my end.

Thank you for helping in advanced, and I'm sorry; I know this topic has been hit before, but I can't seem to find anything (or haven't been looking under the correct search terms).

OICW
Member #4,069
November 2003
avatar

Maybe somebody could be of any help if you've posted examples of such errors, makefiles and specified version of your tools.

[My website][CppReference][Pixelate][Allegators worldwide][Who's online]
"Final Fantasy XIV, I feel that anything I could say will be repeating myself, so I'm just gonna express my feelings with a strangled noise from the back of my throat. Graaarghhhh..." - Yahtzee
"Uhm... this is a.cc. Did you honestly think this thread WOULDN'T be derailed and ruined?" - BAF
"You can discuss it, you can dislike it, you can disagree with it, but that's all what you can do with it"

Neil Walker
Member #210
April 2000
avatar

nmake won't work with gnu make files. I've had fblend working on visual studio so it should be ok, though I can't recall off-hand what problems I encountered. What I tend to do with projects with no ms project file (obviously assuming they aren't huge or complicated) is simply create a lib project and drop all the source files in and make them.

As for unix, I have no idea, but have you ran ./configure first?

Neil.
MAME Cabinet Blog / AXL LIBRARY (a games framework) / AXL Documentation and Tutorial

wii:0356-1384-6687-2022, kart:3308-4806-6002. XBOX:chucklepie

TorrentFire
Member #10,970
May 2009

Thanks for the speedy responses! :)

OICW: Yes, I'm sorry. I don't really know what to provide exactly. I'm kind of new at this. :(

For example: With JGMOD (The MOD audio library) I ran fixmsvc.bat, then I ran NMAKE on the file makefile.vc under jgmod\src\

This was my latest attempt. I thought that should work okay.

fix gives me the following:
Converting JGMOD files to Windows (MSVC) format...
'utod' is not recognized as an internal or external command, operable program or batch file.
'utod' is not recognized as an internal or external command, operable program or batch file.
Done!

So it didn't quite work... I don't think...?

Then, running make gives me:
makefile.vc(6) : fatal error U1000: syntax error : ')' missing in macro invocation
Stop.

I can try a different one if you'd like? (I'm more concerned about fblend)

EDIT: Also, I forgot, the only tools I have are Microsoft Visual Studio 2005. Do I need anything else? I thought that the MSVC Command Prompt ran using the MSVC Compiler?

Neil Walker:
I will try to drag-and-drop them into MSVC and see if I have any trouble. And with Unix, I will try that again and make sure that I did run ./configure first, I don't really remember :(

(I have been looking into makefiles for a while since I last tried working with fblend, before breaking down and coming here for support)

OICW
Member #4,069
November 2003
avatar

Most importantly, have you read installation instructions for those libraries? Anyway running GNU make on msvc makefile (or any other specific makefile) is going to fail.

[My website][CppReference][Pixelate][Allegators worldwide][Who's online]
"Final Fantasy XIV, I feel that anything I could say will be repeating myself, so I'm just gonna express my feelings with a strangled noise from the back of my throat. Graaarghhhh..." - Yahtzee
"Uhm... this is a.cc. Did you honestly think this thread WOULDN'T be derailed and ruined?" - BAF
"You can discuss it, you can dislike it, you can disagree with it, but that's all what you can do with it"

TorrentFire
Member #10,970
May 2009

Alright, I went back through to install fblend.

Here are the steps I took:

1. The instructions say that I need GCC, with make and Binutils (of specific versions - even for Windows), so I downloaded MinGW, MSYS, and all of the required updates.

2. I run fix msvc as stated in the readme. It completes without any errors.

3. Here's where I run into problems. It tells me to run 'make' and then 'make install'. I'm a little confused, so I tried a few things:

- Under MSYS, I run make (because MSVC2005 Command Prompt doesn't run make). It fails, saying that:
del mmxtest.s
make: del: Command not found
make: [include/mmx.h] Error 127 (ignored)
move mmx.h include
make: move: Command not found
make: [include/mmx.h] Error 127 (ignored)
Testing for SSE assembler support...
/bin/sh: -c: line 0: syntax error near unexpected token `('
/bin/sh: -c: line 0: `echo prefetcht0 (%esi) >> ssetest.s'

del ssetest.s
make: del: Command not found
make: [include/sse.h] Error 127 (ignored)
move sse.h include
make: move: Command not found
make: [include/sse.h] Error 127 (ignored)
cl -c src/cadd.c @_tmp.arg -ML -W3 -Ogityb2 -Gs -G4 -nologo
make: cl: Command not found
make: *** [obj/msvc/release/cadd.obj] Error 127

The next thing I try is nmake under MSVC2005 Command Prompt...

It gives me the following error:

fatal error U1052: file '+= .src include' not found
Stop.

Am I doing this very wrong? Because I get the impression that I am...

OICW
Member #4,069
November 2003
avatar

Allright, first of all try using mockup code, especially the <terminal></terminal> tags - it will be much easier to read outputs from console.

Judging by what you write, it looks like you're using some console in your IDE. If you've really installed gcc (mingw32 on Windows) and binutils (GNU make and others), then they should be accessible via standard command line in Windows - assuming that you've configured your $PATH. Moreso if I rememeber correctly mingw32 comes even with port of GNU make, "mingw-make" or something like that.

So installing fblend or anything else - Allegro for instance is simple as this. You run cmd and type in:

cd C:\Allegro
fix mingw32
make
make install

Or under linux:

cd /tmp/allegro
./configure
make
sudo make install

[My website][CppReference][Pixelate][Allegators worldwide][Who's online]
"Final Fantasy XIV, I feel that anything I could say will be repeating myself, so I'm just gonna express my feelings with a strangled noise from the back of my throat. Graaarghhhh..." - Yahtzee
"Uhm... this is a.cc. Did you honestly think this thread WOULDN'T be derailed and ruined?" - BAF
"You can discuss it, you can dislike it, you can disagree with it, but that's all what you can do with it"

bamccaig
Member #7,536
July 2006
avatar

'utod' is not recognized as an internal or external command, operable program or batch file.

Essentially, the script is trying to run a program named `utod', but that program isn't found in your execution PATH. A good script would want to exit if something required failed, but that one seems to keep going... Windows' default shell isn't very powerful though so writing rich shell scripts is a pain. Anyway... To fix that, you will need to figure out what `utod' is and get its directory into your PATH environment variable (it's good to know what this does before allowing a script to do it, of course).

- Under MSYS, I run make (because MSVC2005 Command Prompt doesn't run make). It fails, saying that:
del mmxtest.s
make: del: Command not found
make: [include/mmx.h] Error 127 (ignored)
move mmx.h include
make: move: Command not found
make: [include/mmx.h] Error 127 (ignored)
Testing for SSE assembler support...
/bin/sh: -c: line 0: syntax error near unexpected token `('
/bin/sh: -c: line 0: `echo prefetcht0 (%esi) >> ssetest.s'

The fact that it's trying to run `del' and `move' suggests to me that it expects the Windows command prompt, whereas you seem to be running from the MSYS shell.

Firstly, make sure the MinGW/MSYS bin directories are in your PATH environment variable in Windows. You can edit an environment variable permanently from...

  1. Open the Start menu.

  2. Right-click "My Computer" or "Computer", depending on which version of Windows.

  3. Click "Properties".

  4. In Vista or Windows 7 only, click "Advanced system settings" on the left.

  5. Make sure you're on the "Advanced" tab of the "System Properties" dialog.

  6. Click the "Environment variables..." button near the bottom of that tab.

Or, you can temporarily change an environment variable with the set command, but that only applies to the current command prompt window.

Once those directories are in your PATH, you should be able to open a new[1] command prompt window and execute `gcc --help' successfully. Then you can try running `make' from there (it might be `mingw32-make', depending on installation; I've seen both).

References

  1. This only applies to the dialog approach. Using the `set' command would dictate that you need to use the same command prompt window. ;)
Audric
Member #907
January 2001

About your installation of MSYS and Mingw, be sure to have them installed in directories with no spaces in them. If you have something like "C:\Program files\MSYS", many makefiles will fail when they try to copy a compiled library or headers to their directories.

TorrentFire
Member #10,970
May 2009

OICW:

Sorry about not using <terminal>, I will from now on.

I checked my MinGW/bin/ directory and it's there, but like you said it was called mingw32-make.exe :o Oops, sorry. That must be why simply typing "make" isn't working.

I renamed it make for easier access, thanks for the note about that.

I retried everything.

C:\fblend>fix mingw32

Configuring FBlend for Mingw32...
Done! Now run make to start the compilation.

C:\fblend>make
Testing for MMX assembler support...
move mmx.h include
process_begin: CreateProcess(NULL, move mmx.h include, ...) failed.
make (e=2): The system cannot find the file specified.
make: [include/mmx.h] Error 2 (ignored)
del mmxtest.s
Testing for SSE assembler support...
move sse.h include
process_begin: CreateProcess(NULL, move sse.h include, ...) failed.
make (e=2): The system cannot find the file specified.
make: [include/sse.h] Error 2 (ignored)
del ssetest.s
gcc -c src/cadd.c -o obj/mingw32/release/cadd.obj -W -Wall -O2 -ffast-math -fomi
t-frame-pointer -mpentium -Iinclude
`-mpentium' is deprecated. Use `-march=pentium' or `-mtune=pentium' instead.
src/cadd.c:18:21: allegro.h: No such file or directory
In file included from src/cadd.c:19:
include/fblend.h:14:21: allegro.h: No such file or directory
In file included from src/cadd.c:19:
include/fblend.h:40: error: syntax error before '*' token
include/fblend.h:41: error: syntax error before '*' token
include/fblend.h:50: error: syntax error before '*' token
include/fblend.h:51: error: syntax error before '*' token
include/fblend.h:60: error: syntax error before '*' token
src/cadd.c:20:17: mmx.h: No such file or directory
src/cadd.c:21:17: sse.h: No such file or directory
src/cadd.c:24: error: syntax error before '*' token
src/cadd.c:25: error: syntax error before '*' token
src/cadd.c:26: error: syntax error before '*' token
src/cadd.c:70: error: syntax error before '*' token
src/cadd.c: In function `fblend_add':
src/cadd.c:79: error: `x' undeclared (first use in this function)
src/cadd.c:79: error: (Each undeclared identifier is reported only once
src/cadd.c:79: error: for each function it appears in.)
src/cadd.c:79: error: `y' undeclared (first use in this function)
src/cadd.c:82: error: `src' undeclared (first use in this function)
src/cadd.c:96: error: `dst' undeclared (first use in this function)
src/cadd.c:105: warning: implicit declaration of function `bitmap_color_depth'
src/cadd.c:116: error: `fact' undeclared (first use in this function)
src/cadd.c:122: warning: implicit declaration of function `acquire_bitmap'
src/cadd.c:180: warning: implicit declaration of function `bmp_unwrite_line'
src/cadd.c:181: warning: implicit declaration of function `release_bitmap'
src/cadd.c: At top level:
src/cadd.c:189: error: syntax error before '*' token
src/cadd.c: In function `fblend_add_16':
src/cadd.c:191: error: `fact' undeclared (first use in this function)
src/cadd.c:194: error: `h' undeclared (first use in this function)
src/cadd.c:202: warning: implicit declaration of function `bmp_select'
src/cadd.c:202: error: `dst' undeclared (first use in this function)
src/cadd.c:203: error: `src' undeclared (first use in this function)
src/cadd.c:203: error: `src_y' undeclared (first use in this function)
src/cadd.c:203: error: `src_x' undeclared (first use in this function)
src/cadd.c:204: warning: implicit declaration of function `bmp_write_line'
src/cadd.c:204: error: `dst_y' undeclared (first use in this function)
src/cadd.c:204: error: `dst_x' undeclared (first use in this function)
src/cadd.c:206: error: `w' undeclared (first use in this function)
src/cadd.c:210: error: `MASK_COLOR_16' undeclared (first use in this function)
src/cadd.c:234: warning: implicit declaration of function `bmp_write16'
src/cadd.c: At top level:
src/cadd.c:296: error: syntax error before '*' token
src/cadd.c: In function `fblend_add_15':
src/cadd.c:298: error: `fact' undeclared (first use in this function)
src/cadd.c:302: error: `h' undeclared (first use in this function)
src/cadd.c:310: error: `dst' undeclared (first use in this function)
src/cadd.c:311: error: `src' undeclared (first use in this function)
src/cadd.c:311: error: `src_y' undeclared (first use in this function)
src/cadd.c:311: error: `src_x' undeclared (first use in this function)
src/cadd.c:312: error: `dst_y' undeclared (first use in this function)
src/cadd.c:312: error: `dst_x' undeclared (first use in this function)
src/cadd.c:314: error: `w' undeclared (first use in this function)
src/cadd.c:318: error: `MASK_COLOR_15' undeclared (first use in this function)
src/cadd.c: At top level:
src/cadd.c:404: error: syntax error before '*' token
src/cadd.c: In function `fblend_add_32':
src/cadd.c:406: error: `fact' undeclared (first use in this function)
src/cadd.c:409: error: `h' undeclared (first use in this function)
src/cadd.c:417: error: `dst' undeclared (first use in this function)
src/cadd.c:418: error: `src' undeclared (first use in this function)
src/cadd.c:418: error: `src_y' undeclared (first use in this function)
src/cadd.c:418: error: `src_x' undeclared (first use in this function)
src/cadd.c:419: error: `dst_y' undeclared (first use in this function)
src/cadd.c:419: error: `dst_x' undeclared (first use in this function)
src/cadd.c:421: error: `w' undeclared (first use in this function)
src/cadd.c:425: error: `MASK_COLOR_32' undeclared (first use in this function)
src/cadd.c:447: warning: implicit declaration of function `bmp_write32'
make: *** [obj/mingw32/release/cadd.obj] Error 1

Here are the versions of GCC and make I'm running:

GCC --version = 3.4.5 (mingw-vista r3)
make --version = 3.81

Also, one more question for you... I will be compiling the software I use under MSVC compiler, so do I still need to run "fix mingw32" or should I be running "fix msvc". I've tried both ways, after fixing to msvc, I still get some errors. In case you need them, here they are:

C:\fblend>fix msvc

Configuring FBlend for MSVC...
Done! Now run make to start the compilation.

C:\fblend>make
Testing for MMX assembler support...
del mmxtest.s
move mmx.h include
process_begin: CreateProcess(NULL, move mmx.h include, ...) failed.
make (e=2): The system cannot find the file specified.
make: [include/mmx.h] Error 2 (ignored)
Testing for SSE assembler support...
del ssetest.s
move sse.h include
process_begin: CreateProcess(NULL, move sse.h include, ...) failed.
make (e=2): The system cannot find the file specified.
make: [include/sse.h] Error 2 (ignored)
cl -c src/cadd.c @_tmp.arg -ML -W3 -Ogityb2 -Gs -G4 -nologo
cl : Command line warning D9035 : option 'Og' has been deprecated and will be re
moved in a future release
cl : Command line warning D9002 : ignoring unknown option '-ML'
cl : Command line warning D9002 : ignoring unknown option '-G4'
cadd.c
src/cadd.c(20) : fatal error C1083: Cannot open include file: 'mmx.h': No such f
ile or directory
make: *** [obj/msvc/release/cadd.obj] Error 2

Thanks for the help so far, I feel like I'm getting somewhere.

bamccaig:

You are correct, I was running MSYS at the time. I thought I had to. But apparently I don't. I had the PATH environment variable set, but I did not know that make was called mingw32-make as you said. Thanks for the info. :)

Audric:

Yes, in the tutorial on the main MinGW website, it states that it's best to not change the install paths, so I left them as is. They installed to C:\mingw and C:\msys respectively.

bamccaig
Member #7,536
July 2006
avatar

You are correct, I was running MSYS at the time. I thought I had to.

Honestly, it depends on the project and how they wrote their build system. I never know exactly how I'm supposed to be running it... In Windows, I start on the command prompt. If that doesn't seem to be happy, I try from a UNIX-like shell, such as MSYS or Cygwin. Sometimes one way works and the other doesn't. Sometimes all ways work. If they don't work, I curse Windows and return to my beloved Linux. ;D

TorrentFire
Member #10,970
May 2009

Yeah, I'm thinking about working under Ubuntu. I'm just so used to the MSVC2005 setup, it's very user-friendly.

Anything you can recommend to use under Ubuntu? I've heard Code::Block (or something like that) was good?

bamccaig
Member #7,536
July 2006
avatar

Personally, in Linux, I just work on the command line. :P Vim + GCC is all you strictly need. :D Vim might seem a little scary or inefficient to beginners, but once you start to learn the kinds of commands it supports you can get things done much more reliably and much faster (this is still a process I'm learning, but I've learned to love it anyway). There are some tutorials that can walk you through some editing tasks and how easily Vi/Vim can do them. I find I work faster without the overhead of an IDE.

In any case, there are a few IDEs available. Eclipse is well liked by many, but I'm not really a fan (after using Visual Studio so regularly it just feels clunky to me). Code::Blocks is available as well and you can probably configure NetBeans for C/C++ (I've never done it, but I've heard it can be done...).

OICW
Member #4,069
November 2003
avatar

TorrentFire: judging by your errors it looks like you're missing allegro installation. Read install instructions supplied for FBlend and install prerequisities first. Anyway this is why I don't like Windows, installing anything from the sources is pain in the arse.

As for Linux development if you insist on using IDE I reccomend Code::Blocks. For smaller things Vim + gcc is all you need, though I prefer Kate - I still think that I can get things done faster than thinking half an hour about regular expression that would solve it. But I agree that once you get Vim in your hands you rule.

[My website][CppReference][Pixelate][Allegators worldwide][Who's online]
"Final Fantasy XIV, I feel that anything I could say will be repeating myself, so I'm just gonna express my feelings with a strangled noise from the back of my throat. Graaarghhhh..." - Yahtzee
"Uhm... this is a.cc. Did you honestly think this thread WOULDN'T be derailed and ruined?" - BAF
"You can discuss it, you can dislike it, you can disagree with it, but that's all what you can do with it"

TorrentFire
Member #10,970
May 2009

Well, I appreciate all of the help. I'll look into Vim and Kate and probably move all my source to my Ubuntu partition, maybe I'll actually get stuff done.

I've just recently started playing around with Linux so hopefully everything goes smoothly. :p

Thanks again for all the help everyone! :)

Evert
Member #794
November 2000
avatar

I'll look into Vim and Kate and probably move all my source to my Ubuntu partition, maybe I'll actually get stuff done.

I've just recently started playing around with Linux so hopefully everything goes smoothly.

Beware vim's very steep learning curve. It's different from anything you've used before and if you decide that you want to use it, it will take you time to get used to it. It is not newbie friendly. Just a word of caution.

Thomas Fjellstrom
Member #476
June 2000
avatar

Kate and Nano are my favorite editors.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

BAF
Member #2,981
December 2002
avatar

If you like MSVC, just use it. I'm sure you can find binaries for the libraries you install instead of wasting your life trying to compile the crap.

Go to: