harperreed / lrprev-extract-go

0 stars 0 forks source link

sweep: Figure out why PR #13 doesn't build on linux #16

Closed harperreed closed 1 month ago

harperreed commented 1 month ago

Error Logs

2024-10-22T02:38:44.9264955Z ##[group]Run go test -v  ./... -coverprofile=coverage.out -covermode=atomic
2024-10-22T02:38:44.9265635Z go test -v  ./... -coverprofile=coverage.out -covermode=atomic
2024-10-22T02:38:44.9316910Z shell: /usr/bin/bash -e {0}
2024-10-22T02:38:44.9317222Z env:
2024-10-22T02:38:44.9317439Z   OPENAI_API_KEY: 
2024-10-22T02:38:44.9317694Z ##[endgroup]
2024-10-22T02:38:58.1018711Z # github.com/go-gl/gl/v2.1/gl
2024-10-22T02:38:58.1019777Z # [pkg-config --cflags  -- gl gl]
2024-10-22T02:38:58.1020666Z Package gl was not found in the pkg-config search path.
2024-10-22T02:38:58.1021532Z Perhaps you should add the directory containing `gl.pc'
2024-10-22T02:38:58.1022336Z to the PKG_CONFIG_PATH environment variable
2024-10-22T02:38:58.1023189Z Package 'gl', required by 'virtual:world', not found
2024-10-22T02:38:58.1024066Z Package 'gl', required by 'virtual:world', not found
2024-10-22T02:38:59.7218523Z # github.com/go-gl/glfw/v3.3/glfw
2024-10-22T02:38:59.7219359Z In file included from ./glfw/src/internal.h:188,
2024-10-22T02:38:59.7220340Z                  from ./glfw/src/context.c:30,
2024-10-22T02:38:59.7222701Z                  from ../../../go/pkg/mod/github.com/go-gl/glfw/v3.3/glfw@v0.0.0-20240506104042-037f3cc74f2a/c_glfw.go:4:
2024-10-22T02:38:59.7224372Z ./glfw/src/x11_platform.h:36:10: fatal error: X11/Xcursor/Xcursor.h: No such file or directory
2024-10-22T02:38:59.7225563Z    36 | #include <X11/Xcursor/Xcursor.h>
2024-10-22T02:38:59.7226312Z       |          ^~~~~~~~~~~~~~~~~~~~~~~
2024-10-22T02:38:59.7227380Z compilation terminated.
2024-10-22T02:39:34.9989034Z FAIL   lrprev-extract-go/cmd/lrprev-extract [build failed]
2024-10-22T02:39:35.0031520Z === RUN   TestValidatePath
2024-10-22T02:39:35.0039738Z --- PASS: TestValidatePath (0.00s)
2024-10-22T02:39:35.0040337Z PASS
2024-10-22T02:39:35.0040753Z coverage: 22.7% of statements
2024-10-22T02:39:35.0041736Z ok     lrprev-extract-go/internal/cli  0.003s  coverage: 22.7% of statements
2024-10-22T02:39:35.3029216Z === RUN   TestGetOriginalFilePathSuccess
2024-10-22T02:39:35.3030381Z --- PASS: TestGetOriginalFilePathSuccess (0.00s)
2024-10-22T02:39:35.3031171Z === RUN   TestGetOriginalFilePathNoEntry
2024-10-22T02:39:35.3031997Z --- PASS: TestGetOriginalFilePathNoEntry (0.00s)
2024-10-22T02:39:35.3032776Z === RUN   TestGetOriginalFilePathDatabaseError
2024-10-22T02:39:35.3033700Z --- PASS: TestGetOriginalFilePathDatabaseError (0.00s)
2024-10-22T02:39:35.3034542Z === RUN   TestGetOriginalFilePathQueryError
2024-10-22T02:39:35.3035425Z --- PASS: TestGetOriginalFilePathQueryError (0.00s)
2024-10-22T02:39:35.3036119Z PASS
2024-10-22T02:39:35.3036499Z coverage: 50.0% of statements
2024-10-22T02:39:35.3037457Z ok     lrprev-extract-go/internal/database 0.004s  coverage: 50.0% of statements
2024-10-22T02:39:35.4009104Z === RUN   TestExtractLargestJPEGFromLRPREV_Success
2024-10-22T02:39:35.4010637Z Reading file: /tmp/lrprev_test1666423327/test-12345678-1234-1234-1234-123456789012.lrprev
2024-10-22T02:39:35.4011812Z Extracting UUID from filename
2024-10-22T02:39:35.4012316Z Searching for JPEG data
2024-10-22T02:39:35.4012802Z Creating output directory: /tmp/lrprev_test1666423327
2024-10-22T02:39:35.4014032Z Writing JPEG file: /tmp/lrprev_test1666423327/12345678-1234-1234-1234-123456789012.jpg
2024-10-22T02:39:35.4015221Z JPEG image extracted and saved to /tmp/lrprev_test1666423327/12345678-1234-1234-1234-123456789012.jpg
2024-10-22T02:39:35.4016216Z --- PASS: TestExtractLargestJPEGFromLRPREV_Success (0.00s)
2024-10-22T02:39:35.4017218Z === RUN   TestExtractLargestJPEGFromLRPREV_InvalidFilePath
2024-10-22T02:39:35.4018212Z Reading file: non_existent_file.lrprev
2024-10-22T02:39:35.4019402Z --- PASS: TestExtractLargestJPEGFromLRPREV_InvalidFilePath (0.00s)
2024-10-22T02:39:35.4020552Z === RUN   TestExtractLargestJPEGFromLRPREV_NoValidJPEG
2024-10-22T02:39:35.4021318Z Reading file: /tmp/lrprev_test3806338023/test-12345678-1234-1234-1234-123456789012.lrprev
2024-10-22T02:39:35.4021908Z Extracting UUID from filename
2024-10-22T02:39:35.4022912Z Searching for JPEG data
2024-10-22T02:39:35.4023797Z --- PASS: TestExtractLargestJPEGFromLRPREV_NoValidJPEG (0.00s)
2024-10-22T02:39:35.4024774Z === RUN   TestExtractLargestJPEGFromLRPREV_WithDatabase
2024-10-22T02:39:35.4026029Z Reading file: /tmp/lrprev_test1826876090/test-12345678-1234-1234-1234-123456789012.lrprev
2024-10-22T02:39:35.4027026Z Extracting UUID from filename
2024-10-22T02:39:35.4027564Z Searching for JPEG data
2024-10-22T02:39:35.4028165Z Querying Lightroom database for original file path
2024-10-22T02:39:35.4029241Z Creating output directory: /tmp/lrprev_test1826876090/absolute/path/path/from/root
2024-10-22T02:39:35.4030518Z Writing JPEG file: /tmp/lrprev_test1826876090/absolute/path/path/from/root/test.jpg
2024-10-22T02:39:35.4031919Z JPEG image extracted and saved to /tmp/lrprev_test1826876090/absolute/path/path/from/root/test.jpg
2024-10-22T02:39:35.4033401Z --- PASS: TestExtractLargestJPEGFromLRPREV_WithDatabase (0.01s)
2024-10-22T02:39:35.4034373Z === RUN   TestExtractLargestJPEGFromLRPREV_WithoutDatabase
2024-10-22T02:39:35.4035608Z Reading file: /tmp/lrprev_test2841693477/test-12345678-1234-1234-1234-123456789012.lrprev
2024-10-22T02:39:35.4036565Z Extracting UUID from filename
2024-10-22T02:39:35.4037087Z Searching for JPEG data
2024-10-22T02:39:35.4037690Z Creating output directory: /tmp/lrprev_test2841693477
2024-10-22T02:39:35.4038844Z Writing JPEG file: /tmp/lrprev_test2841693477/12345678-1234-1234-1234-123456789012.jpg
2024-10-22T02:39:35.4040381Z JPEG image extracted and saved to /tmp/lrprev_test2841693477/12345678-1234-1234-1234-123456789012.jpg
2024-10-22T02:39:35.4042028Z --- PASS: TestExtractLargestJPEGFromLRPREV_WithoutDatabase (0.00s)
2024-10-22T02:39:35.4042996Z === RUN   TestExtractLargestJPEGFromLRPREV_IncludeSize
2024-10-22T02:39:35.4044197Z Reading file: /tmp/lrprev_test814888336/test-12345678-1234-1234-1234-123456789012.lrprev
2024-10-22T02:39:35.4045151Z Extracting UUID from filename
2024-10-22T02:39:35.4045674Z Searching for JPEG data
2024-10-22T02:39:35.4046285Z Creating output directory: /tmp/lrprev_test814888336
2024-10-22T02:39:35.4046993Z Decoding JPEG dimensions
2024-10-22T02:39:35.4047987Z Writing JPEG file: /tmp/lrprev_test814888336/12345678-1234-1234-1234-123456789012_16x16.jpg
2024-10-22T02:39:35.4049586Z JPEG image extracted and saved to /tmp/lrprev_test814888336/12345678-1234-1234-1234-123456789012_16x16.jpg
2024-10-22T02:39:35.4050974Z --- PASS: TestExtractLargestJPEGFromLRPREV_IncludeSize (0.00s)
2024-10-22T02:39:35.4051903Z === RUN   TestExtractLargestJPEGFromLRPREV_ExcludeSize
2024-10-22T02:39:35.4053103Z Reading file: /tmp/lrprev_test707673678/test-12345678-1234-1234-1234-123456789012.lrprev
2024-10-22T02:39:35.4054047Z Extracting UUID from filename
2024-10-22T02:39:35.4054560Z Searching for JPEG data
2024-10-22T02:39:35.4055163Z Creating output directory: /tmp/lrprev_test707673678
2024-10-22T02:39:35.4056313Z Writing JPEG file: /tmp/lrprev_test707673678/12345678-1234-1234-1234-123456789012.jpg
2024-10-22T02:39:35.4058274Z JPEG image extracted and saved to /tmp/lrprev_test707673678/12345678-1234-1234-1234-123456789012.jpg
2024-10-22T02:39:35.4059605Z --- PASS: TestExtractLargestJPEGFromLRPREV_ExcludeSize (0.00s)
2024-10-22T02:39:35.4060346Z PASS
2024-10-22T02:39:35.4060721Z coverage: 84.4% of statements
2024-10-22T02:39:35.4061682Z ok     lrprev-extract-go/internal/extractor    0.015s  coverage: 84.4% of statements
2024-10-22T02:39:35.4062629Z === RUN   TestExtractUUIDFromFilename
2024-10-22T02:39:35.4063457Z === RUN   TestExtractUUIDFromFilename/Valid_filename_with_UUID
2024-10-22T02:39:35.4064387Z === RUN   TestExtractUUIDFromFilename/Filename_without_UUID
2024-10-22T02:39:35.4065376Z === RUN   TestExtractUUIDFromFilename/Filename_with_invalid_UUID_format
2024-10-22T02:39:35.4066321Z === RUN   TestExtractUUIDFromFilename/Empty_filename
2024-10-22T02:39:35.4067231Z === RUN   TestExtractUUIDFromFilename/Filename_with_multiple_UUIDs
2024-10-22T02:39:35.4068297Z === RUN   TestExtractUUIDFromFilename/Filename_with_UUID_not_in_base_name
2024-10-22T02:39:35.4069508Z --- PASS: TestExtractUUIDFromFilename (0.00s)
2024-10-22T02:39:35.4070638Z     --- PASS: TestExtractUUIDFromFilename/Valid_filename_with_UUID (0.00s)
2024-10-22T02:39:35.4071929Z     --- PASS: TestExtractUUIDFromFilename/Filename_without_UUID (0.00s)
2024-10-22T02:39:35.4073321Z     --- PASS: TestExtractUUIDFromFilename/Filename_with_invalid_UUID_format (0.00s)
2024-10-22T02:39:35.4074599Z     --- PASS: TestExtractUUIDFromFilename/Empty_filename (0.00s)
2024-10-22T02:39:35.4075878Z     --- PASS: TestExtractUUIDFromFilename/Filename_with_multiple_UUIDs (0.00s)
2024-10-22T02:39:35.4077338Z     --- PASS: TestExtractUUIDFromFilename/Filename_with_UUID_not_in_base_name (0.00s)
2024-10-22T02:39:35.4078211Z PASS
2024-10-22T02:39:35.4078591Z coverage: 100.0% of statements
2024-10-22T02:39:35.4079525Z ok     lrprev-extract-go/internal/utils    0.003s  coverage: 100.0% of statements
2024-10-22T02:39:35.4080356Z FAIL

Resolve Linux build failure in PR #13 due to missing OpenGL dependencies

Description:

PR #13 is failing to build on Linux due to missing OpenGL and X11 dependencies. The error logs indicate that the required packages for OpenGL and X11 are not found in the build environment.

Tasks:

Additional Information:

The main errors are:

These errors suggest that the OpenGL and X11 development libraries are missing in the Linux build environment.

sweep-ai[bot] commented 1 month ago

🚀 Here's the PR! #18

Sweeping

Search Results

Response

Certainly! I'll address the user's request to resolve the Linux build failure in PR #13 due to missing OpenGL dependencies. Let's go through the tasks and implement the necessary changes.

File & User Request Examination

The issue stems from newly introduced OpenGL dependencies in PR #13, which are not available in the Linux build environment. The main errors are related to missing OpenGL and X11 development packages. To resolve this, we need to update the README.md with installation instructions and modify the GitHub Actions workflow to install these dependencies before running the tests.

Implement the User's Request

Let's make the necessary changes to resolve the build failure:

  1. Update the README.md file to include instructions for installing OpenGL and X11 development packages on Linux.

README.md

--- 
+++ 
@@ -1,6 +1,9 @@
 ### Prerequisites
 - Go 1.23.2 or later
 - Access to a Lightroom catalog (`.lrcat`) if you want to structure your output by original paths.
+- For Linux users:
+  - OpenGL development libraries
+  - X11 development libraries

 ### Installation
 1. Clone the repository:
@@ -9,7 +12,20 @@
     cd lrprev-extract-go

-2. Compile the code: +2. For Linux users, install the required development packages:


2. Update the GitHub Actions workflow file to install the necessary dependencies before running the tests.

#### `.github/workflows/go-tests.yaml`
```diff
--- 
+++ 
@@ -51,6 +51,10 @@
               uses: actions/setup-go@v4.0.1
               with:
                   go-version: "1.21"
+            - name: Install OpenGL and X11 dependencies
+              run: |
+                sudo apt-get update
+                sudo apt-get install -y libgl1-mesa-dev xorg-dev
             - name: Cache Go modules
               uses: actions/cache@v3.3.1
               with:
@@ -92,6 +96,10 @@
               uses: actions/setup-go@v4.0.1
               with:
                   go-version: "1.21"
+            - name: Install OpenGL and X11 dependencies
+              run: |
+                sudo apt-get update
+                sudo apt-get install -y libgl1-mesa-dev xorg-dev
             - name: Cache Go modules
               uses: actions/cache@v3.3.1
               with:
  1. Update the go.mod file to include the new OpenGL dependencies.

go.mod

--- 
+++ 
@@ -7,6 +7,8 @@
 require github.com/DATA-DOG/go-sqlmock v1.5.2

 require (
+   github.com/go-gl/gl v0.0.0-20211210172815-726fda9656d6
+   github.com/go-gl/glfw/v3.3/glfw v0.0.0-20240307211618-a69d953ea142
    github.com/schollz/progressbar/v3 v3.16.1
    github.com/stretchr/testify v1.9.0
 )

These changes should resolve the Linux build failure in PR #13 by addressing the missing OpenGL dependencies. Here's a summary of the changes:

  1. Updated the README.md file to include instructions for installing OpenGL and X11 development packages on Linux.
  2. Modified the GitHub Actions workflow file (.github/workflows/go-tests.yaml) to install the necessary dependencies before running the tests.
  3. Updated the go.mod file to include the new OpenGL and GLFW dependencies.

These changes should allow the project to build and run successfully on Linux environments, resolving the issues encountered in PR #13.

Continue the conversation with Sweep here: https://app.sweep.dev/c/1b085ef1-e7cf-465f-a827-18aea6f1448e.

:book: For more information on how to use Sweep, please read our documentation.

Tracking ID: d8fc95a94c