Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Offline Build Support #706

Open
1 task done
cranst0n opened this issue Jan 21, 2025 · 2 comments
Open
1 task done

Offline Build Support #706

cranst0n opened this issue Jan 21, 2025 · 2 comments
Labels
enhancement New feature or request

Comments

@cranst0n
Copy link

Is there an existing issue?

Use case

I'm trying to build an app using object box on an air gapped Linux machine.

Proposed solution

Add configuration/documentation on how to manually download the required native libraries so the build process doesn't fail on unreachable network.

Describe alternatives you've considered

Vendoring the entire plugin and modifying the flutter_libs/linux/CMakeLists.txt to find required deps locally.

Additional context

[1/9] Performing download step (download, verify and extract) for 'objectbox-download-populate'
-- Downloading...
   dst='/home/brandy/fmc_gui/build/linux/x64/release/_deps/objectbox-download-subbuild/objectbox-download-populate-prefix/src/objectbox-linux-x64.tar.gz'
   timeout='none'
   inactivity timeout='none'
-- Using src='https://github.com/objectbox/objectbox-c/releases/download/v4.0.2/objectbox-linux-x64.tar.gz'
-- Retrying...
...
-- Retry after 60 seconds (attempt #5) ...
-- Using src='https://github.com/objectbox/objectbox-c/releases/download/v4.0.2/objectbox-linux-x64.tar.gz'
CMake Error at objectbox-download-subbuild/objectbox-download-populate-prefix/src/objectbox-download-populate-stamp/download-objectbox-download-populate.cmake:170 (message):
  Each download failed!
@cranst0n cranst0n added the enhancement New feature or request label Jan 21, 2025
@greenrobot-team
Copy link
Member

Thanks for your suggestion!

build an app using object box on an air gapped Linux machine

As I guess this is a rather rare use case (building with Flutter offline is likely not that easy?) we likely won't spend time on explicitly supporting this. But if anyone else is interested, please thumbs up the first comment!

If it helps (maybe using some sort of CMake caching, or a proxy that caches dependencies?) you can look at the CMakeLists file of the ObjectBox Flutter plugin. It downloads the native library as part of the setup process:

FetchContent_Declare(
objectbox-download
URL https://github.com/objectbox/objectbox-c/releases/download/v${OBJECTBOX_VERSION}/objectbox-linux-${OBJECTBOX_ARCH}.tar.gz
)

@cranst0n
Copy link
Author

For the curious, here's how I achieved an offline linux build:

  1. vendoring the objectbox_flutter_libs package
  2. Downloading: https://github.com/objectbox/objectbox-c/releases/download/v4.0.2/objectbox-linux-x64.tar.gz
  3. Unpacking the tarball to directory lib/linux/native
  4. modifying linux/CMakeLists.txt
...

# include(FetchContent)
# FetchContent_Declare(
#     objectbox-download
#     URL https://github.com/objectbox/objectbox-c/releases/download/v${OBJECTBOX_VERSION}/objectbox-linux-${OBJECTBOX_ARCH}.tar.gz
# )
# 
# FetchContent_GetProperties(objectbox-download)
# if(NOT objectbox-download_POPULATED)
#   FetchContent_Populate(objectbox-download)
# endif()

include_directories(native)

# ----------------------------------------------------------------------

# List of absolute paths to libraries that should be bundled with the plugin.
# This list could contain prebuilt libraries, or libraries created by an
# external build triggered from this build file.

# Note: do not link the ObjectBox C library; the Dart library looks for it in a lib subfolder
# where flutter build puts it when added below.
set(objectbox_flutter_libs_bundled_libraries
    "${CMAKE_CURRENT_SOURCE_DIR}/native/lib/${CMAKE_SHARED_LIBRARY_PREFIX}objectbox${CMAKE_SHARED_LIBRARY_SUFFIX}"
    PARENT_SCOPE
)

I used the same basic process for an offline build on windows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants