filestash icon indicating copy to clipboard operation
filestash copied to clipboard

[bug] unable to compile

Open changchichung opened this issue 2 years ago • 6 comments

I want to update default locales to zh-tw , but I can not find any settings about locale in admin console , so I need to compile filestash. but I got some error messages during the process

Step by step instructions to reproduce the bug

git clone this repo , and do make all

error messages

chchang@hqdc034:~/git/filestash$ go version
go version go1.18.1 linux/amd64
chchang@hqdc034:~/git/filestash$ make all
make build_backend
make[1]: 進入目錄「/home/chchang/git/filestash」
PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/ CGO_CFLAGS_ALLOW='-fopenmp' go build -mod=vendor --tags "fts5" -ldflags "-X github.com/mickael-kerjean/filestash/server/common.BUILD_DATE=`date -u +%Y%m%d` -X github.com/mickael-kerjean/filestash/server/common.BUILD_REF=`git rev-parse HEAD`" -o dist/filestash server/main.go
# github.com/mattn/go-sqlite3
sqlite3-binding.c: In function ‘sqlite3SelectNew’:
sqlite3-binding.c:125801:10: warning: function may return address of local variable [-Wreturn-local-addr]
125801 |   return pNew;
       |          ^~~~
sqlite3-binding.c:125761:10: note: declared here
125761 |   Select standin;
       |          ^~~~~~~
In file included from /usr/include/string.h:535,
                 from sqlite3-binding.c:13766:
In function ‘memcpy’,
    inlined from ‘sqlite3Fts5IndexQuery’ at sqlite3-binding.c:216393:18:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:29:10: warning: ‘__builtin_memcpy’ specified bound 18446744073709551615 exceeds maximum object size 9223372036854775807 [-Wstringop-overflow=]
   29 |   return __builtin___memcpy_chk (__dest, __src, __len,
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   30 |                                  __glibc_objsize0 (__dest));
      |                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~
# github.com/mickael-kerjean/filestash/server/plugin/plg_image_light
/usr/bin/ld: server/plugin/plg_image_light/deps/libtranscode_linux_amd64.a(pthread_mutex_lock.o): relocation R_X86_64_32 against `.rodata.str1.16' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: failed to set dynamic section sizes: bad value
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:12:build_backend] 錯誤 2
make[1]: 離開目錄「/home/chchang/git/filestash」
make: *** [Makefile:2:all] 錯誤 2

so I check the Makefile and find out the default pkg_config_path is incorrect in ubuntu 22.04 , so I update the path to /usr/lib/pkgconfig then make again , but still get same error.

any suggestions ? did I miss some necessary packages to make filestash ?

changchichung avatar Sep 12 '22 02:09 changchichung

so , here is the thing , I create a new machine with ubuntu 20.04 , golang v1.19 , then try to recompile. build_init and build_frontend were ok to compile , but build_backend returns build embed: cannot load embed error

chchang@chchang-Aspire-M3920:~/git/filestash$ make build_backend
PKG_CONFIG_PATH=/usr/lib/pkgconfig/ CGO_CFLAGS_ALLOW='-fopenmp' go build -mod=vendor --tags "fts5" -ldflags "-X github.com/mickael-kerjean/filestash/server/common.BUILD_DATE=`date -u +%Y%m%d` -X github.com/mickael-kerjean/filestash/server/common.BUILD_REF=`git rev-parse HEAD`" -o dist/filestash server/main.go
build embed: cannot load embed: open /home/chchang/git/filestash/vendor/embed: no such file or directory
make: *** [Makefile:12:build_backend] 錯誤 1
chchang@chchang-Aspire-M3920:~/git/filestash$ 

missing some packages ??

changchichung avatar Sep 12 '22 12:09 changchichung

my environment OS: ubuntu 20.04 x64

NPM

npm version
{ filestash: '0.0.0',
  npm: '6.14.4',
  ares: '1.15.0',
  brotli: '1.0.7',
  cldr: '36.1',
  http_parser: '2.9.3',
  icu: '66.1',
  modules: '64',
  napi: '5',
  nghttp2: '1.40.0',
  node: '10.19.0',
  openssl: '1.1.1d',
  tz: '2022b',
  unicode: '13.0',
  uv: '1.34.2',
  v8: '6.8.275.32-node.55',
  zlib: '1.2.11' }

go version

go version go1.16.15 linux/amd64

make build_backend generates a lot of error messages , so I upload the entire log to here https://p.defau.lt/?g6EV6nvImBtJxKiKDJ0_Fw

maybe you could help us to compile filestash ? or specified the environment you used to develop filestash ?

changchichung avatar Sep 13 '22 14:09 changchichung

I'm getting kinda the same error when trying to make build_backend. Everything else from the CONTRIBUTING.md steps worked fine.

  • The error logs: https://p.defau.lt/?OKuunl5jEMYF_HcCphqjrg

Even if I cd server/ && go build I'm getting the exact same warnings / errors...

Any help on building the app would be appreciated @mickael-kerjean I want to try and submit a PR fixing the issue #510

andrewpap22 avatar Sep 15 '22 06:09 andrewpap22

To get things to compile without that error, you can edit this file and comment out plg_image_light. That's the plugin responsible for creating thumbnails. As a replacement to get things to compile in an easier way, you can replace it with plg_image_golang which serve the same purpose but doesn't rely on CGO and doesn't cause issue to compile the project regardless of the environment you're using (at the cost of being much slower).

FYI: In the next few weeks, plg_image_light will likely retire as I found a better approach that is both faster and doesn't rely on libvips

mickael-kerjean avatar Sep 27 '22 07:09 mickael-kerjean

Thank you for your time, help and effort!

andrewpap22 avatar Sep 28 '22 08:09 andrewpap22

We just introduce a new plugin to generate thumbnail that's don't have the dependencies we used to have aka that won't cause this exact issue, it should be much simpler than to compile the project

mickael-kerjean avatar Oct 04 '22 09:10 mickael-kerjean