# Error compiling pkg port



## n9010 (Jun 1, 2016)

Hi to all!
I'm having problems compiling pkg 1.8.3 in one of the servers. The OS is 9.1-RELEASE FreeBSD 9.1-RELEASE, I know is old, we are planning to upgrade really soon. As usual I've updated the ports tree and the from within a jail I try to make the pkg port.
The error I have is:

```
CC  libpkg_la-pkg_cudf.lo
pkg_add.c: In function 'set_attrs':
pkg_add.c:214: warning: passing argument 1 of 'getcwd' from incompatible pointer type
pkg_add.c:237: warning: passing argument 1 of 'chdir' from incompatible pointer type
  CC  libpkg_static_la-pkg_cudf.lo
  CC  libpkg_la-pkg_create.lo
pkg_add.c: In function 'set_attrs':
pkg_add.c:214: warning: passing argument 1 of 'getcwd' from incompatible pointer type
pkg_add.c:237: warning: passing argument 1 of 'chdir' from incompatible pointer type
  CC  libpkg_static_la-pkg_create.lo
pkg.c: In function 'pkg_open_root_fd':
pkg.c:1796: error: 'F_DUPFD_CLOEXEC' undeclared (first use in this function)
pkg.c:1796: error: (Each undeclared identifier is reported only once
pkg.c:1796: error: for each function it appears in.)
pkg.c: In function 'pkg_open_root_fd':
pkg.c:1796: error: 'F_DUPFD_CLOEXEC' undeclared (first use in this function)
pkg.c:1796: error: (Each undeclared identifier is reported only once
pkg.c:1796: error: for each function it appears in.)
*** [libpkg_la-pkg.lo] Error code 1
*** [libpkg_static_la-pkg.lo] Error code 1
2 errors
*** [all-recursive] Error code 1
1 error
*** [all-recursive] Error code 1
1 error
*** [all] Error code 2
1 error
```


I've tried on another jail and the problem is the same.
Any help would be appreciated (and sorry for my English  ).


----------



## tobik@ (Jun 1, 2016)

According to https://wiki.freebsd.org/AtomicCloseOnExec F_DUPFD_CLOEXEC was added in 9.2, so 9.1-RELEASE doesn't have it (https://svnweb.freebsd.org/base?view=revision&revision=239856).

So options are

 to upgrade to 9.3-RELEASE now
 use a pkg version before May 2016 i.e. <= 1.7.2, e.g. by using the quarterly branch (currently 2016Q2) of the ports tree which gets security updates only and still has pkg 1.7.2 and plan to do your system upgrade before July 2016
 revert the relevant pkg commit https://github.com/freebsd/pkg/commit/aa13a931b28250d855d5fe16a565b610bbe2c227 yourself


----------



## n9010 (Jun 1, 2016)

tobik said:


> According to https://wiki.freebsd.org/AtomicCloseOnExec F_DUPFD_CLOEXEC was added in 9.2, so 9.1-RELEASE doesn't have it (https://svnweb.freebsd.org/base?view=revision&revision=239856).
> 
> So options are
> 
> ...


Thanks for the reply, we well decide what to do.


----------



## protocelt (Jun 1, 2016)

I would even go so far as to suggest upgrading to 10.3-RELEASE as the 9 branch is EOL in December of this year.


----------



## SirDice (Jun 1, 2016)

tobik said:


> use a pkg version before May 2016 i.e. <= 1.7.2, e.g. by using the quarterly branch (currently 2016Q2) of the ports tree which gets security updates only and still has pkg 1.7.2 and plan to do your system upgrade before July 2016


I would actually suggest upgrading to 10.3-RELEASE. The whole 9.x branch will be end-of-life at the end of this year.


----------



## n9010 (Jun 1, 2016)

Yes, is our intention to do that, we only have to find the time to migrate


----------

