Cannot build with "system" jpeg lib Topic is solved
Cannot build with "system" jpeg lib
Hi
First off, forgive me if this is supposed to be somewhere else, this section looked more appropriate. Please move it to the correct place otherwise.
I am trying to add wxWidgets to a project, since the project already depends on libjpeg v9 I thought I could link with only that instead of the wxjpeg library that is older.
I replaced the include directories in the project files with the ones to my libjpeg v9 include directory, but the compilation is failing with "error LNK1104: cannot open file 'wxjpegd.lib'" (debug build).
I have dug through the project files and the wxWidgets code for 2 days, I cannot find where it specifically defines that it wants this lib. Usually when a library is missing I get swamped with "Unresolved symbol" errors from the linker.
I am building the non-monolithic static lib variant of wxWidgets. The error comes up when I am trying to link it all with my program.
I am building on Windows Vista using Visual Studio 2010 SP1.
The wxWidgets version is 3.0.0 (stable, not nightly)
Thanks in advance for the assistance! If anything is unclear I will try my best to provide the information required.
// Warepire
First off, forgive me if this is supposed to be somewhere else, this section looked more appropriate. Please move it to the correct place otherwise.
I am trying to add wxWidgets to a project, since the project already depends on libjpeg v9 I thought I could link with only that instead of the wxjpeg library that is older.
I replaced the include directories in the project files with the ones to my libjpeg v9 include directory, but the compilation is failing with "error LNK1104: cannot open file 'wxjpegd.lib'" (debug build).
I have dug through the project files and the wxWidgets code for 2 days, I cannot find where it specifically defines that it wants this lib. Usually when a library is missing I get swamped with "Unresolved symbol" errors from the linker.
I am building the non-monolithic static lib variant of wxWidgets. The error comes up when I am trying to link it all with my program.
I am building on Windows Vista using Visual Studio 2010 SP1.
The wxWidgets version is 3.0.0 (stable, not nightly)
Thanks in advance for the assistance! If anything is unclear I will try my best to provide the information required.
// Warepire
- eranon
- Can't get richer than this
- Posts: 867
- Joined: Sun May 13, 2012 11:42 pm
- Location: France
- Contact:
Re: Cannot build with "system" jpeg lib
Why do you want to short circuit wxWidgets ? Maybe the underlying lib is a special/custom one with a lot of subtle arrangements to works with wxWidgets (or at least a specific version). Also, I guess (nothing verified, I just react as it comes) all calls about jpeg format are done toward 'wxjpegd.lib' which does the bridge and certainly wraps the underlying libjpeg. So you'll have to modify wxWidgets everywhere (this being maybe against the wxWidget's licensing policy)... What the advantage to get ride of this specific wxWidgets part (and not about zlib, png, etc) ?
[Ind. dev. - wxWidgets 3.0/3.1 under "Win 7 64-bit, TDM64-GCC" + "OS X 10.9, LLVM Clang"]
Re: Cannot build with "system" jpeg lib
The linux version allows to use the system lib of libjpeg instead of the included one, why would it be against the license to do this on Windows? Isn't it the same license for all platforms? Seemed like it was when I read it. The project is supposed to be cross-platform in the future, it's the purpose of the wxWidgets addition.
Looking at the jpeg source folder it to me looks like it's simply an older version of libjpeg. wxjpeg as I understand it is simply the older libjpeg library with a wx-prefix. Or did I miss anything entirely? (It's a lot of code)
The advantage for me would be to only have to look after one libjpeg, and not 2. Also there is a risk of linker problems when linking 2 versions of the same library into the same code.
No code was ever replaced, I just switched the include dir from the jpeg source folder to the jpeg v9 folder.
The other image libraries are not used and disabled in setup, they are not replaced or removed physically.
Looking at the jpeg source folder it to me looks like it's simply an older version of libjpeg. wxjpeg as I understand it is simply the older libjpeg library with a wx-prefix. Or did I miss anything entirely? (It's a lot of code)
The advantage for me would be to only have to look after one libjpeg, and not 2. Also there is a risk of linker problems when linking 2 versions of the same library into the same code.
No code was ever replaced, I just switched the include dir from the jpeg source folder to the jpeg v9 folder.
The other image libraries are not used and disabled in setup, they are not replaced or removed physically.
Re: Cannot build with "system" jpeg lib
How are you building wxWidgets? (wx makefile or MSVC Project?)
If using one or the other you likely need to fix the makefile or the project to try to use the system jpeg lib.
Tim S.
If using one or the other you likely need to fix the makefile or the project to try to use the system jpeg lib.
Tim S.
- bishop.gis
- Earned a small fee
- Posts: 20
- Joined: Fri May 25, 2012 6:47 pm
Re: Cannot build with "system" jpeg lib
I build wxWidgets 32bit and 64bit on windows using external libjpeg with this cmake scripts: http://forums.wxwidgets.org/viewtopic.php?f=20&t=35122
I plan to add new scripts for version 3.0.
I would like to note, that not all wxWidgets cmponents build with such scripts
I plan to add new scripts for version 3.0.
I would like to note, that not all wxWidgets cmponents build with such scripts
Re: Cannot build with "system" jpeg lib
I am building wxWidgets through Visual Studio 2010 (using the solution). I did replace the include directory for the jpeg source, that's all there is to do when building static libs.
I looked some at those CMake scripts, but I did not see anything that could help me with my problem. Appreciate the attempt though.
I looked some at those CMake scripts, but I did not see anything that could help me with my problem. Appreciate the attempt though.
- eranon
- Can't get richer than this
- Posts: 867
- Joined: Sun May 13, 2012 11:42 pm
- Location: France
- Contact:
Re: Cannot build with "system" jpeg lib
I didn't use wxWidgets under Linux until now (MSW and OSX only), so I can't tell you the difference. What I said (but if you don't, it's different) is that modification of the wxWidgets code (so, inside its source, not about project file and build options arrangements) could be against the wxWidgets license... But it sounds you can manage what you want without this : so, it's perfectWarepire wrote:The linux version allows to use the system lib of libjpeg instead of the included one, why would it be against the license to do this on Windows?
[Ind. dev. - wxWidgets 3.0/3.1 under "Win 7 64-bit, TDM64-GCC" + "OS X 10.9, LLVM Clang"]
Re: Cannot build with "system" jpeg lib
After spending the weekend digging some more, I found the file responsible for defining the use of wxjpegd.lib over my newer jpeg.lib.
It's defined in the setup-wrapper for Vistual Studio compilers.
More specifically, these 3 lines of code in "wxWidgets-3.0.0/include/msvc/wx/setup.h":
Nothing changes if I define wxNO_JPEG_LIB in my preprocessor defines list for each and every one of the wxWidgets projects.
However, if I define it right above that piece of code, or if I comment those lines out it works like I want to, but I would much rather just define wxNO_JPEG_LIB somewhere outside of wxWidgets code for this to work.
Any suggestions to where I shall define wxNO_JPEG_LIB?
It's defined in the setup-wrapper for Vistual Studio compilers.
More specifically, these 3 lines of code in "wxWidgets-3.0.0/include/msvc/wx/setup.h":
Code: Select all
#if wxUSE_LIBJPEG && !defined(wxNO_JPEG_LIB) && !defined(WXUSINGDLL)
#pragma comment(lib, wx3RD_PARTY_LIB_NAME("jpeg"))
#endif
However, if I define it right above that piece of code, or if I comment those lines out it works like I want to, but I would much rather just define wxNO_JPEG_LIB somewhere outside of wxWidgets code for this to work.
Any suggestions to where I shall define wxNO_JPEG_LIB?
Re: Cannot build with "system" jpeg lib
Me I would try this to see if it works.
I would define wxSYSTEM_JPEG_LIB in the project defines.
defining wxNO_JPEG_LIB implies no jpeg lib will be used.
I believe wxSYSTEM_JPEG_LIB is currently unused by wxWidgets.
Tim S.
I would define wxSYSTEM_JPEG_LIB in the project defines.
defining wxNO_JPEG_LIB implies no jpeg lib will be used.
I believe wxSYSTEM_JPEG_LIB is currently unused by wxWidgets.
Code: Select all
#if wxUSE_LIBJPEG && !defined(wxNO_JPEG_LIB) && !defined(WXUSINGDLL) && !defined(wxSYSTEM_JPEG_LIB)
#pragma comment(lib, wx3RD_PARTY_LIB_NAME("jpeg"))
#endif
Re: Cannot build with "system" jpeg lib
That works. I was hoping to do it without editing the setup.h file but I guess that isn't possible in this case.
I think this should be added to the codebase so that this functionality becomes available for all who build on Windows using VS so that it becomes as easy to use external libs for this case as all the others. This should possibly work also for png, zip, tiff etc. But I have nothing to test that with.
Thanks for all the assistance!
I think this should be added to the codebase so that this functionality becomes available for all who build on Windows using VS so that it becomes as easy to use external libs for this case as all the others. This should possibly work also for png, zip, tiff etc. But I have nothing to test that with.
Thanks for all the assistance!