English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Asm / Hardware

 
 
Thread Tools
Old 29 September 2018, 21:18   #1
guy lateur
Registered User
 
guy lateur's Avatar
 
Join Date: May 2017
Location: Belgium
Age: 50
Posts: 334
Building VASM on Windows

Edit: Solution:
In order to build vasm in any combination of cpu and syntax module, you'll need 3 things: a C/C++ compiler, a linker and a make utility. If you setup your Visual Studio environment correctly, you'll find all 3 of them there.

You can use the (free) Community Edition of Visual Studio (VS). The latest version at the time of writing is 2017. You may need to make a Microsoft account to keep using VS after the trial period has expired. Don't worry; it's free for personal use.

You'll need to make sure you have installed support for 'Desktop development with C++' in VS. You can do this by going to 'Get Tools and Features' in the VS Tools menu, and selecting the aforementioned feature for installation. IIRC, the default installation of VS2017 does not have this turned on. If you do not have this feature installed, you won't find the compiler and the linker in the VS installation directory (not sure about the make utility). If you do have this feature installed, then you'll find cl.exe (compiler), link.exe (linker) and nmake.exe (make utility) there.

By default, these executables will reside in a quite deeply nested directory, and they won't be in your Windows path, so the system will not find them. You could add these directories to your path system environment variable, or use the included 'x64 Native Tools Command Prompt for VS2017' to build vasm. I personally prefer the latter approach, because it's the easiest method, and because it probably has some more useful features then just setting the paths to the tools mentioned above.

Finally, you'll need to compile each combination of cpu & syntax module separately. You can specify them on the command line. Below is an example for building vasm for m68k cpu's with the madmac syntax.

You can read more about building vasm here:
http://sun.hasenbraten.de/vasm/index.php?view=compile
http://sun.hasenbraten.de/vasm/relea...html#Interface

TLDR: Summary:
1. Install Visual Studio
2. Install support for 'Desktop development with C++' in VS
3. Start the 'x64 Native Tools Command Prompt for VS2017'
4. cd to the vasm source root directory
5. (if you haven't already) md obj_win32
6. nmake /f makefile.win32 CPU=m68k SYNTAX=madmac
Done!
You'll find vasmm68k_madmac_win32.exe (*) in the vasm source root directory.
Special thanks to Leffmann for helping me figure this out.

(*) Although this executable has a _win32 suffix in its name, it really is a 64-bit executable if you used the 'x64 Native Tools Command Prompt for VS2017' to generate it. If you use the 'x86 Native Tools Command Prompt for VS2017', it will produce a 32-bit executable. You'll need to empty the obj_win32 folder before you try to build a different-bit-version of the executable, as the object files will have to be rebuilt with the same n-bit-ness.

-----------------------------------------------------------------------------
Original post:
I'm using 64-bit Windows 10 and Visual Studio 2017 Community Edition. I'm trying to build the latest vasm source archive (http://sun.hasenbraten.de/vasm/index.php?view=relsrc). Leffmann has a binary release of vbcc available (http://eab.abime.net/showthread.php?t=83113). Understandably, this does not come with all combinations of syntax and target vasm executables, so I've been trying to compile those myself. Eg, I'm trying to compile vasmm68k_madmac.exe, for reasons explained here: http://eab.abime.net/showthread.php?...45#post1272745

Coming with VS2017 is the C compiler (cl.exe) and the linker (link.exe), which is exactly how they are referenced in the Makefile.Win32 file in the vasm source. I take that to be a good sign. VS also comes with a cmake.exe, but I don't think that's your regular make -- for one, I can't seem to find the option to specify a makefile. So I'm using make.exe, as supplied by the windows binary release of vasm by Leffmann, see link above.

So I start the VS x64 native shell, cd to the vasm source directory, and type
Code:
make -f Makefile.Win32
Unfortunately this doesn't seem to do very much, and almost immediately bails out with this message:
Code:
make: *** No rule to make target 'cpus//cpu.h', needed by 'obj_win32/__vasm.o'.  Stop.
Does anyone have any idea what the problem might be, and what I can do to solve it? TIA!

Last edited by guy lateur; 30 September 2018 at 17:04. Reason: Added solution + 32/64-bit remark
guy lateur is offline  
Old 29 September 2018, 21:33   #2
mcgeezer
Registered User
 
Join Date: Oct 2017
Location: Sunderland, England
Posts: 2,702
I have the latest vasm built with m68k support if u want it.
mcgeezer is offline  
Old 29 September 2018, 21:53   #3
guy lateur
Registered User
 
guy lateur's Avatar
 
Join Date: May 2017
Location: Belgium
Age: 50
Posts: 334
Quote:
Originally Posted by mcgeezer View Post
I have the latest vasm built with m68k support if u want it.
Yes please, I'll send you a PM.
guy lateur is offline  
Old 29 September 2018, 22:10   #4
jotd
This cat is no more
 
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,161
the message means that "cpus//cpu.h" doesn't exist. Or there's no rule to generate it (if it's a generated code)

Anyway building such complex programs on Windows is just hell. Even when you know what you're doing.
jotd is offline  
Old 29 September 2018, 22:24   #5
guy lateur
Registered User
 
guy lateur's Avatar
 
Join Date: May 2017
Location: Belgium
Age: 50
Posts: 334
Quote:
Originally Posted by jotd View Post
the message means that "cpus//cpu.h" doesn't exist. Or there's no rule to generate it (if it's a generated code)

Anyway building such complex programs on Windows is just hell. Even when you know what you're doing.
cpus//cpu.h does not exist. cpus\m68k\cpu.h does, though, and so does cpus\6502\cpu.h, and some more cpu.h files are at similar locations. I'm not sure what the deal with the / instead of \ is; I guess it's a unix/not-windows thing? And I definitely don't know why there's 2 of them (//), unless the 368k/6502/target between them got forgotten, somehow..

And no, I have as good as no idea what I'm doing, here, so good luck to me!
guy lateur is offline  
Old 29 September 2018, 22:48   #6
jotd
This cat is no more
 
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,161
cpus//cpu.h is the same as cpus\cpu.h (POSIX paths are accepted on windows). But the file isn't here. Note that there are at least 2 different flavours of "make" command on windows: MinGW and native. The stuff is generally half-ported to windows with crap like cygwin and all... or it relies on MSVC compiler and the infamous "vcvarsall.bat". Oh my!
jotd is offline  
Old 29 September 2018, 23:50   #7
guy lateur
Registered User
 
guy lateur's Avatar
 
Join Date: May 2017
Location: Belgium
Age: 50
Posts: 334
Quote:
Originally Posted by jotd View Post
or it relies on MSVC compiler and the infamous "vcvarsall.bat". Oh my!
Yep, that's what we're dealing with, here.
Hey, somebody told me earlier this should compile right out of the box, so..
guy lateur is offline  
Old 30 September 2018, 02:13   #8
alkis
Registered User
 
Join Date: Dec 2010
Location: Athens/Greece
Age: 53
Posts: 719
If you setup a linux vm then this compiles it:

make CPU=m68k SYNTAX=madmac CC=x86_64-w64-mingw32-gcc CFLAGS="-Os" LDFLAGS="-s -static" TARGETEXTENSION=.exe
alkis is offline  
Old 30 September 2018, 12:28   #9
Leffmann
 
Join Date: Jul 2008
Location: Sweden
Posts: 2,269
If you want to build vasm quickly, open the VS native shell and run:
Code:
cd vasm
md obj_win32
nmake /f makefile.win32 CPU=m68k SYNTAX=madmac
Leffmann is offline  
Old 30 September 2018, 13:08   #10
jotd
This cat is no more
 
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,161
nmake! another flavour of the "make" command. That one is pure native. No missing with MinGW stuff. thanks
jotd is offline  
Old 30 September 2018, 14:50   #11
guy lateur
Registered User
 
guy lateur's Avatar
 
Join Date: May 2017
Location: Belgium
Age: 50
Posts: 334
Thank you all for the help, much appreciated! I clearly needed to specify the target cpu and the syntax module. For some reason, I was expecting it to build every combination automatically. I'll adjust my first post with the solution shortly.

I do get a warning when compiling vasmm68k_madmac_win32.exe (using Leffmann's commands):
Code:
parse.c(1158): warning C4477: 'printf' : format string '%lu' requires an argument of type 'unsigned long', but variadic argument 1 has type 'size_t'
parse.c(1158): note: consider using '%zu' in the format string
But it does produce the .exe, so I'm guessing I can safely ignore this.

Also, the above mentioned procedure generates win32 executables. If somebody knows how to produce x64 binaries, I'll be happy to hear about it.
guy lateur is offline  
Old 30 September 2018, 14:58   #12
phx
Natteravn
 
phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,496
Quote:
Originally Posted by guy lateur View Post
Code:
make: *** No rule to make target 'cpus//cpu.h', needed by 'obj_win32/__vasm.o'.  Stop.
Does anyone have any idea what the problem might be, and what I can do to solve it? TIA!
A little bit of RTFM may help.
There is a chapter "Building vasm" in the documentation and there is also a short instruction on the home page here:
http://sun.hasenbraten.de/vasm/index.php?view=compile

In any case, as others already pointed out, you need to set the CPU and the SYNTAX variables for the make-process.

Quote:
Originally Posted by jotd View Post
Anyway building such complex programs on Windows is just hell. Even when you know what you're doing.
Working on Windows might be hell, but vasm is really just a simple, portable ANSI-C source, without any dependencies.
phx is offline  
Old 30 September 2018, 15:12   #13
guy lateur
Registered User
 
guy lateur's Avatar
 
Join Date: May 2017
Location: Belgium
Age: 50
Posts: 334
Quote:
Originally Posted by phx View Post
A little bit of RTFM may help.
There is a chapter "Building vasm" in the documentation and there is also a short instruction on the home page here:
http://sun.hasenbraten.de/vasm/index.php?view=compile

In any case, as others already pointed out, you need to set the CPU and the SYNTAX variables for the make-process.
I actually did read that, but I went through so many other docs (visual studio setup, even linux distro vm/setup), that by the time I was nearing anything resembling a make, I'd already completely forgotten about it. But you're right, I should have known I needed to specify cpu & syntax.

Any thoughts on the aforementioned warning? And/or on the 64-bit binaries?
guy lateur is offline  
Old 30 September 2018, 15:36   #14
Leffmann
 
Join Date: Jul 2008
Location: Sweden
Posts: 2,269
There's no benefit in running 64-bit versions of the tools, but you can build them using the VS 64-bit native shell.

The printf format warning is safe to ignore.
Leffmann is offline  
Old 30 September 2018, 16:00   #15
guy lateur
Registered User
 
guy lateur's Avatar
 
Join Date: May 2017
Location: Belgium
Age: 50
Posts: 334
Quote:
Originally Posted by Leffmann View Post
There's no benefit in running 64-bit versions of the tools, but you can build them using the VS 64-bit native shell.
I am using the x64 native shell, but I still get 32-bit binaries. Do I need to specify another target, like _win64 or _x64? Or maybe make/use another makefile? The vasm source doesn't seem to come with a Makefile.win64.

Quote:
Originally Posted by Leffmann View Post
The printf format warning is safe to ignore.
Ok, thanks!
guy lateur is offline  
Old 30 September 2018, 16:26   #16
guy lateur
Registered User
 
guy lateur's Avatar
 
Join Date: May 2017
Location: Belgium
Age: 50
Posts: 334
Edited first post to add solution.
guy lateur is offline  
Old 30 September 2018, 16:57   #17
guy lateur
Registered User
 
guy lateur's Avatar
 
Join Date: May 2017
Location: Belgium
Age: 50
Posts: 334
Quote:
Originally Posted by guy lateur View Post
I am using the x64 native shell, but I still get 32-bit binaries. Do I need to specify another target, like _win64 or _x64? Or maybe make/use another makefile? The vasm source doesn't seem to come with a Makefile.win64.
Never mind that, what Leffmann said about the different shells producing 32- vs 64-bit executables is correct. It just still has the win32 suffix in the name, but it is indeed a 64-bit executable.
guy lateur is offline  
Old 03 June 2021, 12:36   #18
phx
Natteravn
 
phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,496
vasm can be compiled with any 32-bit or 64-bit C99-compliant compiler. It's up to you which one to select.

Additionally we automatically generate 64-Bit Windows executables with every new release (since V1.8j). You find the zip-Archives for the most common backends here: http://sun.hasenbraten.de/vasm/index.php?view=binrel
phx is offline  
Old 03 June 2021, 13:11   #19
guy lateur
Registered User
 
guy lateur's Avatar
 
Join Date: May 2017
Location: Belgium
Age: 50
Posts: 334
Quote:
Originally Posted by phx View Post
Additionally we automatically generate 64-Bit Windows executables with every new release (since V1.8j). You find the zip-Archives for the most common backends here: http://sun.hasenbraten.de/vasm/index.php?view=binrel
Great! Thanks for your continued work on this!
guy lateur is offline  
Old 03 June 2021, 13:34   #20
roondar
Registered User
 
Join Date: Jul 2015
Location: The Netherlands
Posts: 3,408
Quote:
Originally Posted by phx View Post
vasm can be compiled with any 32-bit or 64-bit C99-compliant compiler. It's up to you which one to select.

Additionally we automatically generate 64-Bit Windows executables with every new release (since V1.8j). You find the zip-Archives for the most common backends here: http://sun.hasenbraten.de/vasm/index.php?view=binrel
That's great news, thanks for adding this
roondar is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Trying out vlink and vasm cla Coders. General 2 30 September 2016 20:30
vasm and comments xxxxx Coders. Asm / Hardware 10 03 February 2015 12:59
vasm question marduk_kurios Coders. Asm / Hardware 7 14 February 2014 20:06
vasm fsincos dalton Coders. Asm / Hardware 4 03 September 2012 10:35
vasm 1.5 RFC phx Coders. General 30 11 December 2010 02:08

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 19:48.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.12506 seconds with 15 queries