# pkg upgrade issues



## renster501 (Sep 25, 2014)

Trying to upgrade pkg(8) from pkg-1.3.7 to pkg-1.3.8. But get this

```
Making all in libpkg
Making all in repo
Making all in binary
CC       librepo_binary_la-binary.lo
CC       librepo_binary_static_la-binary.lo
CC       librepo_binary_la-common.lo
CC       librepo_binary_static_la-common.lo
CC       librepo_binary_la-fetch.lo
CC       librepo_binary_static_la-fetch.lo
CC       librepo_binary_la-init.lo
  CC       librepo_binary_static_la-init.lo
In file included from binary.h:27,
                 from binary.c:24:
../../../libpkg/pkg.h:41:25: error: openssl/pem.h: No such file or directory
In file included from binary.h:27,
                 from binary.c:24:
../../../libpkg/pkg.h:888: error: expected declaration specifiers or '...' before 'FILE'
../../../libpkg/pkg.h:984: error: expected declaration specifiers or '...' before 'pem_password_cb'
../../../libpkg/pkg.h:1219: error: expected declaration specifiers or '...' before 'FILE'
../../../libpkg/pkg.h:1225: error: expected declaration specifiers or '...' before 'FILE'
../../../libpkg/pkg.h:1243: error: expected declaration specifiers or '...' before 'FILE'
../../../libpkg/pkg.h:1255: error: expected ')' before '*' token
../../../libpkg/pkg.h:1639: error: expected ')' before '*' token
../../../libpkg/pkg.h:1647: error: expected ')' before '*' token
In file included from binary.h:27,
                 from binary.c:24:
../../../libpkg/pkg.h:41:25: error: openssl/pem.h: No such file or directory
In file included from binary.h:27,
                 from binary.c:24:
../../../libpkg/pkg.h:888: error: expected declaration specifiers or '...' before 'FILE'
../../../libpkg/pkg.h:984: error: expected declaration specifiers or '...' before 'pem_password_cb'
../../../libpkg/pkg.h:1219: error: expected declaration specifiers or '...' before 'FILE'
../../../libpkg/pkg.h:1225: error: expected declaration specifiers or '...' before 'FILE'
../../../libpkg/pkg.h:1243: error: expected declaration specifiers or '...' before 'FILE'
../../../libpkg/pkg.h:1255: error: expected ')' before '*' token
../../../libpkg/pkg.h:1639: error: expected ')' before '*' token
../../../libpkg/pkg.h:1647: error: expected ')' before '*' token
In file included from common.c:31:
../../../libpkg/pkg.h:41:25: error: openssl/pem.h: No such file or directory
In file included from fetch.c:46:
../../../libpkg/pkg.h:41:25: error: openssl/pem.h: No such file or directory
In file included from fetch.c:46:
../../../libpkg/pkg.h:41:25: error: openssl/pem.h: No such file or directory
In file included from common.c:31:
../../../libpkg/pkg.h:984: error: expected declaration specifiers or '...' before 'pem_password_cb'
In file included from fetch.c:46:
../../../libpkg/pkg.h:984: error: expected declaration specifiers or '...' before 'pem_password_cb'
In file included from fetch.c:46:
../../../libpkg/pkg.h:984: error: expected declaration specifiers or '...' before 'pem_password_cb'
In file included from fetch.c:48:
../../../libpkg/private/utils.h:38:25: error: openssl/rsa.h: No such file or directory
../../../libpkg/private/utils.h:39:25: error: openssl/sha.h: No such file or directory
../../../libpkg/private/utils.h:40:25: error: openssl/md5.h: No such file or directory
In file included from fetch.c:48:
../../../libpkg/private/utils.h:77: error: expected specifier-qualifier-list before 'pem_password_cb'
In file included from binary.h:28,
                 from binary.c:24:
../../../libpkg/private/pkg.h:40:25: error: openssl/sha.h: No such file or directory
../../../libpkg/private/pkg.h:41:25: error: openssl/md5.h: No such file or directory
../../../libpkg/private/utils.h:98: error: 'SHA256_DIGEST_LENGTH' undeclared here (not in a function)
../../../libpkg/private/utils.h:99: error: 'SHA256_DIGEST_LENGTH' undeclared here (not in a function)
../../../libpkg/private/utils.h:100: error: 'SHA256_DIGEST_LENGTH' undeclared here (not in a function)
../../../libpkg/private/utils.h:101: error: 'SHA256_DIGEST_LENGTH' undeclared here (not in a function)
../../../libpkg/private/utils.h:102: error: 'SHA256_DIGEST_LENGTH' undeclared here (not in a function)
../../../libpkg/private/utils.h:103: error: 'MD5_DIGEST_LENGTH' undeclared here (not in a function)
../../../libpkg/private/utils.h:105: error: expected declaration specifiers or '...' before 'pem_password_cb'
In file included from fetch.c:48:
../../../libpkg/private/utils.h:38:25: error: openssl/rsa.h: No such file or directory
In file included from init.c:40:
../../../libpkg/pkg.h:41:25: error: openssl/pem.h: No such file or directory
../../../libpkg/private/utils.h:39:25: error: openssl/sha.h: No such file or directory
../../../libpkg/private/utils.h:40:25: error: openssl/md5.h: No such file or directory
In file included from fetch.c:48:
../../../libpkg/private/utils.h:77: error: expected specifier-qualifier-list before 'pem_password_cb'
../../../libpkg/private/utils.h:98: error: 'SHA256_DIGEST_LENGTH' undeclared here (not in a function)
../../../libpkg/private/utils.h:99: error: 'SHA256_DIGEST_LENGTH' undeclared here (not in a function)
../../../libpkg/private/utils.h:100: error: 'SHA256_DIGEST_LENGTH' undeclared here (not in a function)
../../../libpkg/private/utils.h:101: error: 'SHA256_DIGEST_LENGTH' undeclared here (not in a function)
../../../libpkg/private/utils.h:102: error: 'SHA256_DIGEST_LENGTH' undeclared here (not in a function)
../../../libpkg/private/utils.h:103: error: 'MD5_DIGEST_LENGTH' undeclared here (not in a function)
../../../libpkg/private/utils.h:105: error: expected declaration specifiers or '...' before 'pem_password_cb'
In file included from init.c:40:
../../../libpkg/pkg.h:984: error: expected declaration specifiers or '...' before 'pem_password_cb'
In file included from binary.h:28,
                 from binary.c:24:
../../../libpkg/private/pkg.h:40:25: error: openssl/sha.h: No such file or directory
../../../libpkg/private/pkg.h:41:25: error: openssl/md5.h: No such file or directory
In file included from ../../../libpkg/private/pkg.h:47,
                 from binary.h:28,
                 from binary.c:24:
../../../libpkg/private/utils.h:38:25: error: openssl/rsa.h: No such file or directory
In file included from ../../../libpkg/private/pkg.h:47,
                 from binary.h:28,
                 from binary.c:24:
../../../libpkg/private/utils.h:77: error: expected specifier-qualifier-list before 'pem_password_cb'
In file included from common.c:33:
../../../libpkg/private/pkg.h:40:25: error: openssl/sha.h: No such file or directory
../../../libpkg/private/pkg.h:41:25: error: openssl/md5.h: No such file or directory
../../../libpkg/private/utils.h:98: error: 'SHA256_DIGEST_LENGTH' undeclared here (not in a function)
../../../libpkg/private/utils.h:99: error: 'SHA256_DIGEST_LENGTH' undeclared here (not in a function)
../../../libpkg/private/utils.h:100: error: 'SHA256_DIGEST_LENGTH' undeclared here (not in a function)
../../../libpkg/private/utils.h:101: error: 'SHA256_DIGEST_LENGTH' undeclared here (not in a function)
../../../libpkg/private/utils.h:102: error: 'SHA256_DIGEST_LENGTH' undeclared here (not in a function)
../../../libpkg/private/utils.h:103: error: 'MD5_DIGEST_LENGTH' undeclared here (not in a function)
../../../libpkg/private/utils.h:105: error: expected declaration specifiers or '...' before 'pem_password_cb'
In file included from init.c:40:
../../../libpkg/pkg.h:41:25: error: openssl/pem.h: No such file or directory
In file included from binary.h:28,
                 from binary.c:24:
../../../libpkg/private/pkg.h:190: error: 'SHA256_DIGEST_LENGTH' undeclared here (not in a function)
In file included from ../../../libpkg/private/pkgdb.h:31,
                 from fetch.c:49:
../../../libpkg/private/pkg.h:190: error: 'SHA256_DIGEST_LENGTH' undeclared here (not in a function)
In file included from init.c:40:
../../../libpkg/pkg.h:984: error: expected declaration specifiers or '...' before 'pem_password_cb'
In file included from common.c:31:
../../../libpkg/pkg.h:41:25: error: openssl/pem.h: No such file or directory
In file included from ../../../libpkg/private/pkg.h:47,
                 from common.c:33:
../../../libpkg/private/utils.h:38:25: error: openssl/rsa.h: No such file or directory
*** Error code 1
In file included from ../../../libpkg/private/pkg.h:47,
                 from common.c:33:
../../../libpkg/private/utils.h:77: error: expected specifier-qualifier-list before 'pem_password_cb'
../../../libpkg/private/utils.h:98: error: 'SHA256_DIGEST_LENGTH' undeclared here (not in a function)
../../../libpkg/private/utils.h:99: error: 'SHA256_DIGEST_LENGTH' undeclared here (not in a function)
../../../libpkg/private/utils.h:100: error: 'SHA256_DIGEST_LENGTH' undeclared here (not in a function)
../../../libpkg/private/utils.h:101: error: 'SHA256_DIGEST_LENGTH' undeclared here (not in a function)
../../../libpkg/private/utils.h:102: error: 'SHA256_DIGEST_LENGTH' undeclared here (not in a function)
../../../libpkg/private/utils.h:103: error: 'MD5_DIGEST_LENGTH' undeclared here (not in a function)
../../../libpkg/private/utils.h:105: error: expected declaration specifiers or '...' before 'pem_password_cb'
In file included from common.c:31:
../../../libpkg/pkg.h:984: error: expected declaration specifiers or '...' before 'pem_password_cb'
In file included from common.c:33:
../../../libpkg/private/pkg.h:190: error: 'SHA256_DIGEST_LENGTH' undeclared here (not in a function)
In file included from ../../../libpkg/private/pkgdb.h:31,
                 from fetch.c:49:
../../../libpkg/private/pkg.h:190: error: 'SHA256_DIGEST_LENGTH' undeclared here (not in a function)
In file included from ../../../libpkg/private/pkg.h:47,
                 from binary.h:28,
                 from binary.c:24:
../../../libpkg/private/utils.h:38:25: error: openssl/rsa.h: No such file or directory
In file included from ../../../libpkg/private/pkg.h:47,
                 from binary.h:28,
                 from binary.c:24:
../../../libpkg/private/utils.h:77: error: expected specifier-qualifier-list before 'pem_password_cb'
../../../libpkg/private/utils.h:98: error: 'SHA256_DIGEST_LENGTH' undeclared here (not in a function)
../../../libpkg/private/utils.h:99: error: 'SHA256_DIGEST_LENGTH' undeclared here (not in a function)
../../../libpkg/private/utils.h:100: error: 'SHA256_DIGEST_LENGTH' undeclared here (not in a function)
../../../libpkg/private/utils.h:101: error: 'SHA256_DIGEST_LENGTH' undeclared here (not in a function)
../../../libpkg/private/utils.h:102: error: 'SHA256_DIGEST_LENGTH' undeclared here (not in a function)
../../../libpkg/private/utils.h:103: error: 'MD5_DIGEST_LENGTH' undeclared here (not in a function)
../../../libpkg/private/utils.h:105: error: expected declaration specifiers or '...' before 'pem_password_cb'
fetch.c: In function 'pkg_repo_binary_try_fetch':
fetch.c:228: error: type of formal parameter 2 is incomplete
fetch.c:136: warning: unused variable 'cksum'
In file included from binary.h:28,
                 from binary.c:24:
../../../libpkg/private/pkg.h:190: error: 'SHA256_DIGEST_LENGTH' undeclared here (not in a function)
*** Error code 1
fetch.c: In function 'pkg_repo_binary_try_fetch':
fetch.c:228: error: type of formal parameter 2 is incomplete
fetch.c:136: warning: unused variable 'cksum'
*** Error code 1
*** Error code 1
*** Error code 1
In file included from init.c:42:
../../../libpkg/private/pkg.h:40:25: error: openssl/sha.h: No such file or directory
../../../libpkg/private/pkg.h:41:25: error: openssl/md5.h: No such file or directory
In file included from init.c:42:
../../../libpkg/private/pkg.h:40:25: error: openssl/sha.h: No such file or directory
../../../libpkg/private/pkg.h:41:25: error: openssl/md5.h: No such file or directory
In file included from common.c:33:
../../../libpkg/private/pkg.h:40:25: error: openssl/sha.h: No such file or directory
../../../libpkg/private/pkg.h:41:25: error: openssl/md5.h: No such file or directory
In file included from ../../../libpkg/private/pkg.h:47,
                 from init.c:42:
../../../libpkg/private/utils.h:38:25: error: openssl/rsa.h: No such file or directory
In file included from ../../../libpkg/private/pkg.h:47,
                 from init.c:42:
../../../libpkg/private/utils.h:77: error: expected specifier-qualifier-list before 'pem_password_cb'
../../../libpkg/private/utils.h:98: error: 'SHA256_DIGEST_LENGTH' undeclared here (not in a function)
../../../libpkg/private/utils.h:99: error: 'SHA256_DIGEST_LENGTH' undeclared here (not in a function)
../../../libpkg/private/utils.h:100: error: 'SHA256_DIGEST_LENGTH' undeclared here (not in a function)
../../../libpkg/private/utils.h:101: error: 'SHA256_DIGEST_LENGTH' undeclared here (not in a function)
../../../libpkg/private/utils.h:102: error: 'SHA256_DIGEST_LENGTH' undeclared here (not in a function)
../../../libpkg/private/utils.h:103: error: 'MD5_DIGEST_LENGTH' undeclared here (not in a function)
../../../libpkg/private/utils.h:105: error: expected declaration specifiers or '...' before 'pem_password_cb'
In file included from init.c:42:
../../../libpkg/private/pkg.h:190: error: 'SHA256_DIGEST_LENGTH' undeclared here (not in a function)
In file included from ../../../libpkg/private/pkg.h:47,
                 from init.c:42:
../../../libpkg/private/utils.h:38:25: error: openssl/rsa.h: No such file or directory
In file included from ../../../libpkg/private/pkg.h:47,
                 from init.c:42:
../../../libpkg/private/utils.h:77: error: expected specifier-qualifier-list before 'pem_password_cb'
../../../libpkg/private/utils.h:98: error: 'SHA256_DIGEST_LENGTH' undeclared here (not in a function)
../../../libpkg/private/utils.h:99: error: 'SHA256_DIGEST_LENGTH' undeclared here (not in a function)
../../../libpkg/private/utils.h:100: error: 'SHA256_DIGEST_LENGTH' undeclared here (not in a function)
../../../libpkg/private/utils.h:101: error: 'SHA256_DIGEST_LENGTH' undeclared here (not in a function)
../../../libpkg/private/utils.h:102: error: 'SHA256_DIGEST_LENGTH' undeclared here (not in a function)
../../../libpkg/private/utils.h:103: error: 'MD5_DIGEST_LENGTH' undeclared here (not in a function)
../../../libpkg/private/utils.h:105: error: expected declaration specifiers or '...' before 'pem_password_cb'
In file included from init.c:42:
../../../libpkg/private/pkg.h:190: error: 'SHA256_DIGEST_LENGTH' undeclared here (not in a function)
In file included from ../../../libpkg/private/pkg.h:47,
                 from common.c:33:
../../../libpkg/private/utils.h:38:25: error: openssl/rsa.h: No such file or directory
In file included from ../../../libpkg/private/pkg.h:47,
                 from common.c:33:
../../../libpkg/private/utils.h:77: error: expected specifier-qualifier-list before 'pem_password_cb'
../../../libpkg/private/utils.h:98: error: 'SHA256_DIGEST_LENGTH' undeclared here (not in a function)
../../../libpkg/private/utils.h:99: error: 'SHA256_DIGEST_LENGTH' undeclared here (not in a function)
../../../libpkg/private/utils.h:100: error: 'SHA256_DIGEST_LENGTH' undeclared here (not in a function)
../../../libpkg/private/utils.h:101: error: 'SHA256_DIGEST_LENGTH' undeclared here (not in a function)
../../../libpkg/private/utils.h:102: error: 'SHA256_DIGEST_LENGTH' undeclared here (not in a function)
../../../libpkg/private/utils.h:103: error: 'MD5_DIGEST_LENGTH' undeclared here (not in a function)
../../../libpkg/private/utils.h:105: error: expected declaration specifiers or '...' before 'pem_password_cb'
In file included from common.c:33:
../../../libpkg/private/pkg.h:190: error: 'SHA256_DIGEST_LENGTH' undeclared here (not in a function)
init.c: In function 'sqlite_file_exists':
init.c:64: error: type of formal parameter 2 is incomplete
init.c:54: warning: unused variable 'cksum'
init.c: In function 'sqlite_file_exists':
init.c:64: error: type of formal parameter 2 is incomplete
init.c:54: warning: unused variable 'cksum'
*** Error code 1
*** Error code 1
*** Error code 1
8 errors
*** Error code 1
1 error
*** Error code 1
1 error
*** Error code 1
1 error
*** Error code 2
1 error
===> Compilation failed unexpectedly.
Try to set MAKE_JOBS_UNSAFE=yes and rebuild before reporting the failure to
the maintainer.
*** Error code 1

Stop in /usr/ports/ports-mgmt/pkg.
*** Error code 1

Stop in /usr/ports/ports-mgmt/pkg
```
It looks like an OpenSSL issue, normally i'd remove OpenSSL and just remake it from ports. But apparently I need pkg 1.3.8 to do that now. Any ideas suggestion would be greatly appreciated guys.


----------



## SirDice (Sep 25, 2014)

Did you already remove OpenSSL from the base? The errors indicate it cannot find the necessary include files.


----------



## renster501 (Sep 25, 2014)

I do believe I removed the base OpenSSL some time ago and use the ports version via /etc/make.conf.


----------



## kpa (Sep 25, 2014)

That might not be a supported configuration for ports-mgmt/pkg. Having pkg depend on another port at runtime would probably create some problems that are not easy to solve.


----------



## renster501 (Sep 25, 2014)

The issue is rather interesting, pkg-1.3.7 can't be upgraded until I sort this issue out. And I can't install or upgrade anything from ports as they now require pkg-1.3.8.


----------



## SirDice (Sep 25, 2014)

The solution is rather simple. Rebuild and install world with OpenSSL enabled.


----------



## renster501 (Sep 26, 2014)

Thank you for the idea , i did this earlier with no success, updated src and ports etc and tried it again with no luck, same error


----------



## jb_fvwm2 (Sep 26, 2014)

This just worked for me.   (v9 1.3.8_1 >> 1.3.8_2)
Without the following *modified* reinstall , it "failed here also"


```
cd /usr/ports/ports-mgmt/pkg
/bin/rm -rf work
cp -iv /usr/local/lib/libpkg* /usr/local/lib/compat
cp -iv /usr/local/sbin/pkg-static .  # note the dot trailing
cp -iv /usr/local/sbin/pkg .  # note the dot trailing
make build
make deinstall
cp -iv pkg /usr/local/sbin
cp -iv pkg-static /usr/local/sbin
make install
```
Which was surprisingly easy.  [As was this thread to put it in, I had visited the forums to
start a new topic ].


----------



## chrbr (Sep 26, 2014)

Dear @renster501,
I am really not sure if I can help you, but some days ago I have faced the situation that 
	
	



```
portmaster -a
```
 has stopped because some application has required the new version of pkg. If I remember correctly running 
	
	



```
portmaster ports-mgmt/pkg
```
 fixed this situation for me. It might be helpful to post exactly how you have tried to update pkg. May be /etc/make.conf would be of interest as well because you have stated 





> I do believe I removed the base OpenSSL some time ago and use the ports version via /etc/make.conf.


 that there might be some entries related to OpenSSL. Or is there a mix of packages and ports?


----------



## renster501 (Sep 26, 2014)

As far as I know, I've only ever used OpenSSL from ports, saying that though, I shouldn't be having the issue I am. I've tried basically everything I can think of with pkg() command even force uninstalled it

Tried all the portmaster() stuff also, just rolls the same error once it gets to the same point.


----------



## chrbr (Sep 26, 2014)

Dear @renster501,
You are right, you should not have an issue as you face it now. Therefore there must be a reason. I am a newcomer in FreeBSD. Therefore I might be wrong. But as far as I understand it could be a mess to mix packages and ports. As I have read today even using portmaster and portupgrade in parallel is unsafe because they use different data bases. It might be also end up in a mess to install some stuff from packages and other software by ports, even if they seem to have no relations on the first glance. Have you installed anything else from packages?


----------



## renster501 (Sep 26, 2014)

Thank you for your response, thing is this is the first time this issue has arisen, as I said above, normally I would just deinstall and reinstall from ports. always did it this way in the past with little to no issue in 10 years.... but can't do that now due to needing pkg-1.3.8 to make from ports.


----------

