TileDB icon indicating copy to clipboard operation
TileDB copied to clipboard

libmagic

Open OgreTransporter opened this issue 3 years ago • 2 comments

I have found a new error with libmagic. The error message is:

mgc_dict.cc(41,10): fatal error C1083: Datei (Include) kann nicht geöffnet werden: "magic_mgc_gzipped.bin": No such file or directory

The error is in line 370 of the file tiledb/CMakeLists.txt. https://github.com/TileDB-Inc/TileDB/blob/6ec6f5b2c1da76e80f268d0f085e15f79821b4a2/tiledb/CMakeLists.txt#L370

Here is a small test in line 371:

message(STATUS "Debug: ${MGC_GZIPPED_BIN_OUTPUT_DIRECTORY}")

Result in CMake output:

-- Debug: /install/include

This means ${TILEDB_EP_BASE} is not yet defined in line 370, which leads to an error.

I suggest the following change:

diff --git a/tiledb/CMakeLists.txt b/tiledb/CMakeLists.txt
index 7b9bd6da3..ce499f9fd 100644
--- a/tiledb/CMakeLists.txt
+++ b/tiledb/CMakeLists.txt
@@ -366,8 +366,7 @@ target_link_libraries(TILEDB_CORE_OBJECTS PRIVATE $<BUILD_INTERFACE:common>)
 ############################################################
 # provide actions/target for preparation of magic.mgc data for embedding/build

-#set(MGC_GZIPPED_BIN_PATH3 "${CMAKE_CURRENT_SOURCE_DIR}/sm/misc/magic_mgc_gzipped.bin")
-set(MGC_GZIPPED_BIN_OUTPUT_DIRECTORY "${TILEDB_EP_BASE}/install/include")
+set(MGC_GZIPPED_BIN_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/..")
 set(MGC_GZIPPED_BIN_OUTPUT_FILE "${MGC_GZIPPED_BIN_OUTPUT_DIRECTORY}/magic_mgc_gzipped.bin")
 set(MGC_GZIPPED_BIN_INPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/sm/misc")
 set(MGC_GZIPPED_BIN_INPUT_FILE "${MGC_GZIPPED_BIN_INPUT_DIRECTORY}/magic_mgc_gzipped.bin.tar.bz2")

In line 401 the directory ${CMAKE_CURRENT_BINARY_DIR}/.. is added to the project, so nothing else needs to be changed.

target_include_directories(TILEDB_CORE_OBJECTS
  PRIVATE
    "${TILEDB_CORE_INCLUDE_DIR}"
    "${TILEDB_CORE_INCLUDE_DIR}/tiledb/sm/c_api"
    "${TILEDB_EXTERNALS_INCLUDE_DIRS}"
	# to pickup <build_dir>/tiledb for capnp gen'd files
    "${CMAKE_CURRENT_BINARY_DIR}/.."
)

OgreTransporter avatar Aug 07 '22 19:08 OgreTransporter

Thanks for opening the issue, and for moving on with a PR.

I have found a new error with libmagic.

Can you provide additional detail on how you found that error? What command on which OS failed for your?

TileDB builds and tests fine for us on a variety of platforms and tasks, so maybe you attempted something different? To help with your issue, and to assess if a PR such as the one you submitted in #3431 is needed, we likely need additional information.

eddelbuettel avatar Aug 08 '22 02:08 eddelbuettel

Can you provide additional detail on how you found that error? What command on which OS failed for your?

I have a script to compile GDAL with its dependencies (like TileDB) on Windows. The script has now failed on TileDB with the given error message.

  • Visual Studio 2022
  • CMake 3.23.1
  • Windows 10

The problem is, as already described, the CMake variable TILEDB_EP_BASE. If you do not set TILEDB_CMAKE_IDE or TILEDB_SUPERBUILD, TILEDB_EP_BASE will not be set either. So if you build TileDB normally with CMake over the command line with own dependencies. If you go through the CMake scripts one by one by hand you will find the error.

The alternative to my patch would be to set a default value for TILEDB_EP_BASE and then override that on TILEDB_CMAKE_IDE and TILEDB_SUPERBUILD.

OgreTransporter avatar Aug 08 '22 05:08 OgreTransporter

Merged #3431 to resolve this, please let us know if any further follow-up needed.

ihnorton avatar Mar 20 '23 02:03 ihnorton