Author Topic: what is "bin/vc" in Linux?  (Read 2067 times)

0 Members and 1 Guest are viewing this topic.

Offline legacyTopic starter

  • Super Contributor
  • ***
  • !
  • Posts: 4415
  • Country: ch
what is "bin/vc" in Linux?
« on: December 21, 2018, 03:26:19 pm »
I am trying to recompile a compiler which is experimental so it hasn't yet documentation.
In the Makefile I find this

Code: [Select]
all: bin/vc bin/vprof bin/xcc$(TARGET) #bin/vcpp

but my rootfs doesn't have any bin/vc, and I wonder what it is ...

any clue?
 

Offline langwadt

  • Super Contributor
  • ***
  • Posts: 4425
  • Country: dk
Re: what is "bin/vc" in Linux?
« Reply #1 on: December 21, 2018, 03:40:50 pm »
I am trying to recompile a compiler which is experimental so it hasn't yet documentation.
In the Makefile I find this

Code: [Select]
all: bin/vc bin/vprof bin/xcc$(TARGET) #bin/vcpp

but my rootfs doesn't have any bin/vc, and I wonder what it is ...

any clue?

http://sun.hasenbraten.de/vbcc/ ?

 

Offline legacyTopic starter

  • Super Contributor
  • ***
  • !
  • Posts: 4415
  • Country: ch
Re: what is "bin/vc" in Linux?
« Reply #2 on: December 21, 2018, 04:03:09 pm »
no  :palm:
 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9890
  • Country: us
Re: what is "bin/vc" in Linux?
« Reply #3 on: December 21, 2018, 04:07:58 pm »
Code: [Select]
all: bin/vc bin/vprof bin/xcc$(TARGET) #bin/vcpp

The make target 'all' is supposed to create objects files vc, vprog and xcc$(TARGET) and place them in the ./bin directory.  In the end, bin/vc should exist as an executable file (I think).  I don't know if the directories need to exist before invoking make.

Somewhere in that makefille there will be instructions on how to actually make bin/vc
 

Offline legacyTopic starter

  • Super Contributor
  • ***
  • !
  • Posts: 4415
  • Country: ch
Re: what is "bin/vc" in Linux?
« Reply #4 on: December 21, 2018, 04:17:20 pm »
The make target 'all' is supposed to create objects files vc, vprog and xcc$(TARGET) and place them in the ./bin directory.  In the end, bin/vc should exist as an executable file (I think).  I don't know if the directories need to exist before invoking make.

Somewhere in that makefille there will be instructions on how to actually make bin/vc

eh, it isn't so easy: the Makefile doesn't create bin/vc because there is no instruction to create it, thus it assumes it's already existing. And I have no idea what it is.
 

Offline bsudbrink

  • Frequent Contributor
  • **
  • Posts: 406
  • Country: us
Re: what is "bin/vc" in Linux?
« Reply #5 on: December 21, 2018, 04:17:51 pm »
Regardless, do note that the reference is relative to the location of the makefile and not root as your original post implied.
 

Offline legacyTopic starter

  • Super Contributor
  • ***
  • !
  • Posts: 4415
  • Country: ch
Re: what is "bin/vc" in Linux?
« Reply #6 on: December 21, 2018, 04:48:01 pm »
Regardless, do note that the reference is relative to the location of the makefile and not root as your original post implied.

Correct, it's local, and locally there is no bin folder (I have double checked the directory structure).
I guess I have to contact the author, I am out of ideas  :-//

This compiler might also be "derived" from another project (which makes sense since I am on an experimental ISA-core), which is what it smells at this point ... (what a mess)
 

Offline Canis Dirus Leidy

  • Regular Contributor
  • *
  • Posts: 214
  • Country: ru
Re: what is "bin/vc" in Linux?
« Reply #7 on: December 21, 2018, 05:11:20 pm »
I can't be sure, but it looks like C compiler from Plan9:
Quote
Each CPU architecture supported by Plan 9 is identified by a single, arbitrary, alphanumeric character: k for SPARC, q for Motorola Power PC 630 and 640, v for MIPS, 0 for little-endian MIPS, 1 for Motorola 68000, 2 for Motorola 68020 and 68040, 5 for Acorn ARM 7500, 6 for AMD 64, 7 for DEC Alpha, 8 for Intel 386, and 9 for AMD 29000. The character labels the support tools and files for that architecture. For instance, for the 68020 the compiler is 2c, the assembler is 2a, the link editor/loader is 2l, the object files are suffixed .2, and the default name for an executable file is 2.out.
Quote
The MIPS compiler, vc, by definition produces object files for the MIPS architecture, regardless of the architecture of the machine on which the compiler is running. There is a version of vc compiled for each architecture: /mips/bin/vc, /68020/bin/vc, /sparc/bin/vc, and so on, each capable of producing MIPS object files regardless of the native instruction set. If one is running on a SPARC, /sparc/bin/vc will compile programs for the MIPS; if one is running on machine $cputype, /$cputype/bin/vc will compile programs for the MIPS.
 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9890
  • Country: us
Re: what is "bin/vc" in Linux?
« Reply #8 on: December 21, 2018, 07:53:37 pm »
To be more specific, the target 'all' depends on the existence of ./bin/vc, et al.  Usually the makefile will create those files as if they are the targets but it might just be a test to make sure they already exist and the building of the actual targets is on the next line in the Makefile.

Post more of the file.

 

Offline Nominal Animal

  • Super Contributor
  • ***
  • Posts: 6260
  • Country: fi
    • My home page and email address
Re: what is "bin/vc" in Linux?
« Reply #9 on: December 23, 2018, 11:49:32 pm »
Consider the following Makefile:
Code: [Select]
CC      := gcc
CFLAGS  := -Wall -O2
LDFLAGS := -lm

.PHONY: all proper

all: bin/vc bin/foo

proper:
rm -rf bin

bin/%: src/%.c
@mkdir -p bin
$(CC) $(CFLAGS) $^ $(LDFLAGS) -o $@
The .PHONY: all proper line is optional, and can be safely omitted. I mostly keep them because they tell the human developers which targets do not create any files.

When you run make, it creates the bin/ subdirectory if needed, and then compiles src/vc.c into a binary executable bin/vc, and src/foo.c into bin/foo.  This is because all is the default target, as it is listed first.

If you run make proper, the bin/ subdirectory is deleted.  You can run make proper all to rebuild all binaries from scratch.

If you do not use GCC, you can run say make CC=cc CFLAGS= LDFLAGS= proper all to rebuild all binaries from scratch using cc as your C compiler, without any compiler build or link options at all.
 

Offline legacyTopic starter

  • Super Contributor
  • ***
  • !
  • Posts: 4415
  • Country: ch
Re: what is "bin/vc" in Linux?
« Reply #10 on: December 24, 2018, 12:00:40 am »
I know HOW a Makefile works  :palm:

*The* point WAS that the Makefile in the project I got has no single line about creating anything called bin/vc and I have no idea what was in the head of his author, and I believed it was an external program that he wanted to put in a local bin/ folder checking for its existence.

In fact, there is no bin/vc, no rule about creating it, and it fails.

No I am rebuilding the whole project from scratch starting from its AST and parser (this part of the Makefile does no need any bin/vc), because it's really a mess, in fact, there are also a lot of problems at detecting the endianness and the data size of types ("int" is ? 16bit or 32bit? the autotest fails ) :palm:
 

Offline malagas_on_fire

  • Frequent Contributor
  • **
  • Posts: 591
  • Country: pt
  • Kernel Panic
    • Malagas Lair
Re: what is "bin/vc" in Linux?
« Reply #11 on: December 24, 2018, 12:16:47 am »
Sorry i may talk crap but the question resides on the origin of the "vc" binary if one . right?

I've found something about speech synthesis toolkit:

https://github.com/r9y9/SPTK

https://github.com/r9y9/SPTK/tree/master/bin/vc

Again it could not correspond to the same vc binary. or source code implied.

If one can make knowledge flow than it will go from negative to positve , for real
 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9890
  • Country: us
Re: what is "bin/vc" in Linux?
« Reply #12 on: December 24, 2018, 12:53:23 am »
In fact, there is no bin/vc, no rule about creating it, and it fails.

You could do md bin, cd bin and touch vc  to create an empty file.  The Makefile will be satisfied with the dependency and unless vc is actually used as a compiler in the Makefile, everything should go fine.  It's not like you're trying to create an updated version of vc.
 

Offline Nominal Animal

  • Super Contributor
  • ***
  • Posts: 6260
  • Country: fi
    • My home page and email address
Re: what is "bin/vc" in Linux?
« Reply #13 on: December 24, 2018, 02:21:22 am »
no single line about creating anything called bin/vc
My point: neither does that example Makefile. Unless you count the generic recipe. It could get created from some obscure recipe, and only in some specific situations.  I wanted to show a typical pattern to look for.

I believed it was an external program that he wanted to put in a local bin/ folder checking for its existence.
That makes absolutely no sense.  I've never seen a Makefile that does that, and I've looked at thousands of them, both open source and cobbled together by scientists.  If you look at environments where there are alternate sets of tools one might have to choose at build time, they are almost always controlled via environment variables; usually via PATH et al.

it's really a mess, in fact, there are also a lot of problems at detecting the endianness and the data size of types
Did it ever compile on any system, to your knowledge?  That would have been my first step, rather than making outrageous guesses about it being a Linux issue.

(By "outrageous", I mean as in provocative; with no logical connection to observations.  There is probably a better word for it, but me fail English.)

unless vc is actually used
I do use a roughly similar pattern when building a project requires additional compile-time tools, although I tend to use bash and/or awk for those.  In my case, I do use a variable to name it, rather than hardcode it, because the variable is easier to track in the Makefile.

The important questions are
  • Is vc or bin/vc used in the recipes?
  • Are there other makefiles (often named *.mk) included or executed in a subdirectory, that could generate vc or bin/vc ?
Sub-makefiles are usually executed using $(MAKE) -C directory -f filename , and makefile fragments included using the include directive.

Some projects do require a specific command, for example make -f linux.mk tools, to generate build-time tool symlinks and/or scripts, prior to a proper build.
 

Offline legacyTopic starter

  • Super Contributor
  • ***
  • !
  • Posts: 4415
  • Country: ch
Re: what is "bin/vc" in Linux?
« Reply #14 on: December 24, 2018, 11:30:30 am »
The author replied yesterday night and ... it's written nowhere (there is no readme/doc/whatever), but his tarball needs to be uncompressed inside a folder *on the top of another existing project*. So it was a sort of differential tarball that overrides some files  :palm: :palm: :palm:

Good news, now I now bin/vc is not a Linux program, it's something built and I also have a "new Makefile" that tells how it's built.

Quote
Makefile:bin/vc: frontend/vc.c
Makefile:       $(CC) frontend/vc.c -o bin/vc $(LDFLAGS)

In the tar.gz file I originally got ... it was "makefile" ("m" instead of "M", which reports no rule like the above) :palm: :palm: :palm:

So to compile the whole

step1: make -f Makefile ----> builds bin/vc
step2: make -f makefile ----> checks for bin/vc and builds obj/cc (the experimental core I am looking at)

Ok, now it makes sense, but it doesn't compile yet: now I have to understand and solve problems related to the endian type which are not correctly detected, and the process fails. It seems this compiler has never been compiled on a  host data types = 32bit/BigEndian, which is what you find in a machine like an Apple PowerPC.
 

Offline Nominal Animal

  • Super Contributor
  • ***
  • Posts: 6260
  • Country: fi
    • My home page and email address
Re: what is "bin/vc" in Linux?
« Reply #15 on: December 24, 2018, 12:23:18 pm »
his tarball needs to be uncompressed inside a folder *on the top of another existing project*.
Actually... I've seen that before. (Researchers who have taught themselves to program... The complete lack of documentation is also typical.  If it is not publishable in a journal, they tend to not bother.  I know of software bugs that "cannot" be fixed, because doing so would mean small but measurable changes to published results.  Which might affect their reputation.  So they're not bugs, just "features".) :palm:

step1: make -f Makefile ----> builds bin/vc
step2: make -f makefile ----> checks for bin/vc and builds obj/cc (the experimental core I am looking at)
That's just downright evil.

Thanks for letting us know, by the way: knowing about these weird/evil cases may save quite a bit of time in the future, if one has to work with a similarly, ah, "quirky", codebase.
(In reality, I mean one can recognise the signs early, and instead of eventually ripping ones eyes out in frustration, burn it with fire and restart from scratch.)
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf