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

Photoprism compilation issues with tensorflow #35

Closed
vbachvarov opened this issue Jan 26, 2022 · 2 comments
Closed

Photoprism compilation issues with tensorflow #35

vbachvarov opened this issue Jan 26, 2022 · 2 comments

Comments

@vbachvarov
Copy link

vbachvarov commented Jan 26, 2022

I have been trying to compile photoprism on FreeBSD using photoprism-freebsd-port for a couple of days without success.
The commands I used follow:

cd /tmp
git clone 'https://github.com/huo-ju/photoprism-freebsd-port.git'
cd photoprism-freebsd-port
LD_LIBRARY_PATH=".:/lib:/usr/libexec:/usr/local/lib"  make  BATCH=yes OPTIONS_SET=AVX

I identified two issues:

  1. The port depends on science/libtensorflow1, however there is no such port in the ports tree. I assume it is meant to build against science/py-tensorflow, so I applied the following patch to the Makefile and the compilation started:
    sed -i '' 's#science/libtensorflow1#science/py-tensorflow#g' Makefile

  2. The compilation of science/py-tensorflow fails with the following build error:

ERROR: /usr/ports/science/py-tensorflow/work-py38/tensorflow-1.15.5/tensorflow/python/BUILD:329:1: C++ compilation of rule '//tensorflow/python:bfloat16_lib' failed (Exit 1)
tensorflow/python/lib/core/bfloat16.cc:633:8: error: no matching function for call to object of type '(lambda at tensorflow/python/lib/core/bfloat16.cc:607:25)'
  if (!register_ufunc("equal", CompareUFunc<Bfloat16EqFunctor>,
       ^~~~~~~~~~~~~~
tensorflow/python/lib/core/bfloat16.cc:607:25: note: candidate function not viable: no overload of 'CompareUFunc' matching 'PyUFuncGenericFunction' (aka 'void (*)(char **, const long *, const long *, void *)') for 2nd argument
  auto register_ufunc = [&](const char* name, PyUFuncGenericFunction fn,
                        ^
tensorflow/python/lib/core/bfloat16.cc:637:8: error: no matching function for call to object of type '(lambda at tensorflow/python/lib/core/bfloat16.cc:607:25)'
  if (!register_ufunc("not_equal", CompareUFunc<Bfloat16NeFunctor>,
       ^~~~~~~~~~~~~~
tensorflow/python/lib/core/bfloat16.cc:607:25: note: candidate function not viable: no overload of 'CompareUFunc' matching 'PyUFuncGenericFunction' (aka 'void (*)(char **, const long *, const long *, void *)') for 2nd argument
  auto register_ufunc = [&](const char* name, PyUFuncGenericFunction fn,
                        ^
tensorflow/python/lib/core/bfloat16.cc:641:8: error: no matching function for call to object of type '(lambda at tensorflow/python/lib/core/bfloat16.cc:607:25)'
  if (!register_ufunc("less", CompareUFunc<Bfloat16LtFunctor>, compare_types)) {
       ^~~~~~~~~~~~~~
tensorflow/python/lib/core/bfloat16.cc:607:25: note: candidate function not viable: no overload of 'CompareUFunc' matching 'PyUFuncGenericFunction' (aka 'void (*)(char **, const long *, const long *, void *)') for 2nd argument
  auto register_ufunc = [&](const char* name, PyUFuncGenericFunction fn,
                        ^
tensorflow/python/lib/core/bfloat16.cc:644:8: error: no matching function for call to object of type '(lambda at tensorflow/python/lib/core/bfloat16.cc:607:25)'
  if (!register_ufunc("greater", CompareUFunc<Bfloat16GtFunctor>,
       ^~~~~~~~~~~~~~
tensorflow/python/lib/core/bfloat16.cc:607:25: note: candidate function not viable: no overload of 'CompareUFunc' matching 'PyUFuncGenericFunction' (aka 'void (*)(char **, const long *, const long *, void *)') for 2nd argument
  auto register_ufunc = [&](const char* name, PyUFuncGenericFunction fn,
                        ^
tensorflow/python/lib/core/bfloat16.cc:648:8: error: no matching function for call to object of type '(lambda at tensorflow/python/lib/core/bfloat16.cc:607:25)'
  if (!register_ufunc("less_equal", CompareUFunc<Bfloat16LeFunctor>,
       ^~~~~~~~~~~~~~
tensorflow/python/lib/core/bfloat16.cc:607:25: note: candidate function not viable: no overload of 'CompareUFunc' matching 'PyUFuncGenericFunction' (aka 'void (*)(char **, const long *, const long *, void *)') for 2nd argument
  auto register_ufunc = [&](const char* name, PyUFuncGenericFunction fn,
                        ^
tensorflow/python/lib/core/bfloat16.cc:652:8: error: no matching function for call to object of type '(lambda at tensorflow/python/lib/core/bfloat16.cc:607:25)'
  if (!register_ufunc("greater_equal", CompareUFunc<Bfloat16GeFunctor>,
       ^~~~~~~~~~~~~~
tensorflow/python/lib/core/bfloat16.cc:607:25: note: candidate function not viable: no overload of 'CompareUFunc' matching 'PyUFuncGenericFunction' (aka 'void (*)(char **, const long *, const long *, void *)') for 2nd argument
  auto register_ufunc = [&](const char* name, PyUFuncGenericFunction fn,
                        ^
6 errors generated.

I tried checking out the ports tree to a version from December 2021 and Photoprism to a commit before the switch to external tensorflow but I got other linker issues (see below). The commits I tried were:

The linker errors with the code before splitting out tensorflow:

ERROR: /tmp/lansnap-build/photoprism-freebsd-port/work/photoprism-93b26f197908dd825dfa302d17793185cc3eab8c/docker/tensorflow/tensorflow-1.15.2/tensorflow/BUILD:563:1: Linking of rule '//tensorflow:libtensorflow_framework.so.1.15.2' failed (Exit 1)
ld: error: duplicate symbol: adler32
>>> defined at adler32.c
>>>            adler32.pic.o:(adler32) in archive bazel-out/host/bin/external/zlib/libzlib.pic.a
>>> defined at adler32.c
>>>            adler32.pic.o:(.text.adler32+0x0) in archive bazel-out/host/bin/external/zlib_archive/libzlib.pic.a

ld: error: duplicate symbol: adler32_combine
>>> defined at adler32.c
>>>            adler32.pic.o:(adler32_combine) in archive bazel-out/host/bin/external/zlib/libzlib.pic.a
>>> defined at adler32.c
>>>            adler32.pic.o:(.text.adler32_combine+0x0) in archive bazel-out/host/bin/external/zlib_archive/libzlib.pic.a

... (repeated for multiple other functions)

My question is: Am I compiling Photoprism correctly, and if yes - why is tensorflow failing to compile?

I am using FreeBSD 13.0-RELEASE.

@huo-ju
Copy link
Owner

huo-ju commented Jan 27, 2022

Please install libtensorflow1 port from this repo: https://github.com/psa/libtensorflow1-freebsd-port

It has been submitted to the official port tree, but it's still not available now.

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=260694

@huo-ju huo-ju closed this as completed Jan 27, 2022
@vbachvarov
Copy link
Author

Thank you, I also saw libtensorflow1 has an open issue identical to this one.

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

No branches or pull requests

2 participants