InternationalColorConsortium / DemoIccMAX

Demonstration Implementation for iccMAX color profiles
Other
121 stars 37 forks source link

Compile Error #86

Closed TahomaSoft closed 3 months ago

TahomaSoft commented 3 months ago

gcc --version gcc (Ubuntu 13.2.0-23ubuntu4) 13.2.0

In file included from /home/eeck/Build/DemoICCMax/DemoIccMAX/IccProfLib/IccTag.h:90, from /home/eeck/Build/DemoICCMax/DemoIccMAX/IccProfLib/IccCmm.h:77, from /home/eeck/Build/DemoICCMax/DemoIccMAX/IccProfLib/IccApplyBPC.h:74, from /home/eeck/Build/DemoICCMax/DemoIccMAX/IccProfLib/IccApplyBPC.cpp:71: /home/erikbeck/Build/DemoICCMax/DemoIccMAX/IccProfLib/IccTagMPE.h:171:25: warning: ‘virtual CIccApplyMpe CIccMultiProcessElement::GetNewApply(CIccApplyTagMpe)’ was hidden [-Woverloaded-virtual=] 171 | virtual CIccApplyMpe GetNewApply(CIccApplyTagMpe pApplyTag); | ^~~ /home/eeck/Build/DemoICCMax/DemoIccMAX/IccProfLib/IccTagMPE.h:255:25: note: by ‘virtual CIccApplyMpe CIccMpeUnknown::GetNewApply()’ 255 | virtual CIccApplyMpe GetNewApply() { return NULL; } | ^~~ /home/eeck/Build/DemoICCMax/DemoIccMAX/IccProfLib/IccCmm.h:1246:37: error: expected ‘)’ before ‘’ token 1246 | CIccApplyNDLutXform(CIccXformNDLut pXform, CIccApplyCLUT* pApply); | ~ ^ | )

xsscx commented 3 months ago

Hello @TahomaSoft

Thank you for confirming the compile issues with Host gcc (Ubuntu 13.2.0-23ubuntu4) 13.2.0. Below is a workaround and other Build Examples that are verified to compile across Ubuntu, macOS and Windows with Build Instructions noted in 77.

If I can provide any additional information, or help with compiling, etc.. please update this Issue.


Minimized Build Instructions

cd /tmp
git clone https://github.com/InternationalColorConsortium/DemoIccMAX.git
cd DemoIccMAX
git revert b90ac3933da99179df26351c39d8d9d706ac1cc6
cmake -DCMAKE_INSTALL_PREFIX=$HOME/.local -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="-g -fsanitize=address,undefined -fno-omit-frame-pointer -Wall" -Wno-dev  Build/Cmake/
make -j$(nproc) 2>&1 | grep 'error:'

For anyone wanting to Cherry Pick their way to the most recent build:

Cherry Picking Example

cd /tmp
git clone https://github.com/InternationalColorConsortium/DemoIccMAX.git
cd DemoIccMAX
git checkout f891074a0f1c9d61a3dfa53749265f8c14ed4ee6
git fetch origin
git cherry-pick 35787aa9ad33dc27448f1af68a0a5bfdde4fffba
git cherry-pick 1ed936f2d398c12c04b570f7cd3ad251c39bb483
git cherry-pick e71eacfa550ac9a092903ecc24feba9ae32ebaae
git cherry-pick 4f354f4d034a88230e6cabbc1f84ff0d9a4556ae
git cherry-pick c0ab97ddd1a0f792c8afb7a061135bc7c87f5854
cmake -DCMAKE_INSTALL_PREFIX=$HOME/.local -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="-g -fsanitize=address,undefined -fno-omit-frame-pointer -Wall" -Wno-dev Build/Cmake
make -j$(nproc) 2>&1 | grep 'error:'

Result: Pass

Keep adding git cherry-pick for the Commits you want.


Cherry Picking Runner

name: C/C++ CI with Packaging

on:
  push:
    branches: [ "master" ]
  pull_request:
    branches: [ "master" ]
  workflow_dispatch:

jobs:
  build-and-package:
    runs-on: ubuntu-latest

    steps:
    - name: Checkout the repository at the base commit
      uses: actions/checkout@v4
      with:
        ref: f891074a0f1c9d61a3dfa53749265f8c14ed4ee6

    - name: Set up Git user
      run: |
        git config --global user.name "GitHub Actions"
        git config --global user.email "actions@github.com"
    - name: Fetch the latest changes
      run: git fetch origin

    - name: Cherry-pick commit 9c66ef2
      run: |
        git cherry-pick 9c66ef27a8f834c538430d17abaf14af32ee34e2 || (
          echo "Conflict occurred during cherry-pick of commit 9c66ef2" && git cherry-pick --abort
        )
    - name: Cherry-pick commit 35787aa
      run: |
        git cherry-pick 35787aa9ad33dc27448f1af68a0a5bfdde4fffba || (
          echo "Conflict occurred during cherry-pick of commit 35787aa" && git cherry-pick --abort
        )
    - name: Cherry-pick commit ede72ec
      run: |
        git cherry-pick ede72eca10cd8a19af90adc716e264c53c2f474d || (
          echo "Conflict occurred during cherry-pick of commit ede72ec" && git cherry-pick --abort
        )
    - name: Cherry-pick commit 1ed936f
      run: |
        git cherry-pick 1ed936f2d398c12c04b570f7cd3ad251c39bb483 || (
          echo "Conflict occurred during cherry-pick of commit 1ed936f" && git cherry-pick --abort
        )
    - name: Cherry-pick commit 163b38b
      run: |
        git cherry-pick 163b38b20779149967e5cf78f2300fbef790dc2b || (
          echo "Conflict occurred during cherry-pick of commit 163b38b" && git cherry-pick --abort
        )
    - name: Cherry-pick commit e71eacf
      run: |
        git cherry-pick e71eacfa550ac9a092903ecc24feba9ae32ebaae || (
          echo "Conflict occurred during cherry-pick of commit e71eacf" && git cherry-pick --abort
        )
    - name: Cherry-pick commit 4f354f4
      run: |
        git cherry-pick 4f354f4d034a88230e6cabbc1f84ff0d9a4556ae || (
          echo "Conflict occurred during cherry-pick of commit 4f354f4" && git cherry-pick --abort
        )
    - name: Cherry-pick commit 1ed936f
      run: |
        git cherry-pick 1ed936f2d398c12c04b570f7cd3ad251c39bb483 || (
          echo "Conflict occurred during cherry-pick of commit 1ed936f" && git cherry-pick --abort
        )
    - name: Cherry-pick commit 163b38b
      run: |
        git cherry-pick 163b38b20779149967e5cf78f2300fbef790dc2b || (
          echo "Conflict occurred during cherry-pick of commit 163b38b" && git cherry-pick --abort
        )
    - name: Cherry-pick commit e71eacf
      run: |
        git cherry-pick e71eacfa550ac9a092903ecc24feba9ae32ebaae || (
          echo "Conflict occurred during cherry-pick of commit e71eacf" && git cherry-pick --abort
        )
    - name: Cherry-pick commit c0ab97d
      run: |
        git cherry-pick c0ab97ddd1a0f792c8afb7a061135bc7c87f5854 || (
          echo "Conflict occurred during cherry-pick of commit c0ab97d" && git cherry-pick --abort
        )

    - name: Cherry-pick commit c0ab97d
      run: |
        git cherry-pick c0ab97ddd1a0f792c8afb7a061135bc7c87f5854 || (
          echo "Conflict occurred during cherry-pick of commit c0ab97d" && git cherry-pick --abort
        )

    - name: Cherry-pick commit 55f4f77
      run: |
        git cherry-pick -m 1 55f4f773498a294d35fe5d26a6fd5909dda8d57f || (
          echo "Conflict occurred during cherry-pick of commit 55f4f77" && git cherry-pick --abort
        )
    - name: Cherry-pick commit dc78afc
      run: |
        git cherry-pick -m 1 dc78afcfe9e8cf0dd027e8dd30e21bebf101ffaa || (
          echo "Conflict occurred during cherry-pick of commit dc78afc" && git cherry-pick --abort
        )

    - name: Run CMake and Build
      run: |
        cmake -DCMAKE_INSTALL_PREFIX=$HOME/.local -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="-g -fsanitize=address,undefined -fno-omit-frame-pointer -Wall" -Wno-dev Build/Cmake
        make -j10
    - name: Install the Build
      run: make install

    - name: Set executable permissions for binaries
      run: |
        find $HOME/.local/bin -type f -exec chmod +x {} \;
    - name: Package build outputs
      run: |
        mkdir -p build_artifacts/bin
        mkdir -p build_artifacts/lib
        cp -r $HOME/.local/bin/* build_artifacts/bin/
        cp -r $HOME/.local/lib/* build_artifacts/lib/
        cp -r $HOME/.local/include build_artifacts/include
    - name: Upload build artifacts
      uses: actions/upload-artifact@v4
      with:
        name: build-artifacts
        path: build_artifacts/

Bisect

git bisect bad b90ac3933da99179df26351c39d8d9d706ac1cc6

For those looking to bypass the Compile Issues, I posted Ubuntu x86_64, macos x86_64 and arm64 packages at URL https://github.com/xsscx/PatchIccMAX/tags

TahomaSoft commented 3 months ago

Thank you! Those directions pretty much worked; I needed to add a 'cd Build' statement and it cranked right along.

Erik

TahomaSoft commented 3 months ago

However, when I install and try to run the just-built binaries, I get the following errors: ./iccTiffDump: error while loading shared libraries: libIccProfLib2.so.2: cannot open shared object file: No such file or directory

./iccToXml ./iccToXml: error while loading shared libraries: libIccXML2.so.2: cannot open shared object file: No such file or directory

Those shared libraries don't seem to be built using the recipe provided above.

Thanks,

Erik

xsscx commented 3 months ago

Hello @TahomaSoft

Thank you for pointing out my CopyPasta error for the Build Instructions. My bad, I have edited and corrected the Path.

Good to hear you got a good compile.

I will update with results shortly.

xsscx commented 3 months ago

Hello @TahomaSoft

Thank you again for providing valuable feedback with respect to the Ubuntu Binaries and my needing to properly document the reproduction steps to download and run the package without friction.

Summary

My Ubuntu Package lacked proper instructions to download and install the binaries. I have updated the Instruction and have tested the following CopyPasta on Bare Metal and WSL with Success.

Reproduction

Host

Fri Aug  2 16:30:09 EDT 2024
Linux 5.15.153.1-microsoft-standard-WSL2 #1 SMP Fri Mar 29 23:14:13 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

Example

cd /tmp
wget https://github.com/xsscx/PatchIccMAX/releases/download/ubuntu-x86_64/DemoIccMAX-ubuntu-commit-dc78afcfe9e8cf0dd027e8dd30e21bebf101ffaa-x86_64.zip
unzip DemoIccMAX-ubuntu-commit-dc78afcfe9e8cf0dd027e8dd30e21bebf101ffaa-x86_64.zip
export LD_LIBRARY_PATH=$(pwd)/lib:$LD_LIBRARY_PATH
chmod +x bin/*
for binary in bin/*; do echo "Testing $binary"; output=$($binary 2>&1); if [[ $binary == *"iccSpecSepToTiff"* ]]; then echo "$output" | grep "Usage" && echo "$binary works!" || echo "$binary failed!"; else echo "$output" | grep "2.2.3" && echo "$binary works!" || echo "$binary failed!"; fi; done

Expected Output

Testing bin/iccApplyNamedCmm
iccApplyNamedCmm built with IccProfLib version 2.2.3
Built with IccProfLib version 2.2.3
iccApplyNamedCmm built with IccProfLib version 2.2.3
Built with IccProfLib version 2.2.3
Testing bin/iccApplyProfiles
iccApplyProfiles built with IccProfLib version 2.2.3
Testing bin/iccDumpProfile
Built with IccProfLib version 2.2.3
iccDumpProfile built with IccProfLib version 2.2.3
Built with IccProfLib version 2.2.3
iccDumpProfile built with IccProfLib version 2.2.3
Testing bin/iccFromXml
IccFromXml built with IccProfLib Version 2.2.3, IccLibXML Version 2.2.3
Testing bin/iccRoundTrip
Built with IccProfLib version 2.2.3
Testing bin/iccSpecSepToTiff
Usage: SpecSep2Tiff output_file compress_flag sep_flag infile_fmt_file start_nm end_nm inc_nm [embedded_icc_profile_file]
Testing bin/iccTiffDump
iccTiffDump built with IccProfLib version 2.2.3
Testing bin/iccToXml
IccToXml built with IccProfLib Version 2.2.3, IccLibXML Version 2.2.3

If I can provide any additional information or help to compile etc, please update the Issue.

xsscx commented 3 months ago

Windows Build Instructions

# Step 1: Set up vcpkg for dependency management
# Change to the temporary directory
cd \tmp

# Clone the vcpkg repository from GitHub
git clone https://github.com/microsoft/vcpkg.git

# Change to the vcpkg directory
cd vcpkg

# Bootstrap vcpkg to set it up
.\bootstrap-vcpkg.bat

# Install necessary dependencies using vcpkg
.\vcpkg.exe install libxml2:x64-windows tiff:x64-windows wxwidgets:x64-windows

# Step 2: Clone the DemoIccMAX repository
# Change back to the temporary directory
cd \tmp

# Clone the DemoIccMAX repository from GitHub
git clone https://github.com/InternationalColorConsortium/DemoIccMAX.git

# Change to the DemoIccMAX directory
cd DemoIccMAX

# Revert a specific commit (b90ac3933da99179df26351c39d8d9d706ac1cc6) if necessary
git revert b90ac3933da99179df26351c39d8d9d706ac1cc6

# Step 3: Build the solution
# Clean the build for the entire solution (BuildAll_v19.sln) for Debug configuration and x64 platform
"C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\Bin\MSBuild.exe" .\Build\MSVC\BuildAll_v19.sln /t:clean /p:Configuration=Debug /p:Platform=x64

# Build the entire solution (BuildAll_v19.sln) for Debug configuration and x64 platform
"C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\Bin\MSBuild.exe" .\Build\MSVC\BuildAll_v19.sln /p:Configuration=Debug /p:Platform=x64

# Step 4: Manually build IccApplyToLink with AddressSanitizer
# Clean the IccApplyToLink project for Debug configuration and x64 platform with AddressSanitizer enabled
"C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\Bin\MSBuild.exe" .\Tools\CmdLine\IccApplyToLink\iccApplyToLink_v16.vcxproj /t:clean /p:Configuration=Debug /p:Platform=x64 /p:CLToolAdditionalOptions="/fsanitize=address" /p:LinkToolAdditionalOptions="/fsanitize=address"

# Build the IccApplyToLink project for Debug configuration and x64 platform with AddressSanitizer enabled
"C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\Bin\MSBuild.exe" .\Tools\CmdLine\IccApplyToLink\iccApplyToLink_v16.vcxproj /p:Configuration=Debug /p:Platform=x64 /p:CLToolAdditionalOptions="/fsanitize=address" /p:LinkToolAdditionalOptions="/fsanitize=address"

# Step 5: Manually build IccFromCube with AddressSanitizer
# Clean the IccFromCube project for Debug configuration and x64 platform with AddressSanitizer enabled
"C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\Bin\MSBuild.exe" .\Tools\CmdLine\IccFromCube\iccFromCube_v16.vcxproj /t:clean /p:Configuration=Debug /p:Platform=x64 /p:CLToolAdditionalOptions="/fsanitize=address" /p:LinkToolAdditionalOptions="/fsanitize=address"

# Build the IccFromCube project for Debug configuration and x64 platform with AddressSanitizer enabled
"C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\Bin\MSBuild.exe" .\Tools\CmdLine\IccFromCube\iccFromCube_v16.vcxproj /p:Configuration=Debug /p:Platform=x64 /p:CLToolAdditionalOptions="/fsanitize=address" /p:LinkToolAdditionalOptions="/fsanitize=address"
xsscx commented 3 months ago

Closing this Issue given PR https://github.com/InternationalColorConsortium/DemoIccMAX/pull/87

TahomaSoft commented 3 months ago

Thank you! I'll test it again.