Thursday, June 4, 2020

Fedora 31 upgrade log

Upgrading Linux is always a challenging task. It will cause my heart beating fast, my head was spinning, and I was sweating. This round I was upgrading Fedora 30 to 31, there are few errors pops up during the upgrade. The first challenge is when the package gpgme(x86-64) required by python2-gpg couldn't be found.
$ sudo dnf system-upgrade download --releasever=31

...
...

Error: 
 Problem: package python2-gpg-1.13.1-7.fc30.x86_64 requires gpgme(x86-64) = 1.13.1-7.fc30, but none of the providers can be installed
  - gpgme-1.13.1-7.fc30.x86_64 does not belong to a distupgrade repository
  - problem with installed package python2-gpg-1.13.1-7.fc30.x86_64
(try to add '--skip-broken' to skip uninstallable packages)
I found a link mention that Python 2 has end of life, and thus the dependencies required by Python 2 waren't there anymore. Googling around couldn't find a solution on this, but I found a similar problem where the workaround is to remove the package.
$ sudo dnf remove python2-gpg-1.13.1-7.fc30.x86_64

...
...

Removed:
  annobin-8.71-4.fc30.x86_64                                                    
  createrepo_c-0.15.5-1.fc30.x86_64                                             
  createrepo_c-libs-0.15.5-1.fc30.x86_64                                        
  drpm-0.4.1-1.fc30.x86_64                                                      
  dwz-0.12-10.fc30.x86_64                                                       
  efi-srpm-macros-4-2.fc30.noarch                                               
  fpc-srpm-macros-1.2-1.fc30.noarch                                             
  ghc-srpm-macros-1.4.2-9.fc30.noarch                                           
  gnat-srpm-macros-4-9.fc30.noarch                                              
  go-srpm-macros-2-19.fc30.noarch                                               
  mach-1.0.4-9.fc30.x86_64                                                      
  nim-srpm-macros-2-1.fc30.noarch                                               
  ocaml-srpm-macros-5-5.fc30.noarch                                             
  openblas-srpm-macros-2-5.fc30.noarch                                          
  perl-srpm-macros-1-29.fc30.noarch                                             
  pyliblzma-0.5.3-25.fc30.x86_64                                                
  python-srpm-macros-3-47.fc30.noarch                                           
  python2-gpg-1.13.1-7.fc30.x86_64                                              
  python2-iniparse-0.4-33.fc30.noarch                                           
  python2-pycurl-7.43.0.2-6.fc30.x86_64                                         
  python2-pyxattr-0.6.1-1.fc30.x86_64                                           
  python2-rpm-4.14.2.1-5.fc30.x86_64                                            
  python2-urlgrabber-4.0.0-3.fc30.noarch                                        
  python3-urlgrabber-4.0.0-3.fc30.noarch                                        
  qt5-srpm-macros-5.12.5-1.fc30.noarch                                          
  redhat-rpm-config-132-1.fc30.noarch                                           
  rpm-build-4.14.2.1-5.fc30.x86_64                                              
  rust-srpm-macros-10-1.fc30.noarch                                             
  yum-3.4.3-522.fc30.noarch                                                     
  yum-metadata-parser-1.1.4-22.fc29.x86_64                                      
  zstd-1.4.4-1.fc30.x86_64                                                      

Complete!
A bunch of Python 2 related dependencies was removed. Now come to the next challenge, it shows that Cannot enable multiple streams for module 'gimp'. What the hell exactly of this? 
$ sudo dnf system-upgrade download --releasever=31

...
...

terminate called after throwing an instance of 'libdnf::ModulePackageContainer::EnableMultipleStreamsException'
  what():  Cannot enable multiple streams for module 'gimp'
Aborted
There is exactly the same error has been reported to Redhat Bugzilla, but that one is caused by VirtualBox. Then I found this guide which is quite straight forward to use.
$ sudo dnf module disable gimp
Last metadata expiration check: 0:29:49 ago on Wed 03 Jun 2020 09:05:06 AM +08.
Dependencies resolved.
======================================================================================================================
 Package                     Architecture               Version                     Repository                   Size
======================================================================================================================
Disabling modules:
 gimp                                                                                                                

Transaction Summary
======================================================================================================================

Is this ok [y/N]: y
Complete!
Now only I can proceed to upgrade the system. The next biggest challenge would be the driver. This always failed me. When I compile the driver with DKMS, it failed due to the compilation error shown in the make.log:
implicit declaration of function ‘ioremap_nocache’; did you mean ‘ioremap_cache’?
As I check in the NVIDIA driver source code, there are plenty of the function named ioremap_nocache. This is so unwise if I change it manually, throughout my professional career, programming does not work in that way. After a long search on the Internet, there is a patch for NVIDIA 390.132 driver. Use that patch driver instead of the original download from the NVIDIA website. Once done, verify with the following command and I got the driver installed successfully.
$ lsb_release -a
LSB Version:	:core-4.1-amd64:core-4.1-noarch
Distributor ID:	Fedora
Description:	Fedora release 31 (Thirty One)
Release:	31
Codename:	ThirtyOne

Tuesday, January 7, 2020

Declaring a class type member variable in OO way

Wonder what is wrong with my code? Am I forgotten how could I declare and initialize static member of a class?
class Configuration
{
private:
   static b2Vec2 gravity(0.0f, -0.05f);
}
Should be. I am getting this error really scratching my head hard.
/home/kokhoe/workspacec/OpenGL2/header/Configuration.h:47:24: error: expected identifier before numeric constant
   47 |  static b2Vec2 gravity(0.0f, -0.05f);
      |                        ^~~~
No. Not really. It has nothing to do with static or not. Just that I have forgotten the way to declare a class type member variable in object oriented way. The correct way of declaring a class type should be like this:
class Configuration
{
private:
   static b2Vec2 gravity = b2Vec2(0.0f, -0.05f);
}
Somehow b2Vec2 is a struct not class. This has cause the compilation error:
/home/kokhoe/workspacec/OpenGL2/header/Configuration.h:44:16: error: in-class initialization of static data member ‘b2Vec2 Configuration::gravity’ of non-literal type
   44 |  static b2Vec2 gravity = b2Vec2(0.0f, -0.05f);
      |                ^~~~~~~
Since b2Vec2 is a struct, I remove the static keyword and it compile successfully.