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

Issue compiling libheif statically #189

Closed
efleurant opened this issue Dec 16, 2019 · 3 comments
Closed

Issue compiling libheif statically #189

efleurant opened this issue Dec 16, 2019 · 3 comments

Comments

@efleurant
Copy link

efleurant commented Dec 16, 2019

Tried to pass the -static flag to no avail. Any tips on how to build this library statically?

...
[ 42%] Linking CXX shared library libheif.so
cd /devEnv/_compiled/libheif/build/libheif && /usr/bin/cmake3 -E cmake_link_script CMakeFiles/heif.dir/link.txt --verbose=1
/usr/bin/c++ -fPIC -std=gnu++0x -static  -shared -Wl,-soname,libheif.so -o libheif.so CMakeFiles/heif.dir/bitstream.cc.o CMakeFiles/heif.dir/box.cc.o CMakeFiles/heif.dir/error.cc.o CMakeFiles/heif.dir/heif.cc.o CMakeFiles/heif.dir/heif_context.cc.o CMakeFiles/heif.dir/heif_file.cc.o CMakeFiles/heif.dir/heif_image.cc.o CMakeFiles/heif.dir/heif_hevc.cc.o CMakeFiles/heif.dir/heif_colorconversion.cc.o CMakeFiles/heif.dir/heif_plugin_registry.cc.o CMakeFiles/heif.dir/heif_plugin.cc.o 
/usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/4.8.5/crtbeginT.o: relocation R_X86_64_32 against `__TMC_END__' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/crtbeginT.o: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
make[2]: *** [libheif/libheif.so] Error 1
make[2]: Leaving directory `/devEnv/_compiled/libheif/build'
make[1]: *** [libheif/CMakeFiles/heif.dir/all] Error 2
make[1]: Leaving directory `/devEnv/_compiled/libheif/build'
make: *** [all] Error 2

Also it seems to force the -shared flag

Cheers

@cryptomilk
Copy link
Contributor

You don't provide enough information but to get a static lib you should use:

cmake -DBUILD_SHARED_LIBS=OFF ..

@lovell
Copy link
Contributor

lovell commented Oct 6, 2020

#354 should hopefully fix any remaining problems building libheif as a static library for both cmake and autotools.

@efleurant
Copy link
Author

#354 should hopefully fix any remaining problems building libheif as a static library for both cmake and autotools.

Seems to fix the problem, thanks

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