laz-rs / laz-rs-c

Other
4 stars 1 forks source link

Build Error #7

Closed CCInc closed 10 months ago

CCInc commented 11 months ago

Hello, with the latest master I am receiving some build errors.

[3/8] Building CXX object cpp/CMakeFiles/lazrs_cpp.dir/lazrs_cpp.cpp.o
FAILED: cpp/CMakeFiles/lazrs_cpp.dir/lazrs_cpp.cpp.o 
/usr/bin/c++  -I/home/chris/data/laz-rs-c/lazrs/include  -MD -MT cpp/CMakeFiles/lazrs_cpp.dir/lazrs_cpp.cpp.o -MF cpp/CMakeFiles/lazrs_cpp.dir/lazrs_cpp.cpp.o.d -o cpp/CMakeFiles/lazrs_cpp.dir/lazrs_cpp.cpp.o -c /home/chris/data/laz-rs-c/cpp/lazrs_cpp.cpp
In file included from /home/chris/data/laz-rs-c/cpp/lazrs_cpp.cpp:1:
/home/chris/data/laz-rs-c/lazrs/include/lazrs/lazrs_cpp.h:38:25: error: ‘Lazrs_LasZipCompressor’ was not declared in this scope; did you mean ‘Lazrs_SeqLasZipCompressor’?
   38 |         std::unique_ptr<Lazrs_LasZipCompressor, void (*)(Lazrs_LasZipCompressor *)>;
      |                         ^~~~~~~~~~~~~~~~~~~~~~
      |                         Lazrs_SeqLasZipCompressor
/home/chris/data/laz-rs-c/lazrs/include/lazrs/lazrs_cpp.h:38:83: error: template argument 1 is invalid
   38 |         std::unique_ptr<Lazrs_LasZipCompressor, void (*)(Lazrs_LasZipCompressor *)>;
      |                                                                                   ^
/home/chris/data/laz-rs-c/lazrs/include/lazrs/lazrs_cpp.h:38:83: error: template argument 2 is invalid
/home/chris/data/laz-rs-c/lazrs/include/lazrs/lazrs_cpp.h:39:5: error: ‘Lazrs_LasZipCompressorPtr’ does not name a type; did you mean ‘Lazrs_SeqLasZipCompressor’?
   39 |     Lazrs_LasZipCompressorPtr m_compressor;
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~
      |     Lazrs_SeqLasZipCompressor
/home/chris/data/laz-rs-c/cpp/lazrs_cpp.cpp: In member function ‘void lazrs::LasZipCompressor::compress_one(uint8_t*, size_t, Lazrs_Result&)’:
/home/chris/data/laz-rs-c/cpp/lazrs_cpp.cpp:57:44: error: ‘m_compressor’ was not declared in this scope
   57 |     result = lazrs_compressor_compress_one(m_compressor.get(), in, len);
      |                                            ^~~~~~~~~~~~
/home/chris/data/laz-rs-c/cpp/lazrs_cpp.cpp: In member function ‘void lazrs::LasZipCompressor::compress_one(uint8_t*, size_t)’:
/home/chris/data/laz-rs-c/cpp/lazrs_cpp.cpp:62:39: error: ‘m_compressor’ was not declared in this scope
   62 |     if (lazrs_compressor_compress_one(m_compressor.get(), in, len) != LAZRS_OK)
      |                                       ^~~~~~~~~~~~
/home/chris/data/laz-rs-c/cpp/lazrs_cpp.cpp: In member function ‘void lazrs::LasZipCompressor::compress_many(uint8_t*, size_t, Lazrs_Result&)’:
/home/chris/data/laz-rs-c/cpp/lazrs_cpp.cpp:70:45: error: ‘m_compressor’ was not declared in this scope
   70 |     result = lazrs_compressor_compress_many(m_compressor.get(), in, len);
      |                                             ^~~~~~~~~~~~
/home/chris/data/laz-rs-c/cpp/lazrs_cpp.cpp: In member function ‘void lazrs::LasZipCompressor::compress_many(uint8_t*, size_t)’:
/home/chris/data/laz-rs-c/cpp/lazrs_cpp.cpp:75:40: error: ‘m_compressor’ was not declared in this scope
   75 |     if (lazrs_compressor_compress_many(m_compressor.get(), in, len) != LAZRS_OK)
      |                                        ^~~~~~~~~~~~
[4/8] Building CXX object examples/CMakeFiles/cpp_decompressor.dir/cpp_decompressor.cpp.o
FAILED: examples/CMakeFiles/cpp_decompressor.dir/cpp_decompressor.cpp.o 
/usr/bin/c++  -I/home/chris/data/laz-rs-c/lazrs/include -I/home/chris/data/laz-rs-c/minilas/include  -MD -MT examples/CMakeFiles/cpp_decompressor.dir/cpp_decompressor.cpp.o -MF examples/CMakeFiles/cpp_decompressor.dir/cpp_decompressor.cpp.o.d -o examples/CMakeFiles/cpp_decompressor.dir/cpp_decompressor.cpp.o -c /home/chris/data/laz-rs-c/examples/cpp_decompressor.cpp
In file included from /home/chris/data/laz-rs-c/examples/cpp_decompressor.cpp:1:
/home/chris/data/laz-rs-c/lazrs/include/lazrs/lazrs_cpp.h:38:25: error: ‘Lazrs_LasZipCompressor’ was not declared in this scope; did you mean ‘Lazrs_SeqLasZipCompressor’?
   38 |         std::unique_ptr<Lazrs_LasZipCompressor, void (*)(Lazrs_LasZipCompressor *)>;
      |                         ^~~~~~~~~~~~~~~~~~~~~~
      |                         Lazrs_SeqLasZipCompressor
/home/chris/data/laz-rs-c/lazrs/include/lazrs/lazrs_cpp.h:38:83: error: template argument 1 is invalid
   38 |         std::unique_ptr<Lazrs_LasZipCompressor, void (*)(Lazrs_LasZipCompressor *)>;
      |                                                                                   ^
/home/chris/data/laz-rs-c/lazrs/include/lazrs/lazrs_cpp.h:38:83: error: template argument 2 is invalid
/home/chris/data/laz-rs-c/lazrs/include/lazrs/lazrs_cpp.h:39:5: error: ‘Lazrs_LasZipCompressorPtr’ does not name a type; did you mean ‘Lazrs_SeqLasZipCompressor’?
   39 |     Lazrs_LasZipCompressorPtr m_compressor;
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~
      |     Lazrs_SeqLasZipCompressor
[5/8] Building CXX object examples/CMakeFiles/cpp_pardecompressor.dir/cpp_pardecompressor.cpp.o
FAILED: examples/CMakeFiles/cpp_pardecompressor.dir/cpp_pardecompressor.cpp.o 
/usr/bin/c++  -I/home/chris/data/laz-rs-c/lazrs/include -I/home/chris/data/laz-rs-c/minilas/include  -MD -MT examples/CMakeFiles/cpp_pardecompressor.dir/cpp_pardecompressor.cpp.o -MF examples/CMakeFiles/cpp_pardecompressor.dir/cpp_pardecompressor.cpp.o.d -o examples/CMakeFiles/cpp_pardecompressor.dir/cpp_pardecompressor.cpp.o -c /home/chris/data/laz-rs-c/examples/cpp_pardecompressor.cpp
In file included from /home/chris/data/laz-rs-c/examples/cpp_pardecompressor.cpp:1:
/home/chris/data/laz-rs-c/lazrs/include/lazrs/lazrs_cpp.h:38:25: error: ‘Lazrs_LasZipCompressor’ was not declared in this scope; did you mean ‘Lazrs_SeqLasZipCompressor’?
   38 |         std::unique_ptr<Lazrs_LasZipCompressor, void (*)(Lazrs_LasZipCompressor *)>;
      |                         ^~~~~~~~~~~~~~~~~~~~~~
      |                         Lazrs_SeqLasZipCompressor
/home/chris/data/laz-rs-c/lazrs/include/lazrs/lazrs_cpp.h:38:83: error: template argument 1 is invalid
   38 |         std::unique_ptr<Lazrs_LasZipCompressor, void (*)(Lazrs_LasZipCompressor *)>;
      |                                                                                   ^
/home/chris/data/laz-rs-c/lazrs/include/lazrs/lazrs_cpp.h:38:83: error: template argument 2 is invalid
/home/chris/data/laz-rs-c/lazrs/include/lazrs/lazrs_cpp.h:39:5: error: ‘Lazrs_LasZipCompressorPtr’ does not name a type; did you mean ‘Lazrs_SeqLasZipCompressor’?
   39 |     Lazrs_LasZipCompressorPtr m_compressor;
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~
      |     Lazrs_SeqLasZipCompressor
ninja: build stopped: subcommand failed.

It looks like the LasZipCompressor object does not exist. I tried to replace it with Lazrs_SeqLasZipCompressor, but I got the following errors:

[3/8] Building CXX object cpp/CMakeFiles/lazrs_cpp.dir/lazrs_cpp.cpp.o
FAILED: cpp/CMakeFiles/lazrs_cpp.dir/lazrs_cpp.cpp.o 
/usr/bin/c++  -I/home/chris/data/laz-rs-c/lazrs/include  -MD -MT cpp/CMakeFiles/lazrs_cpp.dir/lazrs_cpp.cpp.o -MF cpp/CMakeFiles/lazrs_cpp.dir/lazrs_cpp.cpp.o.d -o cpp/CMakeFiles/lazrs_cpp.dir/lazrs_cpp.cpp.o -c /home/chris/data/laz-rs-c/cpp/lazrs_cpp.cpp
In file included from /home/chris/data/laz-rs-c/cpp/lazrs_cpp.cpp:1:
/home/chris/data/laz-rs-c/lazrs/include/lazrs/lazrs_cpp.h:39:31: error: field ‘m_compressor’ has incomplete type ‘Lazrs_SeqLasZipCompressor’
   39 |     Lazrs_SeqLasZipCompressor m_compressor;
      |                               ^~~~~~~~~~~~
In file included from /home/chris/data/laz-rs-c/lazrs/include/lazrs/lazrs_cpp.h:1,
                 from /home/chris/data/laz-rs-c/cpp/lazrs_cpp.cpp:1:
/home/chris/data/laz-rs-c/lazrs/include/lazrs/lazrs.h:55:16: note: forward declaration of ‘Lazrs_SeqLasZipCompressor’ {aka ‘struct Lazrs_SeqLasZipCompressor’}
   55 | typedef struct Lazrs_SeqLasZipCompressor Lazrs_SeqLasZipCompressor;
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~
[4/8] Building CXX object examples/CMakeFiles/cpp_decompressor.dir/cpp_decompressor.cpp.o
FAILED: examples/CMakeFiles/cpp_decompressor.dir/cpp_decompressor.cpp.o 
/usr/bin/c++  -I/home/chris/data/laz-rs-c/lazrs/include -I/home/chris/data/laz-rs-c/minilas/include  -MD -MT examples/CMakeFiles/cpp_decompressor.dir/cpp_decompressor.cpp.o -MF examples/CMakeFiles/cpp_decompressor.dir/cpp_decompressor.cpp.o.d -o examples/CMakeFiles/cpp_decompressor.dir/cpp_decompressor.cpp.o -c /home/chris/data/laz-rs-c/examples/cpp_decompressor.cpp
In file included from /home/chris/data/laz-rs-c/examples/cpp_decompressor.cpp:1:
/home/chris/data/laz-rs-c/lazrs/include/lazrs/lazrs_cpp.h:39:31: error: field ‘m_compressor’ has incomplete type ‘Lazrs_SeqLasZipCompressor’
   39 |     Lazrs_SeqLasZipCompressor m_compressor;
      |                               ^~~~~~~~~~~~
In file included from /home/chris/data/laz-rs-c/lazrs/include/lazrs/lazrs_cpp.h:1,
                 from /home/chris/data/laz-rs-c/examples/cpp_decompressor.cpp:1:
/home/chris/data/laz-rs-c/lazrs/include/lazrs/lazrs.h:55:16: note: forward declaration of ‘Lazrs_SeqLasZipCompressor’ {aka ‘struct Lazrs_SeqLasZipCompressor’}
   55 | typedef struct Lazrs_SeqLasZipCompressor Lazrs_SeqLasZipCompressor;
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~
[5/8] Building CXX object examples/CMakeFiles/cpp_pardecompressor.dir/cpp_pardecompressor.cpp.o
FAILED: examples/CMakeFiles/cpp_pardecompressor.dir/cpp_pardecompressor.cpp.o 
/usr/bin/c++  -I/home/chris/data/laz-rs-c/lazrs/include -I/home/chris/data/laz-rs-c/minilas/include  -MD -MT examples/CMakeFiles/cpp_pardecompressor.dir/cpp_pardecompressor.cpp.o -MF examples/CMakeFiles/cpp_pardecompressor.dir/cpp_pardecompressor.cpp.o.d -o examples/CMakeFiles/cpp_pardecompressor.dir/cpp_pardecompressor.cpp.o -c /home/chris/data/laz-rs-c/examples/cpp_pardecompressor.cpp
In file included from /home/chris/data/laz-rs-c/examples/cpp_pardecompressor.cpp:1:
/home/chris/data/laz-rs-c/lazrs/include/lazrs/lazrs_cpp.h:39:31: error: field ‘m_compressor’ has incomplete type ‘Lazrs_SeqLasZipCompressor’
   39 |     Lazrs_SeqLasZipCompressor m_compressor;
      |                               ^~~~~~~~~~~~
In file included from /home/chris/data/laz-rs-c/lazrs/include/lazrs/lazrs_cpp.h:1,
                 from /home/chris/data/laz-rs-c/examples/cpp_pardecompressor.cpp:1:
/home/chris/data/laz-rs-c/lazrs/include/lazrs/lazrs.h:55:16: note: forward declaration of ‘Lazrs_SeqLasZipCompressor’ {aka ‘struct Lazrs_SeqLasZipCompressor’}
   55 | typedef struct Lazrs_SeqLasZipCompressor Lazrs_SeqLasZipCompressor;
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~
ninja: build stopped: subcommand failed.
tmontaigu commented 11 months ago

For me replacing with Lazrs_SeqLasZipCompressor worked, but there was also the corrosion update, can you retry the master branch ?

CCInc commented 11 months ago

That appeared to fix the build issue, thanks!

CCInc commented 11 months ago

There's an additional error when building with the "parallel" flag:

user@user-ML2:~/data/laz-rs-c/build$ cmake .. -DPARALLEL_FEATURE=ON 
-- The C compiler identification is GNU 9.4.0
-- The CXX compiler identification is GNU 9.4.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Rust Toolchain: stable-x86_64-unknown-linux-gnu
-- Rust Target: x86_64-unknown-linux-gnu
-- Determining required link libraries for target x86_64-unknown-linux-gnu
-- Required static libs for target x86_64-unknown-linux-gnu: gcc_s;util;rt;pthread;m;dl;c
-- Found Rust: /home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/rustc (found version "1.73.0") 
-- Using Corrosion as a subdirectory
-- Configuring done
-- Generating done
-- Build files have been written to: /home/user/data/laz-rs-c/build
user@user-ML2:~/data/laz-rs-c/build$ cmake --build .
[0/12] cd /home/user/data/laz-rs-c/lazrs && /usr/bin/cmake -E env CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER=/usr/bin/cc CC_x...user/data/laz-rs-c/lazrs/Cargo.toml --target-dir /home/user/data/laz-rs-c/build/./cargo/build -- -Cdefault-linker-libraries=yes
error: Package `laz-rs-c v0.1.0 (/home/user/data/laz-rs-c/lazrs)` does not have the feature `PARALLEL`
[1/12] Building C object minilas/CMakeFiles/minilas.dir/src/las.c.o
/home/user/data/laz-rs-c/minilas/src/las.c: In function ‘print_header’:
/home/user/data/laz-rs-c/minilas/src/las.c:173:45: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 3 has type ‘uint64_t’ {aka ‘const long unsigned int’} [-Wformat=]
  173 |     printf("Point size: %d, point count: %llu\n", header->point_size, header->point_count);
      |                                          ~~~^                         ~~~~~~~~~~~~~~~~~~~
      |                                             |                               |
      |                                             long long unsigned int          uint64_t {aka const long unsigned int}
      |                                          %lu
[2/12] Linking C static library minilas/libminilas.a
FAILED: lazrs/CMakeFiles/_cargo-build_laz-rs-c /home/user/data/laz-rs-c/build/lazrs/CMakeFiles/_cargo-build_laz-rs-c 
cd /home/user/data/laz-rs-c/lazrs && /usr/bin/cmake -E env CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER=/usr/bin/cc CC_x86_64-unknown-linux-gnu=/usr/bin/cc CXX_x86_64-unknown-linux-gnu=/usr/bin/c++ CORROSION_BUILD_DIR=/home/user/data/laz-rs-c/build/lazrs CARGO_BUILD_RUSTC=/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/rustc /home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/cargo rustc --lib --target=x86_64-unknown-linux-gnu --features=PARALLEL --package laz-rs-c --manifest-path /home/user/data/laz-rs-c/lazrs/Cargo.toml --target-dir /home/user/data/laz-rs-c/build/./cargo/build -- -Cdefault-linker-libraries=yes
ninja: build stopped: subcommand failed.

If I replace this line with "parallel" rather than "PARALLEL" it seems to function fine (which matches with the laz-rs cargo file). https://github.com/laz-rs/laz-rs-c/blob/dc7f832c03dd3ee5c70dee9431467e2a695fc67b/lazrs/CMakeLists.txt#L21

Also, how would you feel about defaulting the parallel feature to on? Is there a downside?

tmontaigu commented 11 months ago

I don't think there is a downside, parallel is so much faster that it makes sense