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

enfcs 1.9.1 on SUSE Leap 42.2 undefined references to `el::base::elStorage' #291

Closed
Aikhjarto opened this issue Mar 4, 2017 · 32 comments
Closed

Comments

@Aikhjarto
Copy link
Contributor

Building enfcs 1.9.1 on SUSE Leap 42.2 fails with undefined reference:

[  112s] CMakeFiles/encfs.dir/encfs/base64.cpp.o: In function `el::base::MessageBuilder::operator<<(char const*)':
[  112s] /home/abuild/rpmbuild/BUILD/encfs-1.9.1/internal/easylogging++.h:4637: undefined reference to `el::base::elStorage'
[  112s] CMakeFiles/encfs.dir/encfs/base64.cpp.o: In function `el::base::MessageBuilder::operator<<(unsigned int)':
[  112s] /home/abuild/rpmbuild/BUILD/encfs-1.9.1/internal/easylogging++.h:4631: undefined reference to `el::base::elStorage'
[  112s] CMakeFiles/encfs.dir/encfs/base64.cpp.o: In function `el::base::LogFormat::updateFormatSpec()':
[  112s] /home/abuild/rpmbuild/BUILD/encfs-1.9.1/internal/easylogging++.h:2355: undefined reference to `el::base::utils::s_currentHost'
[  112s] /home/abuild/rpmbuild/BUILD/encfs-1.9.1/internal/easylogging++.h:2349: undefined reference to `el::base::utils::s_currentUser'
[  112s] CMakeFiles/encfs.dir/encfs/base64.cpp.o: In function `el::base::MessageBuilder::operator<<(char const*)':
[  112s] /home/abuild/rpmbuild/BUILD/encfs-1.9.1/internal/easylogging++.h:4637: undefined reference to `el::base::elStorage'
[  112s] CMakeFiles/encfs.dir/encfs/base64.cpp.o: In function `el::base::Writer::initializeLogger(std::string const&, bool, bool)':
[  112s] /home/abuild/rpmbuild/BUILD/encfs-1.9.1/internal/easylogging++.h:5037: undefined reference to `el::base::elStorage'
[  112s] /home/abuild/rpmbuild/BUILD/encfs-1.9.1/internal/easylogging++.h:5020: undefined reference to `el::base::elStorage'
[  112s] /home/abuild/rpmbuild/BUILD/encfs-1.9.1/internal/easylogging++.h:5023: undefined reference to `el::base::elStorage'
[  112s] CMakeFiles/encfs.dir/encfs/base64.cpp.o: In function `el::base::Writer::construct(int, char const*, ...)':
[  112s] /home/abuild/rpmbuild/BUILD/encfs-1.9.1/internal/easylogging++.h:4989: undefined reference to `el::base::elStorage'
[  112s] CMakeFiles/encfs.dir/encfs/base64.cpp.o:/home/abuild/rpmbuild/BUILD/encfs-1.9.1/internal/easylogging++.h:4610: more undefined references to `el::base::elStorage' follow
[  112s] collect2: error: ld returned 1 exit status
[  112s] CMakeFiles/encfs.dir/build.make:803: recipe for target 'libencfs.so.1.9.1' failed
[  112s] make[2]: *** [libencfs.so.1.9.1] Error 1

The full build log can be found here:
https://build.opensuse.org/package/live_build_log/home:Aikhjarto:branches:home:Warhammer40k:stuff/encfs/openSUSE_Leap_42.2/x86_64

@benrubson
Copy link
Contributor

@Aikhjarto
Copy link
Contributor Author

@benrubson
Yes, I used exactly the link you mentioned.

@benrubson
Copy link
Contributor

What are your build commands ?

@Aikhjarto
Copy link
Contributor Author

Here are the build commands. Please have a look at the build log (link in the opening post) for more details.

[   69s] + mkdir -p build
[   69s] + cd build
[   69s] + /usr/bin/cmake .. '-GUnix Makefiles' -DCMAKE_INSTALL_PREFIX:PATH=/usr -DINCLUDE_INSTALL_DIR:PATH=/usr/include -DLIB_INSTALL_DIR:PATH=/usr/lib64 -DSYSCONF_INSTALL_DIR:PATH=/etc -DSHARE_INSTALL_PREFIX:PATH=/usr/share -DCMAKE_INSTALL_LIBDIR:PATH=/usr/lib64 -DCMAKE_BUILD_TYPE=RelWithDebInfo '-DCMAKE_C_FLAGS=-fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -DNDEBUG' '-DCMAKE_CXX_FLAGS=-fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -DNDEBUG' '-DCMAKE_Fortran_FLAGS=-fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -DNDEBUG' '-DCMAKE_EXE_LINKER_FLAGS=-Wl,--as-needed -Wl,--no-undefined -Wl,-z,now' '-DCMAKE_MODULE_LINKER_FLAGS=-Wl,--as-needed -Wl,--no-undefined -Wl,-z,now' '-DCMAKE_SHARED_LINKER_FLAGS=-Wl,--as-needed -Wl,--no-undefined -Wl,-z,now' -DLIB_SUFFIX=64 -DCMAKE_SKIP_RPATH:BOOL=ON -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DBUILD_SHARED_LIBS:BOOL=ON -DBUILD_STATIC_LIBS:BOOL=OFF -DCMAKE_COLOR_MAKEFILE:BOOL=OFF -DCMAKE_INSTALL_DO_STRIP:BOOL=OFF -DCMAKE_MODULES_INSTALL_DIR=/usr/share/cmake/Modules
[   69s] -- The C compiler identification is GNU 4.8.5
[   69s] -- The CXX compiler identification is GNU 4.8.5
[   69s] -- Check for working C compiler: /usr/bin/cc
[   69s] -- Check for working C compiler: /usr/bin/cc -- works
[   69s] -- Detecting C compiler ABI info
[   69s] -- Detecting C compiler ABI info - done
[   69s] -- Detecting C compile features
[   70s] -- Detecting C compile features - done
[   70s] -- Check for working CXX compiler: /usr/bin/c++
[   70s] -- Check for working CXX compiler: /usr/bin/c++ -- works
[   70s] -- Detecting CXX compiler ABI info
[   71s] -- Detecting CXX compiler ABI info - done
[   71s] -- Detecting CXX compile features
[   71s] -- Detecting CXX compile features - done
[   71s] -- Found FUSE: /usr/include/fuse  
[   72s] -- Found OpenSSL: /usr/lib64/libssl.so;/usr/lib64/libcrypto.so (found version "1.0.2j") 
[   72s] -- Using local TinyXML2 copy
[   72s] -- Looking for C++ include attr/xattr.h
[   72s] -- Looking for C++ include attr/xattr.h - not found
[   72s] -- Looking for C++ include sys/xattr.h
[   72s] -- Looking for C++ include sys/xattr.h - found
[   72s] -- Looking for utimensat
[   73s] -- Looking for utimensat - found
[   73s] -- Looking for pthread.h
[   73s] -- Looking for pthread.h - found
[   73s] -- Looking for pthread_create
[   73s] -- Looking for pthread_create - not found
[   73s] -- Looking for pthread_create in pthreads
[   73s] -- Looking for pthread_create in pthreads - not found
[   73s] -- Looking for pthread_create in pthread
[   74s] -- Looking for pthread_create in pthread - found
[   74s] -- Found Threads: TRUE  
[   74s] -- Looking for C++ include syslog.h
[   74s] -- Looking for C++ include syslog.h - found
[   74s] -- Enabled syslog logging support
[   74s] -- Found Intl: /usr/include  
[   74s] -- Found Gettext: /usr/bin/msgmerge (found version "0.19.2") 
[   74s] -- Configuring done
[   74s] -- Generating done
[   74s] CMake Warning:
[   74s]   Manually-specified variables were not used by the project:
[   74s] 
[   74s]     BUILD_STATIC_LIBS
[   74s]     CMAKE_Fortran_FLAGS
[   74s]     CMAKE_INSTALL_DO_STRIP
[   74s]     CMAKE_MODULES_INSTALL_DIR
[   74s]     INCLUDE_INSTALL_DIR
[   74s]     LIB_SUFFIX
[   74s]     SHARE_INSTALL_PREFIX
[   74s]     SYSCONF_INSTALL_DIR
[   74s] 
[   74s] 
[   74s] -- Build files have been written to: /home/abuild/rpmbuild/BUILD/encfs-1.9.1/build
[   74s] + /usr/bin/make -j8 VERBOSE=1

@benrubson
Copy link
Contributor

Does it correctly build if you use the following simple commands ?

mkdir build
cd build
cmake ..
make

@Aikhjarto
Copy link
Contributor Author

Build with your simple command chain works.
However, the build is intended to be included in the OpenSUSE Leap distribution. The build flags are given by the build system. So I have no influence on them.

Manually removing the --no-undefined flags from the DCMAKE_*_LINKER_FLAGS makes it build.

@benrubson
Copy link
Contributor

Is it then OK for you now @Aikhjarto ?

@Aikhjarto
Copy link
Contributor Author

It's kind-of OK.
Is there a realistic chance that enfcs can be build with --no-undefined?

@benrubson
Copy link
Contributor

benrubson commented Mar 10, 2017

But does encfs run after having compiled without --no-undefined ?
I would say that the undefined reference error messages should be resolved.

@Aikhjarto
Copy link
Contributor Author

Yes it runs when it is compiled without --no-undefined

@benrubson
Copy link
Contributor

Try to apply #298 to your sources to see if it helps ?

@Aikhjarto
Copy link
Contributor Author

I applied #298 but build still fails with --no-undefiend
Additionally, with #298 I get lots of warning like

/home/abuild/rpmbuild/BUILD/encfs-1.9.1/internal/easylogging++.h:706:34: warning: 'el::base::consts::kWarningLevelShortLogValue' defined but not used [-Wunused-variable]
static const base::type::char_t* kWarningLevelShortLogValue  =   ELPP_LITERAL("W");

@benrubson
Copy link
Contributor

Could you please test #308 ?
Issue is not --no-undefined but -Wl,-z,now.
PR then adds -Wl,-z,lazy to inhibit this.

@Aikhjarto
Copy link
Contributor Author

I applied #308 and still get the undefined references. (Same result when I apply #308 and #298 in combination).
The linker call is now slightly different including the -Wl,-z,lazy and the -Wl,-z,now arguments.

[  203s] /usr/bin/c++  -fPIC -fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -DNDEBUG -O2 -g -DNDEBUG -Wl,--as-needed -Wl,--no-undefined -Wl,-z,now;-Wl,-z,lazy -shared -Wl,-soname,libencfs.so.1.9 -o libencfs.so.1.9.1 CMakeFiles/encfs.dir/encfs/autosprintf.cpp.o CMakeFiles/encfs.dir/encfs/base64.cpp.o CMakeFiles/encfs.dir/encfs/BlockFileIO.cpp.o CMakeFiles/encfs.dir/encfs/BlockNameIO.cpp.o CMakeFiles/encfs.dir/encfs/Cipher.cpp.o CMakeFiles/encfs.dir/encfs/CipherFileIO.cpp.o CMakeFiles/encfs.dir/encfs/CipherKey.cpp.o CMakeFiles/encfs.dir/encfs/ConfigReader.cpp.o CMakeFiles/encfs.dir/encfs/ConfigVar.cpp.o CMakeFiles/encfs.dir/encfs/Context.cpp.o CMakeFiles/encfs.dir/encfs/DirNode.cpp.o CMakeFiles/encfs.dir/encfs/encfs.cpp.o CMakeFiles/encfs.dir/encfs/Error.cpp.o CMakeFiles/encfs.dir/encfs/FileIO.cpp.o CMakeFiles/encfs.dir/encfs/FileNode.cpp.o CMakeFiles/encfs.dir/encfs/FileUtils.cpp.o CMakeFiles/encfs.dir/encfs/Interface.cpp.o CMakeFiles/encfs.dir/encfs/MACFileIO.cpp.o CMakeFiles/encfs.dir/encfs/MemoryPool.cpp.o CMakeFiles/encfs.dir/encfs/NameIO.cpp.o CMakeFiles/encfs.dir/encfs/NullCipher.cpp.o CMakeFiles/encfs.dir/encfs/NullNameIO.cpp.o CMakeFiles/encfs.dir/encfs/openssl.cpp.o CMakeFiles/encfs.dir/encfs/RawFileIO.cpp.o CMakeFiles/encfs.dir/encfs/readpassphrase.cpp.o CMakeFiles/encfs.dir/encfs/SSL_Cipher.cpp.o CMakeFiles/encfs.dir/encfs/StreamNameIO.cpp.o CMakeFiles/encfs.dir/encfs/XmlReader.cpp.o  -L/home/abuild/rpmbuild/BUILD/encfs-1.9.1/build/internal/tinyxml2-3.0.0 -lfuse -lssl -lcrypto internal/tinyxml2-3.0.0/libtinyxml2.so.3.0.0 -lpthread
[  204s] /usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/bin/ld: warning: -z now;-Wl ignored.
[  204s] CMakeFiles/encfs.dir/encfs/base64.cpp.o: In function `el::base::MessageBuilder::operator<<(char const*)':
[  204s] /home/abuild/rpmbuild/BUILD/encfs-1.9.1/internal/easylogging++.h:4637: undefined reference to `el::base::elStorage'
[  204s] CMakeFiles/encfs.dir/encfs/base64.cpp.o: In function `el::base::MessageBuilder::operator<<(unsigned int)':
[  204s] /home/abuild/rpmbuild/BUILD/encfs-1.9.1/internal/easylogging++.h:4631: undefined reference to `el::base::elStorage'
[  204s] CMakeFiles/encfs.dir/encfs/base64.cpp.o: In function `el::base::LogFormat::updateFormatSpec()':
[  204s] /home/abuild/rpmbuild/BUILD/encfs-1.9.1/internal/easylogging++.h:2355: undefined reference to `el::base::utils::s_currentHost'
[  204s] /home/abuild/rpmbuild/BUILD/encfs-1.9.1/internal/easylogging++.h:2349: undefined reference to `el::base::utils::s_currentUser'
[  204s] CMakeFiles/encfs.dir/encfs/base64.cpp.o: In function `el::base::MessageBuilder::operator<<(char const*)':
[  204s] /home/abuild/rpmbuild/BUILD/encfs-1.9.1/internal/easylogging++.h:4637: undefined reference to `el::base::elStorage'
[  204s] CMakeFiles/encfs.dir/encfs/base64.cpp.o: In function `el::base::Writer::initializeLogger(std::string const&, bool, bool)':
[  204s] /home/abuild/rpmbuild/BUILD/encfs-1.9.1/internal/easylogging++.h:5037: undefined reference to `el::base::elStorage'
[  204s] /home/abuild/rpmbuild/BUILD/encfs-1.9.1/internal/easylogging++.h:5020: undefined reference to `el::base::elStorage'
[  204s] /home/abuild/rpmbuild/BUILD/encfs-1.9.1/internal/easylogging++.h:5023: undefined reference to `el::base::elStorage'
[  204s] CMakeFiles/encfs.dir/encfs/base64.cpp.o: In function `el::base::Writer::construct(int, char const*, ...)':
[  204s] /home/abuild/rpmbuild/BUILD/encfs-1.9.1/internal/easylogging++.h:4989: undefined reference to `el::base::elStorage'
[  204s] CMakeFiles/encfs.dir/encfs/base64.cpp.o:/home/abuild/rpmbuild/BUILD/encfs-1.9.1/internal/easylogging++.h:4610: more undefined references to `el::base::elStorage' follow
[  204s] collect2: error: ld returned 1 exit status
[  204s] CMakeFiles/encfs.dir/build.make:803: recipe for target 'libencfs.so.1.9.1' failed

@benrubson
Copy link
Contributor

benrubson commented Mar 11, 2017

I managed to reproduce your issue, and #308 solved it.
Let's check again then.

@benrubson
Copy link
Contributor

Should work now !

@Aikhjarto
Copy link
Contributor Author

Sorry, cannot confirm. I applied commit b91306b
Same result and error as before, only the ";" has changed to a "," in the linker command.

@benrubson
Copy link
Contributor

Retry ?
I simply removed --no-undefined from the CMAKE_SHARED_LINKER_FLAGS, as a workaround (as explained in the PR).

@rfjakob
Copy link
Collaborator

rfjakob commented Mar 11, 2017

@benrubson I don't think we should try to remove extra warning flags that get added by distributions.

The only thing we should try to do is to make it build with the extra flags and, then, add it to our build system as well.

@benrubson
Copy link
Contributor

@rfjakob I agree with you.
I tried many other things but did not manage to make the build pass.
I'll need your help :)

@benrubson
Copy link
Contributor

@Aikhjarto try to build master ?
#298 has been merged, which updates easylogging++ with a new format (.h file + .cpp file, instead of one big .h file). Could help.
Thx !

@Aikhjarto
Copy link
Contributor Author

@benrubson Thanks for the update. Unfortunately, the error "undefined reference" is still present:

[  169s] /usr/bin/cmake -E cmake_link_script CMakeFiles/encfs.dir/link.txt --verbose=1
[  169s] /usr/bin/c++  -fPIC -fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -DNDEBUG -O2 -g -DNDEBUG -Wl,--as-needed -Wl,--no-undefined -Wl,-z,now -shared -Wl,-soname,libencfs.so.1.9 -o libencfs.so.1.9.1 CMakeFiles/encfs.dir/internal/easylogging++.cc.o CMakeFiles/encfs.dir/encfs/autosprintf.cpp.o CMakeFiles/encfs.dir/encfs/base64.cpp.o CMakeFiles/encfs.dir/encfs/BlockFileIO.cpp.o CMakeFiles/encfs.dir/encfs/BlockNameIO.cpp.o CMakeFiles/encfs.dir/encfs/Cipher.cpp.o CMakeFiles/encfs.dir/encfs/CipherFileIO.cpp.o CMakeFiles/encfs.dir/encfs/CipherKey.cpp.o CMakeFiles/encfs.dir/encfs/ConfigReader.cpp.o CMakeFiles/encfs.dir/encfs/ConfigVar.cpp.o CMakeFiles/encfs.dir/encfs/Context.cpp.o CMakeFiles/encfs.dir/encfs/DirNode.cpp.o CMakeFiles/encfs.dir/encfs/encfs.cpp.o CMakeFiles/encfs.dir/encfs/Error.cpp.o CMakeFiles/encfs.dir/encfs/FileIO.cpp.o CMakeFiles/encfs.dir/encfs/FileNode.cpp.o CMakeFiles/encfs.dir/encfs/FileUtils.cpp.o CMakeFiles/encfs.dir/encfs/Interface.cpp.o CMakeFiles/encfs.dir/encfs/MACFileIO.cpp.o CMakeFiles/encfs.dir/encfs/MemoryPool.cpp.o CMakeFiles/encfs.dir/encfs/NameIO.cpp.o CMakeFiles/encfs.dir/encfs/NullCipher.cpp.o CMakeFiles/encfs.dir/encfs/NullNameIO.cpp.o CMakeFiles/encfs.dir/encfs/openssl.cpp.o CMakeFiles/encfs.dir/encfs/RawFileIO.cpp.o CMakeFiles/encfs.dir/encfs/readpassphrase.cpp.o CMakeFiles/encfs.dir/encfs/SSL_Cipher.cpp.o CMakeFiles/encfs.dir/encfs/StreamNameIO.cpp.o CMakeFiles/encfs.dir/encfs/XmlReader.cpp.o  -L/home/abuild/rpmbuild/BUILD/encfs-1.9.1/build/internal/tinyxml2-3.0.0 -lfuse -lssl -lcrypto internal/tinyxml2-3.0.0/libtinyxml2.so.3.0.0 -lpthread
[  170s] CMakeFiles/encfs.dir/encfs/base64.cpp.o: In function `el::base::MessageBuilder::operator<<(char const*)':
[  170s] /home/abuild/rpmbuild/BUILD/encfs-1.9.1/internal/easylogging++.h:2911: undefined reference to `el::base::elStorage'
[  170s] /home/abuild/rpmbuild/BUILD/encfs-1.9.1/internal/easylogging++.h:2911: undefined reference to `el::base::elStorage'
[  170s] CMakeFiles/encfs.dir/encfs/BlockFileIO.cpp.o: In function `el::base::MessageBuilder::operator<<(char const*)':
[  170s] /home/abuild/rpmbuild/BUILD/encfs-1.9.1/internal/easylogging++.h:2911: undefined reference to `el::base::elStorage'
[  170s] /home/abuild/rpmbuild/BUILD/encfs-1.9.1/internal/easylogging++.h:2911: undefined reference to `el::base::elStorage'
[  170s] /home/abuild/rpmbuild/BUILD/encfs-1.9.1/internal/easylogging++.h:2911: undefined reference to `el::base::elStorage'
[  170s] CMakeFiles/encfs.dir/encfs/BlockFileIO.cpp.o:/home/abuild/rpmbuild/BUILD/encfs-1.9.1/internal/easylogging++.h:2911: more undefined references to `el::base::elStorage' follow
[  170s] collect2: error: ld returned 1 exit status
[  170s] CMakeFiles/encfs.dir/build.make:829: recipe for target 'libencfs.so.1.9.1' failed

@benrubson
Copy link
Contributor

In CMakeLists.txt, try moving following line :
internal/easylogging++.cc
At the end of the list, so after :
encfs/XmlReader.cpp
And rebuild from scratch.

@Aikhjarto
Copy link
Contributor Author

Changed build order, but error remains.

@benrubson
Copy link
Contributor

benrubson commented Apr 20, 2017

Perhaps you should open a easylogging++ issue ?
They certainly have already seen this, and could help us.
Thank you 👍

@Aikhjarto
Copy link
Contributor Author

Got a reply from the easylogging++ issue: INITIALIZE_EASYLOGGINGPP might be missing when linking libencfsctl.
This is the list of files where INITIALIZE_EASYLOGGINGPP appears in encfs.

#grep -R --exclude .git INITIALIZE_EASYLOGGINGPP
encfs/encfsctl.cpp:INITIALIZE_EASYLOGGINGPP
encfs/makeKey.cpp:INITIALIZE_EASYLOGGINGPP
encfs/main.cpp:INITIALIZE_EASYLOGGINGPP
encfs/test.cpp:INITIALIZE_EASYLOGGINGPP

Neither is used when linking libencfs.

@benrubson
Copy link
Contributor

#322 should solve your issue, could you give it a try ?
Thx !

@Aikhjarto
Copy link
Contributor Author

With #322 i can indeed build on openSuSE Leap. Howver, I have not yet checked if everything is working with this patch.

@benrubson
Copy link
Contributor

Perfect thank you for your feedback.
Modification done by this patch is really minor, everything should then work as expected.

@benrubson
Copy link
Contributor

#322 merged, you should be able to close this @Aikhjarto.
Thank you 👍

@Aikhjarto
Copy link
Contributor Author

@benrubson thanks for your contributions. I'll close the issue.

@benrubson
Copy link
Contributor

Thanks too @Aikhjarto !

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

3 participants