Hi,
I'm currently switching to github branch libraw 0.21-stable and tried to compile a more recent version of libraw. Unfortunately, running make after ./configure, I'm getting below error on macos Sonoma. What is needed to fix this?
Best,
Thilo
macbook:LibRaw user$ make
CDPATH="${ZSH_VERSION+.}:" && cd . && /bin/sh '/Users/tbauer/git/LibRaw/missing' aclocal-1.16 -I m4
/Users/tbauer/git/LibRaw/missing: line 81: aclocal-1.16: command not found
WARNING: 'aclocal-1.16' is missing on your system.
You should only need it if you modified 'acinclude.m4' or
'configure.ac' or m4 files included by 'configure.ac'.
The 'aclocal' program is part of the GNU Automake package:
It also requires GNU Autoconf, GNU m4 and Perl in order to run:
make: *** [aclocal.m4] Error 127
You need to either install
You need to either install autotools or just use make -f Makefile.dist
(adjust makefile to meet your needs: JPEG comression support, etc)
-- Alex Tutubalin @LibRaw LLC
Hi Alex,
Hi Alex,
Again, thanks for your quick support. I realized, that I had to update the whole brew installation on my mac and also install and upgrade a lot more tools and libraries, like automake or pkg-config, which is mentioned in an earlier post.
Also I had to install libraries, like jasper, or zlib. From a perspective of such an upgraded full fledged development machine, it is hard to judge, what libraries need to be provided with libraw bundled with an app on a plain macos end-user installation.
All dependencies (additional libraries) that are now compiled with libraw obviously do not exist on a barebone macos installation, esp. without additional development tools like XCode and additional add-ons installed using homebrew installation manager.
Is there a list of libraries (DLLs, share libs) that need to be provided together with any application that relies on libraw and not running in a full fledged development machine environment?
It would be a nightmare for a developer of collecting complaints from end-users that quickly refuse to use your app because its not running on a real world mac. :-)
Thanks,
Thilo
With default/unchanged
With default/unchanged Makefile.dist LibRaw requires zlib only (present in base macOS).
All additional dependencies (libjpeg, RawSpeed, Adobe DNG SDK) are optional and disabled by default.
-- Alex Tutubalin @LibRaw LLC
Thanks again. I could solve
Thanks again. I could solve the compile problems. Now, I'm getting a lot of undefined symbols when trying to link the library against my app. Most of them sound like the optional packages have been compiled into the library, now missing their references when linking against the static library for branch "LibRaw 0.21-stable", which sounds weird.
I tried to resolve this, by rolling back to version 0.20 and rebuild the library for this version, which previously worked. However, the list of undefined references I get while linking is even longer. Now, it sounds like optional libraries haven't been detected as optional when switching to branch "LibRaw 0.20-stable" and rebuilding after 'make clean'.
I followed the instructions how to compile by executing these commands:
autoreconf --install
./configure
make
Also I tried 'make clean' and rebuild from scratch and removed many files manually, with no success.
Any suggestion how to solve this?
Undefined symbols: LibRaw:
Undefined symbols: LibRaw::open_file means "You've forgot to link with libraw library"
The second group of errors means: you've build libraw with JPEG decompression support but forgot to add libjpeg to your linker input.
-- Alex Tutubalin @LibRaw LLC
The makefile for creation and
The makefile for creation and linking did not change. This is how linking of the source code is defined:
This actually runs following command to link the collected object files (mixed C/C++) with static library libraw and create a dynamic library as target
So the process of linking takes place, but the linker complains it cannot find the symbols in the created binary of 'libraw.a' at this stage. As if libraw binaries and the compiled sources from the project created different object binaries on the same machine and architecture (target machine currently is an Intel type MacBook Pro, x86_64), with all *.o files and libraries, or at least they do seem to have different method signatures.
Also I do not understand, why code segments are compiled into libraw, like DNG ore Kodak related stuff, if this is optional.
I tried to apply same compiler binaries and options to compile other projects *.cpp resources, but linking all created binaries against libraw still fails.
Again, I checked LibRaw's collected output of './configure', but cannot get insights why the binaries cannot be linked together:
This is the (sample) output during compilation of the sources of libraw:
Sorry, but your huge quotes
Sorry, but your huge quotes don't tell me anything at all, since all this happens within your build system, which I know nothing about.
Two short questions:
1) Do you build LibRaw via make -f Makefile.dist or via ./configure?
2) (in both cases): Does the LibRaw build result in compiled examples or not? (these examples are in ...LibRaw/bin/ folder if you're using provided Makefile.dist. They may be located somewhere else when configure is used)
-- Alex Tutubalin @LibRaw LLC
According to libraw
According to libraw documentation, it has been built like
Library binaries are created and placed in subdirectory 'lib' of the project repository and also placed at location '/usr/local/lib'.
Examples are also created in directory 'bin' of the libraw project repository.
Great.
Great.
Please link your binary the same way as LibRaw's examples.
-- Alex Tutubalin @LibRaw LLC
After reverse engineering of
After reverse engineering of 'libtool' and inspecting the output of the build, I found the samples link against the shared library using a deprecated options '-Wl,-bind_at_load'.
In my case I need to link my shared library against the static library 'libraw.a' and also avoid additional DLLs must be packed in addition to the dynamic library of libraw.
Could it be configure did something wrong and symbols are no longer exported during build process of libraw?
I still do not understand why the linker complains about undefined symbols of DNG or Kodak parts of the library, that should be incorporated as optional.
I don't think that the task
I don't think that the task of supporting our library is to teach anyone the linking options in their system.
If both the shared and static libraries are in the same directory, which you pass to the linker via the -L option, then it is not surprising that it chooses the shared one from the two possible libraries. Perhaps your linker has an option "choose from two - the static version" but again I don't think that the LibRaw forum is the right place to discuss macOS's ld options.
Other possible solutions (besides of linker option 'prefer static') are to move the static version to a separate directory or, conversely, remove the dynamic one from the directory passed to the linker. Also, configure can only create a static library without a dynamic one (again, I hope that we will not discuss configure options in our forum)
Regarding your second question (which I already answered above): you've build LibRaw with JPEG decompression support, you need to add libjpeg to your application linking input (since you say that the examples build successfully: configure/libtool already do that)
-- Alex Tutubalin @LibRaw LLC
Hi Alex,
Hi Alex,
the difference between a static library and a dynamic(ally linked) library is well known to me. This is not my concern.
I'm trying to understand what is different before and after pulling a new version from github, because from one day to the other our own application can no longer be linked against libraw, but results in errors due to 'undefined symbols', when trying to link against a new build of libraw. This typically occurs, when symbols are not flagged to be exported at compile time, or when the signature of methods in libraries do not match due to different naming conventions.
So I'm trying to understand the problem of 'undefined symbols' from the newly built libraw, esp. a missing main entry point 'LibRaw::open_file', which the linker complains 'undefined symbol' now in the static libraw.
According to your suggestion, I checked the locations where both, dynamic and static verisons of libraw reside after build:
The directory 'lib' in the code repository of libraw is created during the build process of libraw. There is no dynamic library version of libraw created and placed in this directory. In fact, the build process creates another hidden subdirectory, where both the static and dynamic libraries are compiled and linked. These then are placed at different locations during 'make install'.
I also tried to remove the created shared library twin of libraw from the system, with no success. The linker still complains about 'undefined symbols'.
An explicit path is set to this directory via option '-L' pointing to the directory 'lib' of the code repository, when linking our code to the static libraw.a. So the linker typically should not fetch a different version from any different location.
What I do not understand: The way we use libraw didn't change since months, as the Makefile to compile our own wrapper library didn't change, as well.
I checked the status of our work, how it was on the specific developer machine before and after pulling the recent version of libraw, by playing back a full back up of the operating system. Three days ago, before pulling the current work from github, there was such no problem of having undefined symbols when linking against the static version of libraw. Now the same makefile and build process can no longer link against a newer build of libraw.
No clue, what is wrong, except, we pulled a new version of the code repository of libraw from github.
Best,
Thilo
AFAIK, .a file (static
AFAIK, .a file (static library) is just an 'ar' archive of .o (object) files, so 'export/import' is not relevant for such an archive.
-- Alex Tutubalin @LibRaw LLC
I checked the contents of
I checked the contents of libraw.a using nm. In fact, nm did not list any symbols, but errors of missing "dynamic symbol tables". That's why...
So there must be something wrong with the automated configure and build.
please try to use nm without
please try to use nm without the -D option
-- Alex Tutubalin @LibRaw LLC
I would also be interested to
I would also be interested to know why the examples from the library link successfully (as far as I understood from your answer)
My recommendation to use the SAME options for linking as in the examples remains in force.
-- Alex Tutubalin @LibRaw LLC
Also your previous reply (
Also your previous reply ( https://www.libraw.org/comment/6846#comment-6846 ) lists both .a and .dylib files in /usr/local/lib while you're refering ./lib folder in your last reply.
I recommend removing all library instances from everywhere and starting from scratch to make sure there is ONE instance of the library binary in single preferred format (static one, I think) you are linking to, not several different ones in different folders.
-- Alex Tutubalin @LibRaw LLC
So we are closer to the root
So we are closer to the root cause. Listing all symbols nm and trying to find 'open_file' via grep reports a different signature for class LibRaw 'LibRaw::open_file', than the wrapper library and linker expects.
The linker expected a symbol 'LibRaw::open_file', while the compiled binary of the static library libraw.a has a different signature. Obviously, 'configure' might create confusion about the tools and proper options detected to compile and link the binaries for libraw, which will result in a completely different signature of the C++ class method. I need to see, what the specific root cause for macos will be in this case.
The _libraw_open_file is from
The _libraw_open_file is from LibRaw C API
The __ZN6LibRaw9open_fileEPKc is C++ name mangled LibRaw::open_file(char const*), you may use nm with -C option to see the demangled name.
-- Alex Tutubalin @LibRaw LLC
As you suggested before, I
As you suggested before, I tried building libraw using 'make -f Makefile.dist'. The result is different, but also ended up with 'undefined symbols' on certain methods that cannot be resolved while linking the library.
I tried to pull the repository from scratch in a new directory. This ended with persistent errors indicating the repo cannot be pulled completely without errors. I tried for a couple of hours, but found the specific error permanent. Maybe it's related to my problems.
$ date
$ date
Fri 25 Oct 2024 08:27:58 PM EDT
$ git clone https://github.com/LibRaw/LibRaw.git
Cloning into 'LibRaw'...
remote: Enumerating objects: 18973, done.
remote: Counting objects: 100% (1280/1280), done.
remote: Compressing objects: 100% (470/470), done.
remote: Total 18973 (delta 887), reused 1110 (delta 808), pack-reused 17693 (from 1)
Receiving objects: 100% (18973/18973), 13.82 MiB | 52.21 MiB/s, done.
Resolving deltas: 100% (14751/14751), done.
$ date
Fri 25 Oct 2024 08:28:10 PM EDT
$
I do not see any problems
I do not see any problems with github:
Also, I do not think that LibRaw will even build if git transaction is incomplete, assuming you're starting from scratch with empty folder. If the folder was not empty, it probably contains some previous version.
-- Alex Tutubalin @LibRaw LLC
And, as expected, LibRaw
And, as expected, LibRaw/master, fetched from github, builds via make -f Makefile.dist as expected, samples are linked fine, no unresolved symbols.
-- Alex Tutubalin @LibRaw LLC
Good morning, Alex.
Good morning, Alex.
github problems healed overnight.
So I could just pull the repository into a clean directory and run a fresh compile of libraw from master using your suggested simpler way to compile, which avoids configure before make.
The created binary of static libraw.a is now usable and can be linked with no unresolved symbols from both master branch and also version 0.21.
My finding is:
The suggested way to compile the binaries using 'autoreconf --install' and 'configure' messed up the source repository and build pipeline specifically on our macos environment. For some unknown reason this ended up in an unusable binary of the static libraw library that could not be linked due to 'undefined symbols'.
I should add, that autoreconf/configure requires installation of additional tools using homebrew package manager on Mac, namely autoconf, automake and pkg-config, that are not part of the standard Apple development environment XCode. Seems these tools messed up detection of the proper C/C++ make configuration on mac platform which led to incompatibilities linking two different libraries (undefined symbols).
I rolled back to plain Apple XCode C/C++ development tools, and uninstalled autoconf & Co, before I tried a fresh install of libraw. That said, autoreconf/configure is not possible by using XCode only on Mac plaform.
Apologies, but I didn't dig deeper in analysis what exactly fails using autoreconf/configure on mac, thus cannot provide insights what could be improved for libraw to be installed the suggested way on macos Sonoma.
Avoiding the suggested installation to run autoreconf/configure to compile libraw static binary on mac Sonoma platform is the solution in my case.
Thanks again for your help.
Thilo
Glad to hear that our advice
Glad to hear that our advice to start over from scratch and not use development tools that you don't understand what they do helped you.
-- Alex Tutubalin @LibRaw LLC