View previous topic :: View next topic |
Author |
Message |
jorgicio n00b
Joined: 17 Oct 2014 Posts: 47
|
Posted: Fri Oct 17, 2014 3:38 pm Post subject: Can't build avr-libc with crossdev! |
|
|
Hi! That's my story:
I recently migrated to Funtoo, and I installed everything trying to work Arduino on my system. When I'm using crossdev to create the AVR toolchain. I just installed binutils and gcc (only the first gcc stage) and everything's ok.
But when I tried to build avr-libc, I'm having some problems like this:
Code: | * Package: cross-avr/avr-libc-1.8.0
* Repository: cross-avr
* Maintainer: dev-embedded
* USE: abi_x86_64 amd64 elibc_glibc kernel_linux multilib userland_GNU
* FEATURES: preserve-libs sandbox
* Checking for avr-gcc ...
[ !! ]
*
* Failed to locate 'avr-gcc' in $PATH. You can install an AVR toolchain using:
* $ crossdev -t avr
*
* ERROR: cross-avr/avr-libc-1.8.0 failed (setup phase):
* AVR toolchain not found
*
* Call stack:
* ebuild.sh, line 93: Called pkg_setup
* avr-libc-1.7.0.ebuild, line 40: Called die
* The specific snippet of code:
* die "AVR toolchain not found"
*
* If you need support, post the output of `emerge --info '=cross-avr/avr-libc-1.8.0'`,
* the complete build log and the output of `emerge -pqv '=cross-avr/avr-libc-1.8.0'`.
* This ebuild is from an overlay named 'cross-avr': '/usr/local/portage/'
* The complete build log is located at '/media/wintendo/tmp_portage/portage/cross-avr/avr-libc-1.8.0/temp/build.log'.
* The ebuild environment file is located at '/media/wintendo/tmp_portage/portage/cross-avr/avr-libc-1.8.0/temp/die.env'.
* Working directory: '/usr/lib64/portage/pym'
* S: '/media/wintendo/tmp_portage/portage/cross-avr/avr-libc-1.7.0/work/avr-libc-1.8.0'
|
Also, when I was on the 2nd stage (creating basic gcc), there are no binaries such as avr-gcc or avr-g++. And when I watched with equery, there's no reference to avr, only the host machine.
I tried with another versions of gcc or avr-libc or binutils, and everything's the same. Even cleaning the toolchain.
I tried with something like:
Code: |
crossdev -t avr -s4 -S --without-headers --g 4.6.4-r2 |
Also, I have gcc-4.8.2. When I tried crossdev-ing that same version of gcc, it couldn't installed because there was file conflicts, so I tried with a lesser version.
And I added that to my make.conf:
Code: |
...
source /var/lib/layman/make.conf
PORTDIR_OVERLAY="/usr/local/portage-crossdev ${PORTDIR_OVERLAY} /usr/local/portage"
CROSSDEV_OVERLAY="${CROSSDEV_OVERLAY} /usr/local/portage-crossdev"
...
|
Even I tried without CROSSDEV_OVERLAY, and it still fails.
So for all of this, I can't build AVR toolchain. And the crossdev version I'm using, is 20140118. |
|
Back to top |
|
|
Roman_Gruber Advocate
Joined: 03 Oct 2006 Posts: 3846 Location: Austro Bavaria
|
Posted: Fri Oct 17, 2014 7:11 pm Post subject: |
|
|
it may help when you post the hole procedure and not only the fail message.
and does funtoo not belong to off the wall or unsupported? funtoo is not gentoo in the first place |
|
Back to top |
|
|
jorgicio n00b
Joined: 17 Oct 2014 Posts: 47
|
Posted: Fri Oct 17, 2014 9:51 pm Post subject: |
|
|
In fact, Funtoo is just Gentoo with a few differences.
I found the problem and solved:
4.6.2-r1 is the last version that supports toolchain, as said there: https://bugs.funtoo.org/browse/FL-821
So I tried to compile that version, but now fails because of source errors. Then I tried with 4.3.3-r2, and everything works flawlessly, but I don't know what affects using an older version for developing for Arduino.
Anyway, thanks. |
|
Back to top |
|
|
cwr Veteran
Joined: 17 Dec 2005 Posts: 1969
|
Posted: Sat Oct 18, 2014 2:17 pm Post subject: |
|
|
My notes on x86 => AVR cross compilers are:
Quote: |
There are problems with avr-gcc 4.5.3 and the Arduino Serial.print() functions.
Even if the functions aren't used, if they are present the whole binary hangs.
Version 4.5.1 works correctly.
cwr@sixpence rfm12base $ avr-gcc --version
avr-gcc (Gentoo 4.5.3-r2 p1.6, pie-0.4.7) 4.5.3
cwr@sixpence rfm12base $ /opt/avr/bin/avr-gcc --version
avr-gcc (GCC) 4.5.1
Serial.printf() bug seems to be fixed: the final build was:
USE="-openmp" crossdev --target avr --gcc 4.5.3-r2 --binutils 2.21.1-r1 \
--libc 1.6.8 --without-headers
It may also be necessary to link files from /usr/avr/lib/avr5 to /usr/avr/lib
The updated and patched avr-gcc 4.8.x is discussed here:
https://groups.google.com/a/arduino.cc/forum/#!topic/developers/21G5w2HbUOg
The Arduino 1.5.7 package contains GCC 4.8.1 and avr-libc 1.8.0 binaries.
|
Hope this helps - Will |
|
Back to top |
|
|
jorgicio n00b
Joined: 17 Oct 2014 Posts: 47
|
Posted: Thu Nov 27, 2014 2:59 am Post subject: |
|
|
Nevermind, I found why happens that: Funtoo ebuilds for GCC are not supporting the toolchain inherit. So I had to download the Gentoo ebuilds, and all works flawlessly.
Also, I did a Python script to do that.
Code: |
#!/usr/bin/env python
import sys,re,os,urllib2,urllib,urlparse
# linkregex = re.compile('<a\s*href=[\'|"](.*?)[\'"].*?')
linkregex = re.compile('href=[\'|"](.*?)[\'"].*?')
linksrc = re.compile('src=[\'|"](.*?)[\'"].*?')
def download(url):
link_list = []##create a list of all found links so there are no duplicates
restrict = url ##used to restrict found links to only have lower level
tocrawl = set([url])
link_list.append(restrict)
parent_folder = restrict.rfind('/', 0, len(restrict)-1)
##a.com/b/c/d/ make /d/ as parent folder
while 1:
try:
crawling = tocrawl.pop()
#print crawling
except KeyError:
break
url = urlparse.urlparse(crawling)##splits url into sections
try:
response = urllib2.urlopen(crawling)##try to open the url
except:
continue
msg = response.read()##save source of url
links = linkregex.findall(msg)##search for all href in source
links = links + linksrc.findall(msg)##search for all src in source
for link in (links.pop(0) for _ in xrange(len(links))):
if link.startswith('/'):
##if /xxx a.com/b/c/ -> a.com/b/c/xxx
link = 'http://' + url[1] + link
elif ~link.find('#'):
continue
elif link.startswith('../'):
if link.find('../../'):##only use links that are max 1 level above reference
##if ../xxx.html a.com/b/c/d.html -> a.com/b/xxx.html
parent_pos = url[2].rfind('/')
parent_pos = url[2].rfind('/', 0, parent_pos-2) + 1
parent_url = url[2][:parent_pos]
new_link = link.find('/')+1
link = link[new_link:]
link = 'http://' + url[1] + parent_url + link
else:
continue
elif not link.startswith('http'):
if url[2].find('.html'):
##if xxx.html a.com/b/c/d.html -> a.com/b/c/xxx.html
a = url[2].rfind('/')+1
parent = url[2][:a]
link = 'http://' + url[1] + parent + link
else:
##if xxx.html a.com/b/c/ -> a.com/b/c/xxx.html
link = 'http://' + url[1] + url[2] + link
if link not in link_list:
link_list.append(link)##add link to list of already found links
if (~link.find(restrict)):
##only grab links which are below input site
print link ##print downloaded link
tocrawl.add(link)##add link to pending view links
file_name = link[parent_folder+1:]##folder structure for files to be saved
filename = file_name.rfind('/')
folder = file_name[:filename]##creates folder names
folder = os.path.abspath(folder)##creates folder path
if not os.path.exists(folder):
os.makedirs(folder)##make folder if it does not exist
try:
urllib.urlretrieve(link, file_name)##download the link
except:
print "could not download %s"%link
else:
continue
url_gcc = "http://data.gpo.zugaina.org/gentoo/sys-devel/gcc/"
local_portage = "/usr/local/portage"
gcc_local = local_portage+"/sys-devel"
gcc_avr = local_portage+"/cross-avr/gcc"
regexp = re.compile(r'^\?')
overlay = "local"
import shutil
def clean_files(direc):
for root, dirs, files in os.walk(direc):
for dname in dirs:
directorio = os.path.join(root,dname)
dcompile = regexp.search(dname)
if dcompile is not None:
shutil.rmtree(directorio)
for fname in files:
archivo = os.path.join(root,fname)
fcompile = regexp.search(fname)
if fcompile is not None:
os.remove(archivo)
def install_gcc_avr(direc):
clean_files(direc)
if os.path.exists(gcc_local):
shutil.rmtree(gcc_local)
os.mkdir(gcc_local)
gcc_local_final = gcc_local+"/gcc"
shutil.copytree(direc,gcc_local_final)
if os.path.lexists(gcc_avr):
os.remove(gcc_avr)
os.symlink(gcc_local_final,gcc_avr)
def find_line(f_gcc,linea):
flag = False
with open(f_gcc) as archivo:
for l in archivo:
l = l.rstrip()
if l == linea:
flag = True
archivo.close()
return flag
def append_to_file_gcc(f_gcc,linea):
with open(f_gcc,'rU+') as archivo:
archivo.seek(-2,2)
if(archivo.read(2) == "\n\n"):
f.seek(-1,2)
archivo.write(linea)
archivo.write("\n")
archivo.close()
def mask_gcc_local():
file_gcc_mask = "/etc/portage/package.mask"
dir_gcc_mask = file_gcc_mask+"/mask"
linea = "sys-devel/gcc::"+overlay
if os.path.exists(file_gcc_mask) and os.path.isdir(file_gcc_mask):
if os.path.exists(dir_gcc_mask):
if not find_line(dir_gcc_mask,linea):
append_to_file_gcc(dir_gcc_mask,linea)
else:
archivo = open(dir_gcc_mask,'w')
archivo.write(linea)
archivo.close()
elif os.path.exists(file_gcc_mask) and os.path.isfile(file_gcc_mask):
if not find_line(file_gcc_mask,linea):
append_to_file_gcc(file_gcc_mask,linea)
else:
archivo = open(file_gcc_mask,'w')
archivo.write(linea)
archivo.close()
dir_res = re.split("/",url_gcc)
dir_res = dir_res[-2]
print "Downloading from %s" % url_gcc
download(url_gcc)
print "Now installing %s in %s" % (dir_res,gcc_local)
install_gcc_avr(dir_res)
print "Cleaning..."
shutil.rmtree(dir_res)
print "Now masking the local %s" % dir_res
mask_gcc_local()
print "Success!"
|
|
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|