Bug 214776 - devel/arduino16: ARCH override causes lang/go to fail
Summary: devel/arduino16: ARCH override causes lang/go to fail
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Boris Samorodov
Depends on: 214778
  Show dependency treegraph
Reported: 2016-11-23 09:38 UTC by Melvyn Sopacua
Modified: 2016-12-10 20:23 UTC (History)
4 users (show)

See Also:
bsam: maintainer-feedback+

svn(1) diff of devel/arduino16 (305 bytes, patch)
2016-11-23 14:00 UTC, Kyle Evans
kevans: maintainer-approval+
Details | Diff
svn(1) diff of devel/arduino-core (666 bytes, patch)
2016-11-23 14:00 UTC, Kyle Evans
kevans: maintainer-approval+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Melvyn Sopacua 2016-11-23 09:38:04 UTC
This is a new variant of "not using the make system while testing a port".

To reproduce:
make -C ${PORTSDIR:-"/usr/ports"}/devel/arduino16 build

===>   arduino-builder-1.3.21_3 depends on executable: go - not found
===>  go-1.7.3,1 is only for i386 amd64 armv6, while you are running x86_64.
*** Error code 1

Caused by:
.if ${ARCH} == "amd64"
ARCH=                   x86_64

Not exposed by poudriere because:
- It builds dependency up in separate builds, discarding upstream make variables
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2016-11-23 11:37:54 UTC
It took me a while to figure out what is going on (specifically, the dependency on go, which comes in from arduino-build).

But the easy answer is that it is never right for a port to redefine certain variables, and ARCH is one of them.

I don't quickly see for a way to substitute ARCH in the port's build infrastructure, so I don't offer a patch.  But this needs to be fixed in this port.

The unsatisfactory workaround is to first build lang/go, and then build devel/arduino16.
Comment 2 Kyle Evans freebsd_committer 2016-11-23 14:00:05 UTC
Created attachment 177330 [details]
svn(1) diff of devel/arduino16
Comment 3 Kyle Evans freebsd_committer 2016-11-23 14:00:23 UTC
Created attachment 177331 [details]
svn(1) diff of devel/arduino-core
Comment 4 Kyle Evans freebsd_committer 2016-11-23 14:03:45 UTC

Ugh, sorry about this. =( If someone would be so kind as to apply the following patches to devel/arduino16 and devel/arduino-core. Also, looking into other ports that do this may also be necessary -- I actually stole the idea that this was OK from devel/dwarfdump.
Comment 5 Mark Linimon freebsd_committer freebsd_triage 2016-11-23 14:23:42 UTC
Have you tested that it compiles this way?  I am not set up to do so ATM.

Yeah, I've found the other instances of this and have assigned myself the task of smashing them flat.

Thanks for the quick response.
Comment 6 Kyle Evans freebsd_committer 2016-11-23 14:27:52 UTC

devel/arduino16 had it as a remnant from before I split devel/arduino-core out -- it wasn't actually being used anymore, and still continues to build.

devel/arduino-core had it purely for using the proper tags in a file -- no actual building happens in this port.
Comment 7 Melvyn Sopacua 2016-11-29 09:19:07 UTC
I haven't looked into why this is done, but if the goal is to have ARCH set to a different value in during build, then you can try MAKE_ENV+=ARCH=foo. The ports infra structure could support this by looking if BUILD_ARCH is defined and export it to MAKE_ENV instead of ARCH.
Comment 8 Kyle Evans freebsd_committer 2016-11-29 14:20:01 UTC
(In reply to Melvyn Sopacua from comment #7)

I can't speak much for the ports that aren't mine (i.e. not devel/arduino16, devel/arduino-core, comms/java-simple-serial-connector), but in my cases the intention was never to build with a modified ARCH -- simply for naming things or 'tagging' things in metadata files. =) The modified ARCH was actually an after-thought that I didn't consider the consequences of.
Comment 9 Boris Samorodov freebsd_committer 2016-12-09 21:39:40 UTC
Comment 10 commit-hook freebsd_committer 2016-12-10 20:04:14 UTC
A commit references this bug:

Author: bsam
Date: Sat Dec 10 20:03:25 UTC 2016
New revision: 428319
URL: https://svnweb.freebsd.org/changeset/ports/428319

  devel/arduino16,  devel/arduino-core: Do not rewrite system variable ARCH:
  rename ARCH -> ARDUINO_ARCH.

  PR:		214776
  Submitted by:	Melvyn Sopacua <m.r.sopacua@gmail.com>
  Patched by:	 Kyle Evans <bsdports@kyle-evans.net> (maintainer)

Comment 11 Boris Samorodov freebsd_committer 2016-12-10 20:23:01 UTC
The fix is committed, thanks!