# Make buildworld is broken while updating 7.4 -> 8.0



## trifelo (Apr 2, 2013)

Hi,

I am running FreeBSD 7.4-STABLE, and need to upgrade to 8.0,

```
smtp# uname -a
FreeBSD smtp.bp 7.4-STABLE FreeBSD 7.4-STABLE #0: Tue Jan 15 12:06:47 WIT 2013     
[email]root@smtp.bp[/email]:/usr/obj/usr/src/sys/GENERIC  i386
```

After running `#  cd /usr/src` and `#  make buildworld`:


```
/usr/src/cddl/usr.bin/sgsmsg/../../../cddl/contrib/opensolaris/cmd/sgs/include/sgs.h:57:20: libelf.h: No such file or directory
In file included from /usr/src/cddl/usr.bin/sgsmsg/../../../cddl/contrib/opensolaris/cmd/sgs/include/alist.h:45,
                 from /usr/src/cddl/usr.bin/sgsmsg/../../../cddl/contrib/opensolaris/cmd/sgs/include/sgs.h:59,
                 from /usr/src/cddl/usr.bin/sgsmsg/../../../cddl/contrib/opensolaris/cmd/sgs/tools/common/findprime.c:30:
/usr/src/cddl/usr.bin/sgsmsg/../../../sys/cddl/compat/opensolaris/sys/elf.h:30:26: sys/elf.h: No such file or directory
mkdep: compile failed
*** Error code 1

Stop in /usr/src/cddl/usr.bin/sgsmsg.
*** Error code 1

Stop in /usr/src.
*** Error code 1

Stop in /usr/src.
*** Error code 1

Stop in /usr/src.
```

I tried this step in a virtual machine, and there's no problem. How to fix the error?

Thanks for help.


----------



## SirDice (Apr 2, 2013)

Don't upgrade to 8.0, it's been end-of-life since November 2010. Use FreeBSD 8.3.


----------



## trifelo (Apr 3, 2013)

From @SirDice's suggestion, I do the following command again,
[cmd=]cd /etc[/cmd]
`# ee stable-supfile.8`

```
*default release=cvs tag=RELENG_8_3
```
`# ee ports-supfile.8` 

```
*default release=cvs tag=RELENG_8_3
```
`# cvsup -g -L 2 ports-supfile.8 && cvsup -g -L 2 stable-supfile.8`
`# rm -rf /usr/obj/*`
`# cd /usr/src/`
`# make buildworld`

```
--------------------------------------------------------------
>>> World build started on Wed Apr  3 11:22:49 WIT 2013
--------------------------------------------------------------

--------------------------------------------------------------
>>> Rebuilding the temporary build tree
--------------------------------------------------------------
rm -rf /usr/obj/usr/src/tmp
mkdir -p /usr/obj/usr/src/tmp/lib
mkdir -p /usr/obj/usr/src/tmp/usr
mkdir -p /usr/obj/usr/src/tmp/legacy/usr
mtree -deU -f /usr/src/etc/mtree/BSD.usr.dist  -p /usr/obj/usr/src/tmp/legacy/usr >/dev/null
mtree -deU -f /usr/src/etc/mtree/BSD.usr.dist  -p /usr/obj/usr/src/tmp/usr >/dev/null
....
/usr/src/cddl/usr.bin/sgsmsg/../../../cddl/contrib/opensolaris/cmd/sgs/include/sgs.h:57:20: libelf.h: No such file or directory
In file included from /usr/src/cddl/usr.bin/sgsmsg/../../../cddl/contrib/opensolaris/cmd/sgs/include/alist.h:45,
                 from /usr/src/cddl/usr.bin/sgsmsg/../../../cddl/contrib/opensolaris/cmd/sgs/include/sgs.h:59,
                 from /usr/src/cddl/usr.bin/sgsmsg/../../../cddl/contrib/opensolaris/cmd/sgs/tools/common/findprime.c:30:
/usr/src/cddl/usr.bin/sgsmsg/../../../sys/cddl/compat/opensolaris/sys/elf.h:30:26: sys/elf.h: No such file or directory
mkdep: compile failed
*** Error code 1

Stop in /usr/src/cddl/usr.bin/sgsmsg.
*** Error code 1

Stop in /usr/src.
*** Error code 1

Stop in /usr/src.
*** Error code 1

Stop in /usr/src.
```
Is there something amiss with my step?
Thanks for help.


----------



## SirDice (Apr 3, 2013)

trifelo said:
			
		

> From SirDice suggestion, I do the following command again,
> [cmd=]cd /etc[/cmd]
> `# ee stable-supfile.8`
> 
> ...


Ok, so far so good.



> `# ee ports-supfile.8`
> 
> ```
> *default release=cvs tag=RELENG_8_3
> ```


Not related to the problem but there is no release for the ports tree. Use tag=. for the ports tree.


> `# cvsup -g -L 2 ports-supfile.8 && cvsup -g -L 2 stable-supfile.8`


Again, not related to the problem but you can use csup(1). There's no need to install net/cvsup anymore.



> `# rm -rf /usr/obj/*`
> `# cd /usr/src/`
> `# make buildworld`


These steps are all correct. 

Try removing your source tree, `# rm -rf /usr/src/*` and fetch a fresh copy. Remember to backup any custom kernel configs you might have. 

Is there anything in /etc/make.conf that might interfere?


----------



## trifelo (Apr 3, 2013)

Hi @SirDice,

*I* tr*ied* again with this step*:*


```
# more /etc/make.conf
CLAMAVUSER=vscan
CLAMAVGROUP=vscan
# added by use.perl 2012-02-24 17:02:35
PERL_VERSION=5.8.9

# cd /etc
# ee stable-supfile.8
*default release=cvs tag=RELENG_8_3

# ee ports-supfile.8 
*default release=cvs tag=.

# rm -rf /usr/obj/*
# rm -rf /usr/src/*

#cvsup -g -L 2 ports-supfile.8 && cvsup -g -L 2 stable-supfile.8

# cd /usr/src/
# make buildworld

/usr/src/cddl/usr.bin/sgsmsg/../../../cddl/contrib/opensolaris/cmd/sgs/include/sgs.h:57:20: libelf.h: No such file or directory
In file included from /usr/src/cddl/usr.bin/sgsmsg/../../../cddl/contrib/opensolaris/cmd/sgs/include/alist.h:45,
                 from /usr/src/cddl/usr.bin/sgsmsg/../../../cddl/contrib/opensolaris/cmd/sgs/include/sgs.h:59,
                 from /usr/src/cddl/usr.bin/sgsmsg/../../../cddl/contrib/opensolaris/cmd/sgs/tools/common/findprime.c:30:
/usr/src/cddl/usr.bin/sgsmsg/../../../sys/cddl/compat/opensolaris/sys/elf.h:30:26: sys/elf.h: No such file or directory
mkdep: compile failed
*** Error code 1

Stop in /usr/src/cddl/usr.bin/sgsmsg.
*** Error code 1

Stop in /usr/src.
*** Error code 1

Stop in /usr/src.
*** Error code 1

Stop in /usr/src.
```

*I*s there something wrong with /etc/make.conf?

*T*hanks for help.


----------



## SirDice (Apr 3, 2013)

No, your make.conf looks fine. Sometimes people put CFLAGS in there that can cause problems.

I really have no idea why it's not building correctly. Maybe it's something to do with 7.x. Have you tried doing a binary upgrade with freebsd-update(8)? You can always do a full buildworld afterwards if you want.


----------



## kpa (Apr 3, 2013)

Fetch the sources again using devel/subversion, clean up /usr/obj and try again.

Also if you have an /etc/src.conf move it away temporarily to make sure the build is done with defaults.

`# rm -rf /usr/obj/*`
`# svn co [url=svn://svn.freebsd.org/base/releng/8.3]svn://svn.freebsd.org/base/releng/8.3[/url] /usr/src`


----------



## SirDice (Apr 3, 2013)

kpa said:
			
		

> Fetch the sources again using devel/subversion, clean up /usr/obj and try again.


This shouldn't matter. I still update my source via csup(1). I know it's about to be decommissioned but it still works and there shouldn't be any problems.


----------



## kpa (Apr 3, 2013)

I thought the exporter was taken offline, no?


----------



## SirDice (Apr 3, 2013)

I still got 9.1-RELEASE-p2 from it this morning. As far as I know only the CVS access to the ports tree has already been decommissioned.


----------



## trifelo (Apr 4, 2013)

*I*'ve checked my /etc/make.conf
`#  ee /etc/make.conf`

```
CLAMAVUSER=vscan
CLAMAVGROUP=vscan
# added by use.perl 2012-02-24 17:02:35
PERL_VERSION=5.8.9
```

*A*bout the error, is there a relation with my Perl module?

*T*hanks.


----------



## SirDice (Apr 4, 2013)

There shouldn't be. Building world doesn't require perl. 

I would really suggest trying the binary upgrade. At least till it's at 8.3. Once that's running properly we can have another look at why the buildworld fails.

`# freebsd-update -r 8.3-RELEASE upgrade`
`# freebsd-update install`


----------



## trifelo (Apr 5, 2013)

I tried

`# freebsd-update -r 8.3-RELEASE upgrade`

```
Looking up update.FreeBSD.org mirrors... 3 mirrors found.
Fetching public key from update4.freebsd.org... failed.
Fetching public key from update5.freebsd.org... failed.
Fetching public key from update3.freebsd.org... failed.
No mirrors remaining, giving up.
```

Thanks


----------



## SirDice (Apr 5, 2013)

Oh, dammit. I didn't realize you're running a -STABLE. freebsd-update(8) only works on releases 

Let me think about it for a minute, there has to be a way to get this working.


----------



## kpa (Apr 5, 2013)

Do you need any contributed software from Sun, like ZFS? If not you can use this setting in /etc/src.conf to exclude them for the next build:


```
WITHOUT_CDDL=1
```

After successfully upgrading to 8.3 you can then remove the setting and recompile world and kernel.


----------



## SirDice (Apr 5, 2013)

That's a good idea @kpa, definitely worth a shot.

In the mean time I'm trying to set up a VM with 7.4 to have a closer look at why it doesn't work.


----------



## SirDice (Apr 5, 2013)

Got the VM with 7.4-STABLE working, now updating the sources to RELENG_8_3. Hopefully I can finish a first test run today to see if I can replicate the error.


----------



## SirDice (Apr 8, 2013)

A buildworld builds just fine here, I cannot seem to replicate the error.


----------



## trifelo (Apr 9, 2013)

Hi @SirDice / @kpa,
I tried again,

`# ee /etc/src.conf`

```
WITHOUT_CDDL=1
```

`# cd /etc`
`# ee stable-supfile.8`

```
*default release=cvs tag=RELENG_8_3
```

`# ee ports-supfile.8`

```
*default release=cvs tag=.
```

`#  rm -rf /usr/obj/*`
`#  rm -rf /usr/src/*`

`# cvsup -g -L 2 ports-supfile.8 && cvsup -g -L 2 stable-supfile.8`

`#  cd /usr/src/`
`#  make buildworld`

```
--------------------------------------------------------------
>>> stage 2.1: cleaning up the object tree
--------------------------------------------------------------
cd /usr/src; MAKEOBJDIRPREFIX=/usr/obj  MACHINE_ARCH=i386  MACHINE=i386  CPUTYPE=  
GROFF_BIN_PATH=/usr/obj/usr/src/tmp/legacy/usr/bin  
GROFF_FONT_PATH=/usr/obj/usr/src/tmp/legacy/usr/share/groff_font  
GROFF_TMAC_PATH=/usr/obj/usr/src/tmp/legacy/usr/share/tmac AR=gnu-ar RANLIB=gnu-ranlib  
_SHLIBDIRPREFIX=/usr/obj/usr/src/tmp  VERSION="FreeBSD 7.4-STABLE i386 603000"  INSTALL="sh 
/usr/src/tools/install.sh"  
PATH=/usr/obj/usr/src/tmp/legacy/usr/sbin:/usr/obj/usr/src/tmp/legacy/usr/bin:/usr/obj/usr/src/tmp/
legacy/usr/games:/usr/obj/usr/src/tmp/usr/sbin:/usr/obj/usr/src/tmp/usr/bin:/usr/obj/usr/src/tmp/us
r/games:/sbin:/bin:/usr/sbin:/usr/bin NO_CTF=1 make -f Makefile.inc1 DESTDIR=/usr/obj/usr/src/tmp 
par-cleandir
===> share/info (cleandir)
===> lib (cleandir)
===> lib/csu/i386-elf (cleandir)
rm -f crti.o crtn.o gcrt1.o crt1.o Scrt1.o crt1_c.o crt1_s.o gcrt1_c.o Scrt1_c.o
rm -f .depend GPATH GRTAGS GSYMS GTAGS
===> lib/libc (cleandir)
"/usr/src/lib/libc/stdlib/Makefile.inc", line 19: Need an operator
make: fatal errors encountered -- cannot continue
*** Error code 1

Stop in /usr/src/lib.
*** Error code 1

Stop in /usr/src.
*** Error code 1

Stop in /usr/src.
*** Error code 1

Stop in /usr/src.
```
`#  ee /usr/src/lib/libc/stdlib/Makefile.inc`

```
# machine-dependent stdlib sources
.sinclude "${.CURDIR}/${MACHINE_ARCH}/stdlib/Makefile.inc"
```
Change with (I copy this command from another machine)

```
# machine-dependent stdlib sources
.if exists(${.CURDIR}/${MACHINE_ARCH}/stdlib/Makefile.inc)
.include "${.CURDIR}/${MACHINE_ARCH}/stdlib/Makefile.inc"
.endif
```
then  try again `# make buildworld`

```
===> libexec (all)
===> libexec/atrun (all)
cc -O2 -pipe  -DATJOB_DIR=\"/var/at/jobs/\"  -DLFILE=\"/var/at/jobs/.lockfile\"  -DLOADAVG_MX=1.5 
-DATSPOOL_DIR=\"/var/at/spool\"  -DVERSION=\"2.9\" -DDAEMON_UID=1 -DDAEMON_GID=1  -
DDEFAULT_BATCH_QUEUE=\'E\'  -DDEFAULT_AT_QUEUE=\'c\' -DPERM_PATH=\"/var/at/\" -
I/usr/src/libexec/atrun/../../usr.bin/at -I/usr/src/libexec/atrun -DLOGIN_CAP -DPAM -std=gnu99 -
fstack-protector  -c /usr/src/libexec/atrun/atrun.c
cc -O2 -pipe  -DATJOB_DIR=\"/var/at/jobs/\"  -DLFILE=\"/var/at/jobs/.lockfile\"  -DLOADAVG_MX=1.5 
-DATSPOOL_DIR=\"/var/at/spool\"  -DVERSION=\"2.9\" -DDAEMON_UID=1 -DDAEMON_GID=1  -
DDEFAULT_BATCH_QUEUE=\'E\'  -DDEFAULT_AT_QUEUE=\'c\' -DPERM_PATH=\"/var/at/\" -
I/usr/src/libexec/atrun/../../usr.bin/at -I/usr/src/libexec/atrun -DLOGIN_CAP -DPAM -std=gnu99 -
fstack-protector  -c /usr/src/libexec/atrun/gloadavg.c
cc -O2 -pipe  -DATJOB_DIR=\"/var/at/jobs/\"  -DLFILE=\"/var/at/jobs/.lockfile\"  -DLOADAVG_MX=1.5 
-DATSPOOL_DIR=\"/var/at/spool\"  -DVERSION=\"2.9\" -DDAEMON_UID=1 -DDAEMON_GID=1  -
DDEFAULT_BATCH_QUEUE=\'E\'  -DDEFAULT_AT_QUEUE=\'c\' -DPERM_PATH=\"/var/at/\" -
I/usr/src/libexec/atrun/../../usr.bin/at -I/usr/src/libexec/atrun -DLOGIN_CAP -DPAM -std=gnu99 -
fstack-protector   -o atrun atrun.o gloadavg.o -lpam -lutil
/usr/obj/usr/src/tmp/usr/lib/libpam.so: undefined reference to `__stack_chk_fail_local'
*** Error code 1

Stop in /usr/src/libexec/atrun.
*** Error code 1

Stop in /usr/src/libexec.
*** Error code 1

Stop in /usr/src.
*** Error code 1

Stop in /usr/src.
*** Error code 1

Stop in /usr/src.
```

Thanks for help


----------



## kpa (Apr 9, 2013)

You must have some serious issues in your system if @SirDice can't reproduce the issue and the errors just don't make any sense. Is the clock correct? Can you rule out memory or hard disk problems?


----------



## SirDice (Apr 9, 2013)

Yeah, there must be something missing on your 7.4-STABLE. But I have no idea where to start looking.

Maybe this is an idea. Remove or move your /usr/src and csup(1) RELENG_7. Do the whole buildworld, buildkernel, installkernel, installworld and mergemaster(8). That _should_ make sure you have a working and complete 7.4-STABLE. After that try updating to RELENG_8_3 once again.

As I said, I installed 7.4-RELEASE and updated that to 7.4-STABLE (RELENG_7). After that I updated to 8.3-RELEASE (RELENG_8_3) without any problems. It's a lot of work and I'm really grasping for straws here.

Edit: I forgot, delete or move both /etc/make.conf and /etc/src.conf. You want your 7.4-STABLE as vanilla as possible.


----------



## trifelo (Apr 15, 2013)

*[Solved] : Make buildworld is broken while updating 7.4 -> 8.x*

Hi @SirDice / @kpa, finally I've finished the problem. I have marked this issue as "solved", although the results make the effect to mysql and now its not running  (I will make new thread for this issue.)


I reinstalled 7.4-STABLE (RELENG_7)
`#  cd /usr/src/`
`#  make buildworld`
`#  make buildkernel KERNCONF=GEN_MAIL`
`#  make installkernel KERNCONF=GEN_MAIL`
`#  reboot`

In single mode
`#  mount -a -t ufs`
`#  mergemaster -p`
`#  cd /usr/src`
`#  make installworld`
`#  mergemaster -iU` ==> little bit confused with questions 
	
	



```
"How should I deal with this? [Leave it for later]"
```
because I always hit enter for all questions.
`#  reboot`
`#  uname -a`

```
FreeBSD smtp.bp 7.4-STABLE FreeBSD 7.4-STABLE #0: Thu Apr 11 12:15:34 WIT 2013 
[email]root@smtp.bp[/email]:/usr/obj/usr/src/sys/GEN_MAIL  i386
```

Then with the same step like before (to 8.3), 
`#  uname -a`

```
FreeBSD smtp.bp 8.3-RELEASE-p7 FreeBSD 8.3-RELEASE-p7 #1: Mon Apr 15 10:30:01 WIT 2013 
[email]root@smtp.bpam.co.id[/email]:/usr/obj/usr/src/sys/GEN_MAIL  i386
```

Thanks for your help.


----------



## kpa (Apr 15, 2013)

For mergemaster(8) you can make things a bit easier for yourself with /etc/mergemaster.rc:


```
AUTO_INSTALL=yes
AUTO_UPGRADE=yes
```

Then you can run mergemaster(8) without any options after `# make installworld`.

The first time you run mergemaster(8) after switching to source based upgrading/updating you will be asked a lot of questions because the version tags in the installed files do not match with the source files. You should choose to install the new versions (selection i) for all files except select merge for files that you have edited yourself. 

On the next runs you will be only asked about the files that you have edited yourself.


----------



## SirDice (Apr 15, 2013)

I usually use `# mergemaster -iFU`, then most of it is automatic. Except a few files you have edited yourself. For those choose M to merge yourself, for each difference choose _r_ for rightside and _l_ for leftside. The rightside is the "new" version, the left the current or "old" version. It will become clearer once you've merged a few files.

But good to see you finally managed to upgrade to 8.3-RELEASE. Keep in mind that after a major upgrade (7.x -> 8.x) you need to rebuild all your installed ports. As a temporary measure, to get things running again, you could install misc/compat7x. But please use that as a temporary solution, best thing to do is to rebuild your ports.


----------



## trifelo (Apr 17, 2013)

Thanks @SirDice / @kpa, it's all running well now after I rebuild all my installed ports.

I very appreciate for your help, many thanks. Please admin to add tags my threads with "solved", because I cannot edit it.


----------

