bugra9 / gdal3.js

Convert raster and vector geospatial data to various formats and coordinate systems entirely in the browser.
https://gdal3.js.org
GNU Lesser General Public License v2.1
300 stars 45 forks source link

Disable OGR GPSBabel driver #66

Closed rouault closed 5 months ago

rouault commented 5 months ago

This driver requires the gpsbabel binary to be present on the system to be effective, which is obviously not compatible of WASM builds

(out of curiosity, why did you have to disable the PDS driver ?)

bugra9 commented 5 months ago

@rouault, thank you for the PR.

out of curiosity, why did you have to disable the PDS driver ?

In Emscripten version 3.1.7, Gdal compiled with PDS without any issues, but in version 3.1.50 I got the following error.

/gdal3.js/build/native/src/gdal-3.8.3/frmts/pds/pds4vector.cpp:2578:30: instantiating function definition 'PDS4EditableSynchronizer<PDS4FixedWidthTable>::EditableSyncToDisk'
em++: warning: linker setting ignored during compilation: 'ERROR_ON_UNDEFINED_SYMBOLS' [-Wunused-command-line-argument]
 #0 0x00005621a83802c8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/emsdk/upstream/bin/clang+++0x2d372c8)
 #1 0x00005621a837d8fe llvm::sys::RunSignalHandlers() (/emsdk/upstream/bin/clang+++0x2d348fe)
 #2 0x00005621a837f53e llvm::sys::CleanupOnSignal(unsigned long) (/emsdk/upstream/bin/clang+++0x2d3653e)
 #3 0x00005621a82df739 CrashRecoverySignalHandler(int) (.llvm.12752040521537353075) CrashRecoveryContext.cpp:0:0
 #4 0x00007f08e7f33710 (/usr/lib/libc.so.6+0x3e710)
 #5 0x00005621aafa1546 clang::ASTContext::getRawCommentForDeclNoCacheImpl(clang::Decl const*, clang::SourceLocation, std::__2::map<unsigned int, clang::RawComment*, std::__2::less<unsigned int>, std::__2::allocator<std::__2::pair<unsigned int const, clang::RawComment*>>> const&) const (/emsdk/upstream/bin/clang+++0x5958546)
 #6 0x00005621aafa2345 clang::ASTContext::attachCommentsToJustParsedDecls(llvm::ArrayRef<clang::Decl*>, clang::Preprocessor const*) (/emsdk/upstream/bin/clang+++0x5959345)
 #7 0x00005621aa4944e1 clang::Sema::ActOnStartOfFunctionDef(clang::Scope*, clang::Decl*, clang::Sema::SkipBodyInfo*, clang::Sema::FnBodyKind) (/emsdk/upstream/bin/clang+++0x4e4b4e1)
 #8 0x00005621aad18851 clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation, clang::FunctionDecl*, bool, bool, bool) (/emsdk/upstream/bin/clang+++0x56cf851)
 #9 0x00005621aad1c46c clang::Sema::PerformPendingInstantiations(bool) (/emsdk/upstream/bin/clang+++0x56d346c)
#10 0x00005621aa24c033 clang::Sema::ActOnEndOfTranslationUnitFragment(clang::Sema::TUFragmentKind) (/emsdk/upstream/bin/clang+++0x4c03033)
#11 0x00005621aa24c738 clang::Sema::ActOnEndOfTranslationUnit() (/emsdk/upstream/bin/clang+++0x4c03738)
#12 0x00005621aa0ebdb7 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/emsdk/upstream/bin/clang+++0x4aa2db7)
#13 0x00005621aa0e6f0e clang::ParseAST(clang::Sema&, bool, bool) (/emsdk/upstream/bin/clang+++0x4a9df0e)
#14 0x00005621a90e1731 clang::FrontendAction::Execute() (/emsdk/upstream/bin/clang+++0x3a98731)
#15 0x00005621a901f280 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/emsdk/upstream/bin/clang+++0x39d6280)
#16 0x00005621a91e292a clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/emsdk/upstream/bin/clang+++0x3b9992a)
#17 0x00005621a7100f57 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/emsdk/upstream/bin/clang+++0x1ab7f57)
#18 0x00005621a70feb31 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#19 0x00005621a8e31a69 void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<std::__2::optional<llvm::StringRef>>, std::__2::basic_string<char, std::__2::char_traits<char>, std::__2::allocator<char>>*, bool*) const::$_0>(long) Job.cpp:0:0
#20 0x00005621a82df4cc llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/emsdk/upstream/bin/clang+++0x2c964cc)
#21 0x00005621a8e314c5 clang::driver::CC1Command::Execute(llvm::ArrayRef<std::__2::optional<llvm::StringRef>>, std::__2::basic_string<char, std::__2::char_traits<char>, std::__2::allocator<char>>*, bool*) const (/emsdk/upstream/bin/clang+++0x37e84c5)
#22 0x00005621a8de4e87 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/emsdk/upstream/bin/clang+++0x379be87)
#23 0x00005621a8e0c23b clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::__2::pair<int, clang::driver::Command const*>>&) (/emsdk/upstream/bin/clang+++0x37c323b)
#24 0x00005621a70fdb18 clang_main(int, char**, llvm::ToolContext const&) (/emsdk/upstream/bin/clang+++0x1ab4b18)
#25 0x00005621a710f461 main (/emsdk/upstream/bin/clang+++0x1ac6461)
#26 0x00007f08e7f1ccd0 (/usr/lib/libc.so.6+0x27cd0)
#27 0x00007f08e7f1cd8a __libc_start_main (/usr/lib/libc.so.6+0x27d8a)
#28 0x00005621a70719aa _start (/emsdk/upstream/bin/clang+++0x1a289aa)
clang++: error: clang frontend command failed with exit code 139 (use -v to see invocation)

I will try to understand and resolve the issue when I have time.

rouault commented 5 months ago

@bugra9 Would the following patch improve things?

diff --git a/frmts/pds/pds4dataset.h b/frmts/pds/pds4dataset.h
index 386133d1d5..3ffc4e5600 100644
--- a/frmts/pds/pds4dataset.h
+++ b/frmts/pds/pds4dataset.h
@@ -104,28 +104,14 @@ class PDS4TableBaseLayer CPL_NON_FINAL : public OGRLayer
     virtual void RefreshFileAreaObservational(CPLXMLNode *psFAO) = 0;
 };

-/************************************************************************/
-/* ==================================================================== */
-/*                     PDS4EditableSynchronizer                         */
-/* ==================================================================== */
-/************************************************************************/
-
-template <class T>
-class PDS4EditableSynchronizer final : public IOGREditableLayerSynchronizer
-{
-  public:
-    PDS4EditableSynchronizer() = default;
-
-    OGRErr EditableSyncToDisk(OGRLayer *poEditableLayer,
-                              OGRLayer **ppoDecoratedLayer) override;
-};
-
 /************************************************************************/
 /* ==================================================================== */
 /*                        PDS4FixedWidthTable                           */
 /* ==================================================================== */
 /************************************************************************/

+template <class T> class PDS4EditableSynchronizer;
+
 class PDS4FixedWidthTable CPL_NON_FINAL : public PDS4TableBaseLayer
 {
     friend class PDS4EditableSynchronizer<PDS4FixedWidthTable>;
diff --git a/frmts/pds/pds4vector.cpp b/frmts/pds/pds4vector.cpp
index add1097b61..5d597e6beb 100644
--- a/frmts/pds/pds4vector.cpp
+++ b/frmts/pds/pds4vector.cpp
@@ -2574,6 +2574,16 @@ bool PDS4DelimitedTable::InitializeNewLayer(const OGRSpatialReference *poSRS,
 /* ==================================================================== */
 /************************************************************************/

+template <class T>
+class PDS4EditableSynchronizer CPL_NON_FINAL : public IOGREditableLayerSynchronizer
+{
+  public:
+    PDS4EditableSynchronizer() = default;
+
+    OGRErr EditableSyncToDisk(OGRLayer *poEditableLayer,
+                              OGRLayer **ppoDecoratedLayer) override;
+};
+
 template <class T>
 OGRErr
 PDS4EditableSynchronizer<T>::EditableSyncToDisk(OGRLayer *poEditableLayer,
bugra9 commented 5 months ago

@rouault, it compiled and worked without any issues with this patch.

rouault commented 5 months ago

it compiled and worked without any issues with this patch.

cool, upstream fix queued in https://github.com/OSGeo/gdal/pull/9171