安装参考这篇文章
文章中的安装方法不怎么好使,使用下面的安装
sudo apt-get install odb
安装成功以后
lib会安装在 /usr/lib/x86_64-linux-gnu
include会在/usr/include/odb
bin会在/usr/bin/odb
把examples下载下来 去hello文夹下执行
odb -d sqlite --generate-query --generate-schema person.hxx
然后就报错了
cc1plus: error: bad value (‘/dev/null’) for ‘-mtune=’ switch
cc1plus: note: valid arguments to ‘-mtune=’ switch are: nocona core2 nehalem corei7 westmere sandybridge corei7-avx ivybridge core-avx-i haswell core-avx2 broadwell skylake skylake-avx512 bonnell atom silvermont slm knl intel x86-64 eden-x2 nano nano-1000 nano-2000 nano-3000 nano-x2 eden-x4 nano-x4 k8 k8-sse3 opteron opteron-sse3 athlon64 athlon64-sse3 athlon-fx amdfam10 barcelona bdver1 bdver2 bdver3 bdver4 znver1 btver1 btver2 generic
查看gcc版本:
gcc version 7.5.0 (Ubuntu 7.5.0-3ubuntu1~18.04)
可能的原因:obd使用的gcc版本与7.5不匹配
https://stackoverflow.com/questions/60762771/what-causes-gcc-invalid-option-for-mtune
安装老版本gcc g++
sudo apt-get install gcc-7-base=7.3.0-16ubuntu3 cpp-7=7.3.0-16ubuntu3 gcc-7=7.3.0-16ubuntu3 libgcc-7-dev=7.3.0-16ubuntu3 libasan4=7.3.0-16ubuntu3 libubsan0=7.3.0-16ubuntu3 libcilkrts5=7.3.0-16ubuntu3
sudo apt-get install g++-7=7.3.0-16ubuntu3 libstdc++-7-dev=7.3.0-16ubuntu3
sudo ln -s /usr/bin/g++-7 /usr/bin/g++
sudo ln -s /usr/bin/gcc-7 /usr/bin/gcc
sudo ln -s /usr/bin/gcc /usr/bin/cc
然后再运行 odb 就可以了
但是Ubuntu的桌面程序运行不了
恢复桌面:
sudo apt-get install --reinstall ubuntu-desktop
也许可以通过编译gcc7.3解决,但没有试