Cannot compile Go language on Mac OS X 10.6.7 - go

When following instructions on Getting Started - The Go Programming Language, I get the code and try to run the all.bash script.
But I get this error after a lot of other successful looking output:
INSTALL FAIL net
CGOPKGPATH= cgo -- cgo_bsd.go cgo_unix.go
touch _obj/_cgo_run
6g -o _go_.6 dial.go dnsmsg.go fd_darwin.go hosts.go ip.go ipsock.go iprawsock.go lookup.go net.go parse.go pipe.go sock.go tcpsock.go udpsock.go unixsock.go newpollserver.go fd.go file.go dnsconfig.go dnsclient.go port.go _obj/cgo_bsd.cgo1.go _obj/cgo_unix.cgo1.go _obj/_cgo_gotypes.go
6c -FVw -I/Users/matryer/Work/go/pkg/darwin_amd64 -I . -o "_cgo_defun.6" _obj/_cgo_defun.c
gcc -m64 -I . -g -fPIC -O2 -o _cgo_main.o -c _obj/_cgo_main.c
gcc -m64 -I . -g -fPIC -O2 -o cgo_bsd.cgo2.o -c _obj/cgo_bsd.cgo2.c
gcc -m64 -I . -g -fPIC -O2 -o cgo_unix.cgo2.o -c _obj/cgo_unix.cgo2.c
gcc -m64 -I . -g -fPIC -O2 -o _cgo_export.o -c _obj/_cgo_export.c
gcc -m64 -g -fPIC -O2 -o _cgo1_.o _cgo_main.o cgo_bsd.cgo2.o cgo_unix.cgo2.o _cgo_export.o
cgo -dynimport _cgo1_.o >_obj/_cgo_import.c_ && mv -f _obj/_cgo_import.c_ _obj/_cgo_import.c
6c -FVw -I . -o "_cgo_import.6" _obj/_cgo_import.c
cgo_bsd.go:5[_obj/cgo_bsd.cgo1.go:8]: undefined: _Cconst_AI_MASK
cgo_unix.go:69[_obj/cgo_unix.cgo1.go:72]: undefined: _Cconst_AI_ALL
cgo_unix.go:69[_obj/cgo_unix.cgo1.go:72]: undefined: _Cconst_AI_V4MAPPED
cgo_unix.go:69[_obj/cgo_unix.cgo1.go:72]: undefined: _Cconst_AI_CANONNAME
make[1]: *** [_go_.6] Error 1
make: *** [net.install] Error 1
Has anybody else seen this and fixed it?
I am running Snow Leopard (10.6.7) build 10J869.

It's an open issue, relating to a new version of Xcode, for OS X 10.7 and 10.6.7.
Issue 1881: cgo const error on OS X 10.7
NOTE: Revision 142f0bc0d6e7 has been made to close issue 1881. To update Go for all changes up to and including this revision, run:
$ cd $GOROOT/src
$ hg pull
$ hg update 142f0bc0d6e7
$ ./all.bash

You don't indicate exactly which version of Go you are building. Note that it is a dynamic project where the versions change frequently.
I just ran hg pull and hg update in a directory where I've previously compiled Go successfully (on MacOS X 10.6.7). Then I ran sh all.bash and I didn't see any issues during the build or test phases (though it takes longer to build now than it did when Go was first announced).
FWIW, hg tags gives me:
tip 8715:599657138e00
weekly.2011-06-09 8703:c81944152e97
weekly 8703:c81944152e97
weekly.2011-06-02 8623:3418f22c39eb
weekly.2011-05-22 8483:c98449d685d2
release.r57.1 8294:95d2ce135523
And the end of the build cycle gives:
--- cd ../test
0 known bugs; 0 unexpected bugs
ALL TESTS PASSED
---
Installed Go for darwin/amd64 in /Users/jleffler/go.
Installed commands in /Users/jleffler/bin.
The compiler is 6g.
Therefore...
There is a chance that if you change the version of Go (possibly to a more recent one), then it will work for you, too.
And, another FWIW or FYI, I redid the build on a different machine also running MacOS X 10.6.7 this afternoon, and the tip version is slightly different, and there are apparently 2 known bugs.
--- cd ../test
2 known bugs; 0 unexpected bugs
ALL TESTS PASSED
---
Installed Go for darwin/amd64 in /Users/jleffler/External-Source-Repositories/hg/go.
Installed commands in /Users/jleffler/External-Source-Repositories/hg/go/bin.
*** You need to add /Users/jleffler/External-Source-Repositories/hg/go/bin to your $PATH. ***
The compiler is 6g.
On OS X the debuggers must be installed setgrp procmod.
Read and run ./sudo.bash to install the debuggers.
real 4m55.695s
user 2m52.436s
sys 1m10.222s
Osiris-9 JL: hg tags | sed 15q
tip 8716:164ef168486b
weekly.2011-06-09 8703:c81944152e97
weekly 8703:c81944152e97
weekly.2011-06-02 8623:3418f22c39eb
weekly.2011-05-22 8483:c98449d685d2
release.r57.1 8294:95d2ce135523
The timing information (just under 5 minutes for the build and test cycle) is from running:
time all.bash

Related

cocotb-modelsim error due to Illegal option -o pipefail

I am trying to run cocotb simulations with modelsim, however, I am getting an error and no success, in the last two days, fixing it.
I have installed cocotb using "pip3 install cocotb". The python version I am using is 3.7.0. I have installed the questa/modelsim Lite version 19.1 (which is free through Intel).
I am able to run cocotb simulations with icarus and verilator, however, with modelsim I run into following error:
mehdi#mehdi:~/Dropbox/Test_Tools/testcocotbVerilator$ make SIM=modelsim
make results.xml
make[1]: Entering directory '/home/mehdi/Dropbox/Test_Tools/testcocotbVerilator'
set -o pipefail; cd sim_build && LD_LIBRARY_PATH=/home/mehdi/Dropbox/Test_Tools/testcocotbVerilator/build/libs/x86_64::/usr/lib:/usr/lib:/usr/lib:/usr/lib MODULE=TB TESTCASE= TOPLEVEL="work.dff" COCOTB_SIM=1 \
GPI_EXTRA= TOPLEVEL_LANG=verilog PYTHONPATH=/home/mehdi/Dropbox/Test_Tools/testcocotbVerilator/build/libs/x86_64:/home/mehdi/Dropbox/Test_Tools/testcocotbVerilator:/home/mehdi/.local/lib/python3.5/site-packages: \
/home/mehdi/intelFPGA_lite/19.1/modelsim_ase/linuxaloem/vsim -c -64 -do runsim.do 2>&1 | tee sim.log
/bin/sh: 1: set: Illegal option -o pipefail
/home/mehdi/.local/lib/python3.5/site-packages/cocotb/share/makefiles/simulators/Makefile.questa:147: recipe for target 'results.xml' failed
make[1]: *** [results.xml] Error 2
make[1]: Leaving directory '/home/mehdi/Dropbox/Test_Tools/testcocotbVerilator'
/home/mehdi/.local/lib/python3.5/site-packages/cocotb/share/makefiles/Makefile.sim:79: recipe for target 'sim' failed
make: *** [sim] Error 2
I would appreciate it if someone could advise me how should I fix this problem
That "-o pipefail" option is only available in bash version 3 or later. So either you're running an older version of bash, or some other non-bash shell that doesn't support it.

Getting error when trying to run make on a github repo windows 10

When I try to compile this program, I get the following error, and I cannot find out how to resolve it..
I tried make -DCC=gcc I got this from another post when I tried googling the problem, but didn't help instead it gives me another error message
PS \massdns> make
mkdir -p bin
cc -O3 -std=c11 -DHAVE_EPOLL -DHAVE_SYSINFO -Wall -fstack-protector-strong main.c -o bin/massdns
process_begin: CreateProcess(NULL, cc -O3 -std=c11 -DHAVE_EPOLL -DHAVE_SYSINFO -Wall -fstack-protector-strong main.c -o bin/massdns, ...) failed.
make (e=2): The system cannot find the file specified.
make: *** [Makefile:5: all] Error 2
Error message from make -DCC=gcc
PS massdns> make -DCC=gcc
C:\ProgramData\chocolatey\lib\make\tools\install\bin\make (pid = 4284)
C:\ProgramData\chocolatey\lib\make\tools\install\bin\make is suspending for 30 seconds...done sleep(30). Continuing.
make: *** C=gcc: No such file or directory. Stop.
Been trying to solve this for awhile so if anyone could help, it would be greatly appertained
Repo says to install this, do this
Clone the git repository and cd into the project root folder. Then run make to build from source. If you are not on Linux, run make nolinux. On Windows, the Cygwin packages gcc-core, git and make are required.
Edit: I did try the make nolinux command just forgot I did because i've been trying to do this for awhile, it's the same output, heres the output
PS massdns> make nolinux
mkdir -p bin
cc -O3 -std=c11 -Wall -fstack-protector-strong main.c -o bin/massdns
process_begin: CreateProcess(NULL, cc -O3 -std=c11 -Wall -fstack-protector-strong main.c -o bin/massdns, ...) failed.
make (e=2): The system cannot find the file specified.
make: *** [Makefile:11: nolinux] Error 2
Problem solved, of course a user error.
Wasn't familiar with how you installed the packages, gcc-core, git via the Cygwin installer as it's a very unique interaction I haven't seen on an installer. I also had to do git clone repo_url inside the Cygwin terminal and also had to run make directory inside the Cygwin Terminal asweell.

How do I get cpanm to use my local perl5?

I am on a Mac so of course I'm running into this huge problem with perl on the Mac where the OS is trying to protect me and it's a nightmare to install . The solution seems to be "make your own perl instead of using the one with the OS" so I've done that. I ran brew install perl and now I have this in my .bashrc
PATH="/Users/ericmueller/perl5/bin${PATH:+:${PATH}}"; export PATH;
PERL5LIB="/Users/ericmueller/perl5/lib/perl5${PERL5LIB:+:${PERL5LIB}}"; export PERL5LIB;
PERL_LOCAL_LIB_ROOT="/Users/ericmueller/perl5${PERL_LOCAL_LIB_ROOT:+:${PERL_LOCAL_LIB_ROOT}}"; export PERL_LOCAL_LIB_ROOT;
PERL_MB_OPT="--install_base \"/Users/ericmueller/perl5\""; export PERL_MB_OPT;
PERL_MM_OPT="INSTALL_BASE=/Users/ericmueller/perl5"; export PERL_MM_OPT;
eval "$(perl -I$HOME/perl5/lib/perl5 -Mlocal::lib=$HOME/perl5)"
source ~/perl5/perlbrew/etc/bashrceval "$(perl -I$HOME/perl5/lib/perl5 -Mlocal::lib=$HOME/perl5)"
Honestly, I have no idea what most of this is ;-) but it looks like I have my own perl in my folder and I see that I can run simple perl scripts so I guess all is good.
So now I want to install cpanminus and DBI.
I installed cpanminus (brew install cpanminus), without errors. But then when I run cpanm DBI it fails, and when I look at the log where it failed, I see this:
"/usr/bin/perl" -MExtUtils::Command::MM -e 'cp_nonempty' -- DBI.bs blib/arch/auto/DBI/DBI.bs 644
"/usr/bin/perl" -p -e "s/~DRIVER~/Perl/g" ./Driver.xst > Perl.xsi
"/usr/bin/perl" "/System/Library/Perl/5.18/ExtUtils/xsubpp" -typemap '/System/Library/Perl/5.18/ExtUtils/typemap' -typemap '/Users/ericmueller/.cpanm/work/1555346710.17160/DBI-1.642/typemap' Perl.xs > Perl.xsc
mv Perl.xsc Perl.c
cc -c -g -pipe -fno-common -DPERL_DARWIN -fno-strict-aliasing -fstack-protector -Os -DVERSION=\"1.642\" -DXS_VERSION=\"1.642\" "-I/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE" -W -Wall -Wpointer-arith -Wbad-function-cast -Wno-comment -Wno-sign-compare -Wno-cast-qual -Wmissing-noreturn -Wno-unused-parameter Perl.c
In file included from Perl.xs:7:
./DBIXS.h:22:10: fatal error: 'EXTERN.h' file not found
#include <EXTERN.h>
^~~~~~~~~~
1 error generated.
make: *** [Perl.o] Error 1
This is totally the stupid Mac perl problem, and the issue appears to be that it's still trying to put the DBI library (or one of its dependencies) in /usr/bin/ which is a big no-no. Or maybe it's trying to use the system perl to do the installation, so that's also failing. I have my own perl5 installation in my home folder. That's where it should be putting things and working with them.
So if that is the issue (and I am really shitty at both perl and this kind of sysadmin stuff, so I'm not 100% sure!), how do I get cpanm to work with my perl in my home folder, instead of in /usr/bin/? I don't want ANYTHING to happen in /usr/bin/ since that is a non-starter!
** EDIT I removed everything but the PATH command from my bashrc, and now I get this when I run cpanm DBI
!
! Can't write to /Library/Perl/5.18 and /usr/local/bin: Installing modules to /Users/ericmueller/perl5
! To turn off this warning, you have to do one of the following:
! - run me as a root or with --sudo option (to install to /Library/Perl/5.18 and /usr/local/bin)
! - Configure local::lib in your existing shell to set PERL_MM_OPT etc.
! - Install local::lib by running the following commands
!
! cpanm --local-lib=~/perl5 local::lib && eval $(perl -I ~/perl5/lib/perl5/ -Mlocal::lib)
!
--> Working on DBI
Fetching http://www.cpan.org/authors/id/T/TI/TIMB/DBI-1.642.tar.gz ... OK
Configuring DBI-1.642 ... OK
Building and testing DBI-1.642 ... FAIL
! Installing DBI failed. See /Users/ericmueller/.cpanm/work/1555348167.22814/build.log for details. Retry with --force to force install it.
So the good news is that I am definitely using the cpanm that comes with my custom perl5 in my /Users folder. The bad news is, I'm still getting the exact same stupid problem.
yep ... MacOS Perl is something you should rather not touch.
yes ... You can do it.
but ... Common practice, https://perlbrew.pl
and ... Install some shinny perl
and ... follow the instructions on the website about cpanm

How to write a bare-metal hello world program for PowerPC

I need to write a program on bare-metal PowerPC system. As a newbie to bare-metal programming without OS/bootloarder, I decide to write a hello world program to start. I googled some post about this, and found out something about ARM like Beagleboard bare metal programming or Hello world, bare metal Beagleboard.
I don't very clear if they are suitable for porting to PowerPC platform. I cannot find PowerPC's hello world example for beginner. Anyone have experience of bare-metal development for PowerPC, without bootloader or OS?
Thanks.
Random notes/links I collected for trying to get a bare metal PPC system to boot in Qemu There are plenty of examples all around for doing embedded, bare-metal programming on ARM platforms, but the PowerPC examples seem to be sparse.
Some ARM links:
http://opensourceforu.com/2011/07/qemu-for-embedded-systems-development-part-2/
https://balau82.wordpress.com/2010/02/28/hello-world-for-bare-metal-arm-using-qemu/
Building GNU GCC cross compiler
1) Packages Needed
binutils https://ftp.gnu.org/gnu/binutils/
GCC https://ftp.gnu.org/gnu/gcc/gcc-4.1.1/
newlib ftp://sourceware.org/pub/newlib/index.html
GDB http://www.gnu.org/software/gdb/gdb.html
2) Set environment variables
$ export TARGET=powerpc-eabi
$ export PREFIX=/usr/local/$TARGET
$ export PATH=$PATH:$PREFIX/bin
3) Build binutils
$ tar xjfv binutils-2.17.tar.bz2
$ mkdir build-binutils
$ cd build-binutils
$ ../binutils-2.17/configure --target=$TARGET --prefix=$PREFIX
$ make all
$ make install
4) Build bootstrap GCC
$ tar xjfv gcc-4.1.1.tar.bz2
$ mkdir build-gcc
$ cd build-gcc
$ ../gcc-4.1.1/configure --target=$TARGET --prefix=$PREFIX --without-headers --with-newlib --with-gnu-as --with-gnu-ld
$ make all-gcc
$ make install-gcc
5) Build newlib
$ tar xzfv newlib-1.14.0.tar.gz
$ mkdir build-newlib
$ cd build-newlib
$ ../newlib-1.14.0/configure --target=$TARGET --prefix=$PREFIX
$ make all
$ make install
6) Build GCC again with newlib
$ cd build-gcc
$ ../gcc-4.1.1/configure --target=$TARGET --prefix=$PREFIX --with-newlib --with-gnu-as --with-gnu-ld --disable-shared --disable-libssp
$ make all
$ make install
7) Build GDB
$ tar xjfv gdb-6.3.tar.bz2
$ mkdir build-gdb
$ cd build-gdb
$ ../gdb-6.3/configure --target=$TARGET --prefix=$PREFIX --enable-sim-powerpc --enable-sim-stdio
$ make all
$ make install
Example bare metal hello world!!!
https://github.com/ara4711/ppc_hw
In makefile change, PREFIX=$(PROC)-$(TYPE)- to
PREFIX=/usr/local/powerpc-eabi/bin/$(PROC)-$(TYPE)-
In makefile give path of qemu-system-ppc to QEMU variable.
Command make will generate the test.bin.
Command make run will load the binary and the print “Test Hello
world!“ is displayed on the console
Command make debug to debug test program.
Press Ctrl+a and x to terminate QEMU
QEMU implements a gdb connector using a TCP connection. To do so, run make debug
this command freezes the system before executing any guest code and waits for a connection on the TCP port 1234. From another terminal, run powerpc-eabi-gdb and enter the commands:
target remote localhost:1234
file test.elf
This connects to the QEMU system and loads the debugging symbols of the test program, whose binary image is already loaded in the system memory. From there, it is possible to run the program with the continue command, single-step the program and debug it in general. The exit command in gdb closes both the debugger and the emulator.
First of all, which CPU is this? Secondly, the CPU is not everything.
If you have no starting point, you can study up the BIOS of the architecture you want to write this code for. Then you can write a boot sector which gives you the output you want. Check this page for some examples: Rough guide to assembly

Error 127 - recipe for target failed - When compiling Google NaCl examples from Pepper 19?

When I run the make batch file in my Cygwin terminal I get the following output:
mparadis#A-082-MPARADI-0 ~/pepper_19/examples$ make
make -C dlopen
make[1]: Entering directory `/cygdrive/c/nacl_sdk/pepper_19/examples/dlopen' /cygdrive/c/nacl_sdk/pepper_19/toolchain/win_x86_glibc/bin/i686-nacl-g++ -o dlopen_x86_32.o -c
dlopen.cc -m32 -g -O0 -pthread -std=gnu++98 -Wno-long-long -Wall
Makefile:92: recipe for target `dlopen_x86_32.o' failed
make[1]: *** [dlopen_x86_32.o] Error 127
make[1]: Leaving directory `/cygdrive/c/nacl_sdk/pepper_19/examples/dlopen'
Makefile:33: recipe for target `dlopen_TARGET' failed
make: *** [dlopen_TARGET] Error 2
It took some time to get Python properly set up because I needed the language interpreter package for it and was not aware I didn't have it already. My env variable for Python is correctly set to C:\python27. I get the same results when compiling my co-workers code which, I can compile fine on a Mac or Linux box. Unfortunately, I need to get this working in my Cygwin environment as well.
Anybody with any experience using google native client or know why this is happening please advise. I've been at this for so long I'm staring cross-eyed at the computer screen.
UPDATE:
If I insert the --version flag into the referenced command within the makefile, I receive the same error as above. However, if I type the command, as is, from the same working directory as the make file I get the following:
mparadis#A-082-MPARADI-0 ~/pepper_19/examples/dlopen> $ /cygdrive/c/nacl_sdk/pepper_19/toolchain/win_x86_glibc/bin/i686-nacl-g++.exe -o dlopn_x86_32.o -c dlopen.cc -m32 -g -O0 -pthread -std=gnu++98 --version
mparadis#A-082-MPARADI-0 ~/pepper_19/examples/dlopen $
In other words, it simply thinks for a split second, then returns to the prompt.
tl;dr: your cygwin may be buggy and give this return code to all batch file. My does this. My cygwin version:
$ uname -srv
CYGWIN_NT-6.1-WOW64 1.7.17(0.262/5/3) 2012-10-19 14:39
From your comment, I see something called "make.bat":
mparadis#A-082-MPARADI-0 ~/pepper_19/examples/dlopen
$ ls dlopen.cc dlopen.html eightball.cc eightball.h make.bat Makefile
You can test your cygwin with this little bash script, too..
#!/bin/bash
echo echo foo %errorlevel% bar >temp.bat
./temp.bat
if [ $? -eq 127 ]; then echo "bug"; fi
If your make recipe for that target uses make.bat, and you have this bug, then this cygwin bug is causing the Error 127

Resources