Skip to content

Commit

Permalink
Ubuntu 16.04 build for glibc >= 2.23. Or 2.14(!?)
Browse files Browse the repository at this point in the history
objdump says we only need 2.14, and the cimbar binary runs on centos7...
I see this as an absolute win
  • Loading branch information
sz3 committed Feb 20, 2022
1 parent 7bb1bc8 commit bd87003
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 5 deletions.
22 changes: 18 additions & 4 deletions package-portable-linux.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,31 @@
#!/bin/sh
# docker run --mount type=bind,source="$(pwd)",target="/usr/src/app" -it ubuntu:18.04
## targeting old glibc
# docker run --mount type=bind,source="$(pwd)",target="/usr/src/app" -it ubuntu:16.04

cd /usr/src/app

# https://gist.github.com/jlblancoc/99521194aba975286c80f93e47966dc5
apt update
apt install -y software-properties-common
add-apt-repository -y ppa:ubuntu-toolchain-r/test

apt update
apt install -y pkgconf g++ cmake
apt install -y pkgconf g++-7 python-pip
apt install -y libgles2-mesa-dev libglfw3-dev

# cmake (via pip)
python -m pip install cmake

# use gcc7
update-alternatives --install /usr/bin/cc cc /usr/bin/gcc-7 100
update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++-7 100

cd opencv4/
mkdir build-portable/ && cd build-portable/
cmake .. -DCMAKE_BUILD_TYPE=RELEASE -DBUILD_SHARED_LIBS=OFF -DOPENCV_GENERATE_PKGCONFIG=YES -DOPENCV_FORCE_3RDPARTY_BUILD=YES
/usr/local/bin/cmake .. -DCMAKE_BUILD_TYPE=RELEASE -DBUILD_SHARED_LIBS=OFF -DOPENCV_GENERATE_PKGCONFIG=YES -DOPENCV_FORCE_3RDPARTY_BUILD=YES
make -j5 install

cd /usr/src/app
mkdir build-portable/ && cd build-portable/
cmake .. -DBUILD_PORTABLE_LINUX=1
/usr/local/bin/cmake .. -DBUILD_PORTABLE_LINUX=1
make -j5 install
2 changes: 1 addition & 1 deletion src/lib/cimb_translator/test/CimbDecoderTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ TEST_CASE( "CimbDecoderTest/testPrethresholdDecode", "[unit]" )
for (unsigned i = 0; i < 16; ++i)
{
cv::Mat tile = cimbar::getTile(4, i, true);
cv::Mat tenxten(10, 10, tile.type());
cv::Mat tenxten(10, 10, tile.type(), cv::Scalar(0, 0, 0));
tile.copyTo(tenxten(cv::Rect(cv::Point(1, 1), tile.size())));

// grayscale and threshold, since that's what average_hash needs
Expand Down
4 changes: 4 additions & 0 deletions src/lib/image_hash/average_hash.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ namespace image_hash
uint64_t mval = (*hax) & 0x101010101ULL;
const uint8_t* cv = reinterpret_cast<const uint8_t*>(&mval);
uint8_t val = cv[0] << 4 | cv[1] << 3 | cv[2] << 2 | cv[3] << 1 | cv[4];
// TODO:
/*if (bigEndian)
val = cv[7] << 4 | cv[6] << 3 | cv[5] << 2 | cv[4] << 1 | cv[3];*/ // ?

res |= intx::uint128(val) << bitpos;
}
}
Expand Down

0 comments on commit bd87003

Please sign in to comment.