You are not logged in.

#1 2014-10-01 02:52:41

DrMag
Member
Registered: 2013-03-27
Posts: 24

Understanding make

I've done a lot of scripting/programming in my education and career, but when it comes to big projects I feel completely lost. I've done a lot of work with the MSP430, and recently saw that an official version of gcc has been released for that platform. The simplyembedded website wrote up a nice tutorial on how to build the toolchain, but it's written with the *buntu folks in mind. I've been trying to get the msp430-gcc toolchain to compile in Arch with no success. The author suggested some kind of autoconf incompatibility, but I just don't know all the ins and outs of how make works.

Can anyone offer some guidance, or point to a place that explains simply how the process of using make for a large code compilation is supposed to work? I'm hoping that might point me to what might be different between the ubuntu procedure and the Arch procedure I should be using.

For reference, here's the error that gets thrown when I try to compile the toolchain:

make[4]: Entering directory '/home/myusername/devel/sandbox/msp430-gcc/build/gas'
gcc -DHAVE_CONFIG_H -I. -I../../sources/tools/gas  -I. -I../../sources/tools/gas -I../bfd -I../../sources/tools/gas/config -I../../sources/tools/gas/../include -I../../sources/tools/gas/.. -I../../sources/tools/gas/../bfd -DLOCALEDIR="\"/home/myusername/devel/opt/msp430-toolchain/share/locale\""  -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Werror -g -O2 -MT app.o -MD -MP -MF .deps/app.Tpo -c -o app.o ../../sources/tools/gas/app.c
mv -f .deps/app.Tpo .deps/app.Po
gcc -DHAVE_CONFIG_H -I. -I../../sources/tools/gas  -I. -I../../sources/tools/gas -I../bfd -I../../sources/tools/gas/config -I../../sources/tools/gas/../include -I../../sources/tools/gas/.. -I../../sources/tools/gas/../bfd -DLOCALEDIR="\"/home/myusername/devel/opt/msp430-toolchain/share/locale\""  -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Werror -g -O2 -MT as.o -MD -MP -MF .deps/as.Tpo -c -o as.o ../../sources/tools/gas/as.c
../../sources/tools/gas/as.c: In function ‘print_version_id’:
../../sources/tools/gas/as.c:224:14: error: ‘TARGET_ALIAS’ undeclared (first use in this function)
     VERSION, TARGET_ALIAS, BFD_VERSION_STRING);
              ^
../../sources/tools/gas/as.c:224:14: note: each undeclared identifier is reported only once for each function it appears in
../../sources/tools/gas/as.c: In function ‘parse_args’:
../../sources/tools/gas/as.c:635:5: error: ‘TARGET_ALIAS’ undeclared (first use in this function)
     TARGET_ALIAS);
     ^
../../sources/tools/gas/as.c:649:44: error: ‘TARGET_CANONICAL’ undeclared (first use in this function)
    fprintf (stderr, _("canonical = %s\n"), TARGET_CANONICAL);
                                            ^
../../sources/tools/gas/as.c:650:43: error: ‘TARGET_CPU’ undeclared (first use in this function)
    fprintf (stderr, _("cpu-type = %s\n"), TARGET_CPU);
                                           ^
Makefile:894: recipe for target 'as.o' failed
make[4]: *** [as.o] Error 1
make[4]: Leaving directory '/home/myusername/devel/sandbox/msp430-gcc/build/gas'
Makefile:2182: recipe for target 'all-recursive' failed
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory '/home/myusername/devel/sandbox/msp430-gcc/build/gas'
Makefile:684: recipe for target 'all' failed
make[2]: *** [all] Error 2
make[2]: Leaving directory '/home/myusername/devel/sandbox/msp430-gcc/build/gas'
Makefile:5749: recipe for target 'all-gas' failed
make[1]: *** [all-gas] Error 2
make[1]: Leaving directory '/home/myusername/devel/sandbox/msp430-gcc/build'
Makefile:844: recipe for target 'all' failed
make: *** [all] Error 2

It's clear that somehow the --target=msp430-none-elf flag is not getting passed on to gas/as.c for some reason, which is either some bone-headed thing I'm doing wrong, or is a slight difference in the ubuntu and Arch configurations. Or maybe there's something entirely else that I just don't know enough about to speculate on.

Offline

#2 2014-10-01 03:05:20

drcouzelis
Member
From: Connecticut, USA
Registered: 2009-11-09
Posts: 4,092
Website

Re: Understanding make

Wow, your question is a lot more technical than I thought it would be. tongue

Can you post your "Makefile"? That would be a start. smile

Offline

#3 2014-10-01 03:07:20

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,345

Re: Understanding make

Have you tried to install  mspgcc-binutils and mspgcc-mspgcc from the AUR?


Edit:  Never mind.  That is not building since the site with the source is timing out.  I'll get back to you ....

Last edited by ewaller (2014-10-01 03:17:49)


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#4 2014-10-01 03:16:41

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,345

Re: Understanding make

Well, try mspgcc-gcc-bin from the AUR.  It also pulls in the binary version of binutil as a dependency.  It will give you the tool chain, but not from source.  Did you want to compile it?  (BTW, that is a valid question)


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#5 2014-10-01 03:24:51

DrMag
Member
Registered: 2013-03-27
Posts: 24

Re: Understanding make

I could just use the ones in AUR, but they're built off of older versions of the code. This is (supposedly) the latest and greatest, and I'm curious to get it working--so it's not just a matter of getting *a* version of msp430-gcc running, unfortunately. So yes, I do want to actually compile it.

I'll post a link to the Makefile (with actual usernames removed for obvious reasons), since you don't want to see 21,701 lines of code in the forum setting. smile

Makefile

Offline

#6 2014-10-01 03:31:51

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,332
Website

Re: Understanding make

Forgive me if I'm missing something obvious here - but that is not a makefile.  That is a makefile.in which is used by gnu autotools (e.g., a configure script) to create a makefile.  Are you running the configure script?

EDIT: I'm trying to replicate your issue - but I don't see anything in your post that shows where I can get the source files.  Is the page below where you got it?
http://software-dl.ti.com/msp430/msp430 … x_FDS.html

I'm currently building the source from the above link, and so far there are no errors - though it looks like on my old machine it could take a *very* long time to complete the compilation.

Last edited by Trilby (2014-10-01 03:47:21)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#7 2014-10-01 03:57:48

DrMag
Member
Registered: 2013-03-27
Posts: 24

Re: Understanding make

Well, if you're missing something obvious, then so am I. I would have assumed a makefile is the file named Makefile.

That's the right source for the code; the linked tutorial's section 1 explains which ones you need.

Not knowing what file exactly you're looking for, I'll put up a copy of the config.status file as well, since I am running a configure script:
config.status

It should fail early on, if you have the same problem I did. gas/as.c is one of the first things to be compiled.

Last edited by DrMag (2014-10-01 04:02:47)

Offline

#8 2014-10-01 03:59:32

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,332
Website

Re: Understanding make

Sorry, I was missing something obvious.  The comments on the top of that makefile mislead me - I thought it was the makefile.in not the makefile.

But still no failure here.  I'm on about 25min of compiling on an old Core2 laptop.

Last edited by Trilby (2014-10-01 04:00:18)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#9 2014-10-01 04:02:11

DrMag
Member
Registered: 2013-03-27
Posts: 24

Re: Understanding make

Well now that frustrates me. I've tried it on a couple of Arch machines I have, and even on a Raspberry Pi running archlinuxarm, and I get the same error on each. mad

Perhaps I'm missing a dependency? The tutorial has you apt-get a few files; two don't translate directly to Arch packages--libx11-dev and libncurses5-dev. I do have libx11 and ncurses installed; is there something else I'm supposed to have?

Last edited by DrMag (2014-10-01 04:04:12)

Offline

#10 2014-10-01 04:03:55

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,332
Website

Re: Understanding make

I did not specify those configure flags as suggested in the tutorial - though several of them don't make any sense as they are passing environment variables that were never defined (eg TARGET).  I just extracted the source tarball, cd'ed, then ran configure and make.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#11 2014-10-01 04:07:32

DrMag
Member
Registered: 2013-03-27
Posts: 24

Re: Understanding make

I get the same error without the configure flags.

The tutorial does define the variables, if you look at the steps it has you go through:

export PREFIX=/opt/msp430-toolchain
export TARGET=msp430-none-elf
export PATH=$PREFIX/bin:$PATH
../sources/tools/configure --target=$TARGET --prefix="$PREFIX" --program-prefix=msp430- --enable-languages=c --disable-nls
make all

Last edited by DrMag (2014-10-01 04:08:27)

Offline

#12 2014-10-01 04:12:15

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,332
Website

Re: Understanding make

Oops!  Sorry, it's very late here.  But if you get the same error without the flags, I'm clueless.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#13 2014-10-01 04:29:24

DrMag
Member
Registered: 2013-03-27
Posts: 24

Re: Understanding make

No problem; in the mean time, I've checked what's provided in the ubuntu libx11-dev and libncurses5-dev, and all those files are provided in Arch's libx11 and ncurses, except for the static .a libraries. I don't imagine that's the source of the problem, though if someone knows better feel free to chime in...

Offline

#14 2014-10-01 17:15:48

DrMag
Member
Registered: 2013-03-27
Posts: 24

Re: Understanding make

Ok, now that I've been able to get access to a ubuntu machine, I'm able to compile the code. More importantly, I took a look at the differences in the Makefiles generated by configure on each. Aside from the trivial machine-name and path differences, there are only three things I see that are substantially different:

Arch: Uses gcc 4.9.1, gawk, /bin/sh
Ubuntu: Uses gcc 4.8.2, mawk, /bin/bash

I'm thinking that perhaps either the use of gawk or sh is doing something unexpected here. Trilby, could you verify which is being used in your Makefile? (Should be in lines 306 and 346.)

Offline

#15 2014-10-01 17:34:45

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,332
Website

Re: Understanding make

I get the same as you: gcc 4.9.1, gawk, and /bin/sh

For the record I didn't complete the compiling last night - I cancelled it after about 45 minutes.  But up to that point I hadn't had any errors.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#16 2014-10-01 18:34:20

stevenhoneyman
Member
From: England
Registered: 2014-05-25
Posts: 241

Re: Understanding make

The bash patches to fix the recent vuln (026,027) broke a few of my scripts. Is your Arch PC fully updated, and the Ubuntu one (at least) a week out of date by any chance?
Although that would mean Trilby's would have broken too.

EDIT: 2 things wrong here (so far):

1. libtool + /bin/sh + this package = broken. replacing /bin/sh with /bin/bash got it started.
2. at some point a few mins into the build, it tries to link statically to libexpat. Arch has a strict "we won't provide static libs" policy.

Last edited by stevenhoneyman (2014-10-01 19:13:43)

Offline

#17 2014-10-01 19:09:31

DrMag
Member
Registered: 2013-03-27
Posts: 24

Re: Understanding make

My Arch installs are definitely up to date, so that does appear to be a possibility. The ubuntu machine is up to date as of today and compiles it, but 'up to date' on ubuntu means bash 4.3.11, whereas Arch is bash 4.3.27. Let me try to find an old version of bash to try out.

Edit: Alas, rolling back to bash 4.3.11 (snapshot on 2014/05/20) doesn't change it. I'll try rolling back other dependencies to the versions in ubuntu as well.

Last edited by DrMag (2014-10-01 19:20:53)

Offline

#18 2014-10-01 19:14:36

stevenhoneyman
Member
From: England
Registered: 2014-05-25
Posts: 241

Re: Understanding make

Oops thought I'd manage to sneak an edit in before you replied tongue guess not, but please see my post just above (again smile)

Offline

#19 2014-10-01 19:21:01

stevenhoneyman
Member
From: England
Registered: 2014-05-25
Posts: 241

Re: Understanding make

$ ls /ramdisk/msp430-toolchain/bin/
total 135M
lrwxrwxrwx 1 steven steven    4 2014-10-01 19:50 makeinfo -> true
-rwxr-xr-x 1 steven steven 3.2M 2014-10-01 20:17 msp430-addr2line*
-rwxr-xr-x 2 steven steven 3.3M 2014-10-01 20:17 msp430-ar*
-rwxr-xr-x 2 steven steven 4.4M 2014-10-01 20:17 msp430-as*
-rwxr-xr-x 1 steven steven 3.1M 2014-10-01 20:17 msp430-c++filt*
-rwxr-xr-x 1 steven steven 2.8M 2014-10-01 20:17 msp430-cpp*
-rwxr-xr-x 1 steven steven  91K 2014-10-01 20:17 msp430-elfedit*
-rwxr-xr-x 2 steven steven 2.8M 2014-10-01 20:17 msp430-gcc*
-rwxr-xr-x 1 steven steven 133K 2014-10-01 20:17 msp430-gcc-ar*
-rwxr-xr-x 1 steven steven 133K 2014-10-01 20:17 msp430-gcc-nm*
-rwxr-xr-x 1 steven steven 133K 2014-10-01 20:17 msp430-gcc-ranlib*
-rwxr-xr-x 1 steven steven 1.9M 2014-10-01 20:17 msp430-gcov*
-rwxr-xr-x 1 steven steven  30M 2014-10-01 20:17 msp430-gdb*
-rwxr-xr-x 1 steven steven 3.7M 2014-10-01 20:17 msp430-gprof*
-rwxr-xr-x 1 steven steven  29M 2014-10-01 20:17 msp430-insight*
-rwxr-xr-x 4 steven steven 4.2M 2014-10-01 20:17 msp430-ld*
-rwxr-xr-x 4 steven steven 4.2M 2014-10-01 20:17 msp430-ld.bfd*
-rwxr-xr-x 2 steven steven 3.2M 2014-10-01 20:17 msp430-nm*
-rwxr-xr-x 2 steven steven 2.8M 2014-10-01 20:17 msp430-none-elf-gcc-4.9.1*
-rwxr-xr-x 2 steven steven 4.0M 2014-10-01 20:17 msp430-objcopy*
-rwxr-xr-x 2 steven steven 4.6M 2014-10-01 20:17 msp430-objdump*
-rwxr-xr-x 2 steven steven 3.3M 2014-10-01 20:17 msp430-ranlib*
-rwxr-xr-x 1 steven steven 1.2M 2014-10-01 20:17 msp430-readelf*
-rwxr-xr-x 1 steven steven 4.5M 2014-10-01 20:17 msp430-run*
-rwxr-xr-x 1 steven steven 3.8K 2014-10-01 20:17 msp430-runtest*
-rwxr-xr-x 1 steven steven 3.2M 2014-10-01 20:17 msp430-size*
-rwxr-xr-x 1 steven steven 3.2M 2014-10-01 20:17 msp430-strings*
-rwxr-xr-x 2 steven steven 4.0M 2014-10-01 20:17 msp430-strip*
-rwxr-xr-x 1 steven steven 3.2M 2014-10-01 20:17 tclsh8.4*
-rwxr-xr-x 1 steven steven 6.6M 2014-10-01 20:17 wish8.4*

Build success after expat rebuilt (I already had static libs of most other things this needs e.g. ncurses, zlib, etc)
So yes, Arch Linux package policy is your issue. There might be a way to fiddle things around to make this use shared libs... but I don't know.

Offline

#20 2014-10-01 19:27:07

DrMag
Member
Registered: 2013-03-27
Posts: 24

Re: Understanding make

Oh, excellent! I could probably get static libs built of everything, but I think I'd like to try and see if I can change it to use shared libs. I'll start poking at some of the developers at this point. Thanks so much for your help!

Offline

Board footer

Powered by FluxBB