Closed stemuser027 closed 4 years ago
Hi, there are plenty of resources to learn how to install SOIL2 and set up an OpenGL context. There are youtube videos: https://www.youtube.com/watch?v=O9qrm5ZelD8 https://www.youtube.com/watch?v=bxov_ZhJoG4 Books: https://books.google.com.ar/books?id=GomCDwAAQBAJ&pg=PT480&lpg=PT480&dq=SOIL2+opengl&source=bl&ots=uJ5191EdCk&sig=ACfU3U2GpWXoHn1IOZ2mbwrkGMCFsfsLtw&hl=en&sa=X&ved=2ahUKEwjUy6TE5aPrAhUbGbkGHa7yC1wQ6AEwCnoECAIQAQ#v=onepage&q=SOIL2%20opengl&f=false There's a vcpkg build of SOIL2 too. But, the process will change depending on your toolchain. You just need to search in your favorite search engine a little bit. Good luck!
Sorry to bother you, but I have gone through all the documents I can find on google but cannot find the libSOIL.a file. I have watched several youtube videos too.
The only one that comes close to explaining my situation indicates I have to download premake and put it in the same directory as premake5.lua.
This is what I have done so far but I am getting an error. I need help and will truly appreciate your help since you are familiar with it:
downloaded SOIL2 using https://github.com/SpartanJ/SOIL2.git
cd to /SOIL2
Go to https://premake.github.io/download.html#v5 download premake and put it in the /SOIL directory
execute premake5 gmake
cd make/windows
execute make
At this point I get the following error
$ make ==== Building soil2-static-lib (debug_x86_64) ==== Creating ../../lib/windows Linking soil2-static-lib ==== Building soil2-shared-lib (debug_x86_64) ==== Linking soil2-shared-lib /usr/bin/sh: cc: command not found make[1]: [soil2-shared-lib.make:134: ../../lib/windows/soil2-debug.dll] Error 127 make: [makefile:51: soil2-shared-lib] Error 2
If you are using mingw, you should replace make in favor of mingw32-make, AFAIK make is only valid in a cygwin or wsl environment.
Thank you so much. That helped a lot. I had other issues which I have resolved. I now have the following error. Please help. Thank you so much
undefined reference to SOIL_load_OGL_texture' and
SOIL_last_result'
They are both in SOIL2.h, and I have
[ 50%] Building CXX object CMakeFiles/untitled5.dir/mainkeyboard.cpp.obj
[100%] Linking CXX executable untitled5.exe
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: CMakeFiles\untitled5.dir/objects.a(mainkeyboard.cpp.obj): in function Z10load_imagev': C:/untitled5/mainkeyboard.cpp:35: undefined reference to
SOIL_load_OGL_texture'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe:
C:/untitled5/mainkeyboard.cpp:43: undefined reference to `SOIL_last_result'
collect2.exe: error: ld returned 1 exit status
mingw32-make.exe[3]: [untitled5.exe] Error 1
mingw32-make.exe[2]: [CMakeFiles/untitled5.dir/all] Error 2
mingw32-make.exe[1]: [CMakeFiles/untitled5.dir/rule] Error 2
mingw32-make.exe: [untitled5] Error 2
CMakeFiles\untitled5.dir\build.make:106: recipe for target 'untitled5.exe' failed
CMakeFiles\Makefile2:94: recipe for target 'CMakeFiles/untitled5.dir/all' failed
CMakeFiles\Makefile2:101: recipe for target 'CMakeFiles/untitled5.dir/rule' failed
Makefile:137: recipe for target 'untitled5' failed
I tried adding -lSOIL to my target_link_libraries but I got another error mingw32/bin/ld.exe: cannot find -lSOIL
If you are dynamically linking the library it should be -lSOIL2. If you're statically linking it should point to the libsoil2.a
.
I abandoned Linux because I could not get it to work and switched to windows but I am still getting the same errors.
I downloaded SOIL2 package from this website using: https://github.com/SpartanJ/SOIL2.git
I am now using Visual Studio 2017 and installed soil2-debug.dll in C:\Windows\System32 and C:\Windows\SysWOW64.
I cannot find the .lib file. Is there one? Where can I find it.
I am getting the following errors. Please let me know what I am doing wrong.
Severity Code Description Project File Line Suppression State
Error (active) E0020 identifier "SOIL_last_result" is undefined Keyboard C:\Users\xxx\source\repos\MainKeyboard\Keyboard\Keyboard.cpp 44
Error (active) E0020 identifier "SOIL_load_OGL_texture" is undefined Keyboard C:\Users\xxx\source\repos\MainKeyboard\Keyboard\Keyboard.cpp 33
Error (active) E0020 identifier "SOIL_LOAD_AUTO" is undefined Keyboard C:\Users\xxx\source\repos\MainKeyboard\Keyboard\Keyboard.cpp 38
Error (active) E0020 identifier "SOIL_CREATE_NEW_ID" is undefined Keyboard C:\Users\xxx\source\repos\MainKeyboard\Keyboard\Keyboard.cpp 39
Error (active) E0020 identifier "SOIL_FLAG_MIPMAPS" is undefined Keyboard C:\Users\xxx\source\repos\MainKeyboard\Keyboard\Keyboard.cpp 40
Error (active) E0020 identifier "SOIL_FLAG_INVERT_Y" is undefined Keyboard C:\Users\xxx\source\repos\MainKeyboard\Keyboard\Keyboard.cpp 40
Error (active) E0020 identifier "SOIL_FLAG_NTSC_SAFE_RGB" is undefined Keyboard C:\Users\xxx\source\repos\MainKeyboard\Keyboard\Keyboard.cpp 40
Error (active) E0020 identifier "SOIL_FLAG_COMPRESS_TO_DXT" is undefined Keyboard C:\Users\xxx\source\repos\MainKeyboard\Keyboard\Keyboard.cpp 40
please can you help
I abandoned Linux because I could not get it to work and switched to windows but I am still getting the same errors.
I downloaded SOIL2 package from this website using: https://github.com/SpartanJ/SOIL2.git
I am now using Visual Studio 2017 and installed soil2-debug.dll in C:\Windows\System32 and C:\Windows\SysWOW64.
I cannot find the .lib file. Is there one? Where can I find it.
I am getting the following errors. Please let me know what I am doing wrong.
Severity Code Description Project File Line Suppression State Error (active) E0020 identifier "SOIL_last_result" is undefined Keyboard C:\Users\xxx\source\repos\MainKeyboard\Keyboard\Keyboard.cpp 44 Error (active) E0020 identifier "SOIL_load_OGL_texture" is undefined Keyboard C:\Users\xxx\source\repos\MainKeyboard\Keyboard\Keyboard.cpp 33 Error (active) E0020 identifier "SOIL_LOAD_AUTO" is undefined Keyboard C:\Users\xxx\source\repos\MainKeyboard\Keyboard\Keyboard.cpp 38 Error (active) E0020 identifier "SOIL_CREATE_NEW_ID" is undefined Keyboard C:\Users\xxx\source\repos\MainKeyboard\Keyboard\Keyboard.cpp 39 Error (active) E0020 identifier "SOIL_FLAG_MIPMAPS" is undefined Keyboard C:\Users\xxx\source\repos\MainKeyboard\Keyboard\Keyboard.cpp 40 Error (active) E0020 identifier "SOIL_FLAG_INVERT_Y" is undefined Keyboard C:\Users\xxx\source\repos\MainKeyboard\Keyboard\Keyboard.cpp 40 Error (active) E0020 identifier "SOIL_FLAG_NTSC_SAFE_RGB" is undefined Keyboard C:\Users\xxx\source\repos\MainKeyboard\Keyboard\Keyboard.cpp 40 Error (active) E0020 identifier "SOIL_FLAG_COMPRESS_TO_DXT" is undefined Keyboard C:\Users\xxx\source\repos\MainKeyboard\Keyboard\Keyboard.cpp 40
That's a compilation error, it looks that you're not including SOIL2.h correctly.
The lib file should be generated when compiling SOIL2 as a VS project. You should find it at: lib/windows
.
I have come to find out building SOIL2 is not fun :(. Is there any step by step document somewhere that helps in this? I am trying to generate the libSOIL2.a file and have spent days trying to do it.
PLEEEEEESE HELPPPP
I have spent a few days with no progress. I am back trying to build again for Linux since Windows is also not working.
What I'm I doing wrong? I am getting the following errors:
$ mingw32-make
==== Building soil2-static-lib (debug) ====
==== Building soil2-shared-lib (debug) ====
==== Building soil2-test (debug) ====
Linking soil2-test
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: ../../obj/windows/debug/soil2-test/test_SOIL2.o: in function Z12get_total_msy': C:\SOIL2\make\windows/../../src/test/test_SOIL2.cpp:29: undefined reference to
SDL_GetPerformanceCounter'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: C:\SOIL2\make\windows/../../src/test/test_SOIL2.cpp:29: undefined reference to SDL_GetPerformanceFrequency' c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: ../../obj/windows/debug/soil2-test/test_SOIL2.o: in function
SDL_main':
C:\SOIL2\make\windows/../../src/test/test_SOIL2.cpp:37: undefined reference to SDL_Init' c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: C:\SOIL2\make\windows/../../src/test/test_SOIL2.cpp:39: undefined reference to
SDL_GetError'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: C:\SOIL2\make\windows/../../src/test/test_SOIL2.cpp:44: undefined reference to SDL_CreateWindow' c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: C:\SOIL2\make\windows/../../src/test/test_SOIL2.cpp:48: undefined reference to
SDL_GetError'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: C:\SOIL2\make\windows/../../src/test/test_SOIL2.cpp:52: undefined reference to SDL_GL_CreateContext' c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: C:\SOIL2\make\windows/../../src/test/test_SOIL2.cpp:56: undefined reference to
SDL_GetError'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: C:\SOIL2\make\windows/../../src/test/test_SOIL2.cpp:58: undefined reference to SDL_DestroyWindow' c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: C:\SOIL2\make\windows/../../src/test/test_SOIL2.cpp:63: undefined reference to
SDL_GL_SetSwapInterval'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: C:\SOIL2\make\windows/../../src/test/test_SOIL2.cpp:65: undefined reference to SDL_GL_MakeCurrent' c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: C:\SOIL2\make\windows/../../src/test/test_SOIL2.cpp:97: undefined reference to
SDL_GetPerformanceCounter'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: C:\SOIL2
What I'm I doing wrong? I am getting the following errors:
From that log? You need SDL2 in order to compile the tests! That won't prevent you to compile the library, only the test. You can get the mingw package for SDL2 from here.
Thank you very much for your response. I truly appreciate it. I downloaded the SDL2 package using the link you provided. I don't know if I have done this right but I did the following.
After downloading the package,
Is this correct so far?
what do I do next? I believe I have to copy the SDL directory to somewhere under the SOIL2 directory. Is this true? If so where?
Thank you so much. You have been very helpful
@stemuser027 I think it is best if you are searching for some tutorial how to link libraries in general and maybe some SOIL2 specific tutorial
You might also want to check out a package manager like Conan, so you don't have to move stuff around manually
Your problems are not specific to Linux or Windows. So I would recommend you to choose Linux or Windows and stick with it. If you are new to all of this you will need some patience until it works well. 😃 Best of luck!
I was able to link everything else. SOIL is the one I am having problems with. I tried several tutorials but did not get anywhere. I assumed since this was your area you would be able to point me to a very good solution. I have spent days on this so far, and had the clever idea that your team would be able to point me to the solution since I could not find any documentation for it. My patience as been tested several times but I have persevered. :) Does SOIL2 actually work? I do not want to spend all my time on this to find out it does not work. I cannot find anything to get me to the finish line
There is no team, it's just me, and this is an open-source project, this is not a product, so don't expect any support from it, just collaboration from well-intended people. I work on this in my free time, for free and whenever I want to.
I assumed since this was your area you would be able to point me to a very good solution.
I pointed you good solutions, but you seem to lack the basic knowledge to understand what I'm talking about.
My patience as been tested several times but I have persevered.
This is part of the process of learning, patience and commitment are key to success.
Does SOIL2 actually work?
What do you think? This is borderline passive-aggressive.
I do not want to spend all my time on this to find out it does not work. I cannot find anything to get me to the finish line
Then use another library, I would be happy if you use it, but it's not the end of the world if you are unable to use it.
The process to compile the SOIL2 on Linux is extremely simple:
If you want to compile everything including the test you will need to install SDL2 and it's headers if you are using Ubuntu or any apt based distribution you just need to: sudo apt-get install libsdl2-dev
, otherwise just look for the package on your distro of choice, it's always almost the same. Then you'll need premake4 or premake5, use the one you want (also in your package manager).
Then premake4 gmake
(or premake5 gmake2
if you use premake5)
cd make/linux
make
That's it.
Anyway, your problem is that you seem to don't know how to integrate a dynamic link library of a static library into your own project, that's not a SOIL2 issue...
BTW: Next time please be more grateful with other people's time, they don't owe you anything. Regards
Thank you for your response, and I do appreciate your time. I was in no way taking your time for granted. I just thought going to the source would be a better solution since I have scanned the internet for information about SOIL2. I was trying it out because I wanted to recommend it for educational use. I wanted to make sure I could set it up before introducing the kids to it. In terms of my knowledge, you will be amazed what I know, but we will save that for a rainy day.
When I asked "Does SOIL2 actually work?" you took it as a jab at you, but it was a genuine question. I tried something else not so long ago. I had so much problem with it, and later found out it was no longer supported. I did not want to recommend something if it will be a burden to you. As you pointed out, this is something you do in your spare time, and I support your dedication and resilience. I am actually an advocate for your work, not your enemy.
Stay Blessed
Sorry for bothering you again and I admit that I'm new to OpenGL and linking libraries. However since I'm newbie and there are not so much information I could find when googling how to use SOIL2, I decided to seek for your help.
Here are the steps that I tried on building SOIL2 on Linux:
premake5
and copy it into the repo.premake gmake
.cd make/linux
make
After the build, I see libsoil2-debug.a
and libsoil2-debug.so
in /lib
. I'm wondering if I building it wrong because you replied that we need libsoil2.a
.
Also, after the build, what should I do to include SOIL2 in my project. I'm not using any IDE, only text editor and compile with terminal. I tried to include -lSOIL2
when compiling the project and receive this:
/usr/bin/ld: cannot find -lSOIL2
I then tried to copy SOIL2 folder into the project and compile SOIL2.c with the project, and got this
SOIL2/SOIL2.c: In function ‘void* SOIL_GL_GetProcAddress(const char*)’:
SOIL2/SOIL2.c:306:2: error: invalid conversion from ‘void (*)()’ to ‘void*’ [-fpermissive]
304 | glXGetProcAddress
| ~~~~~~~~~~~~~~~~~
305 | #endif
| ~~~~~~
306 | ( (const GLubyte *)proc );
| ^~~~~~~~~~~~~~~~~~~~~~~~~
| |
| void (*)()
SOIL2/SOIL2.c: In function ‘unsigned int SOIL_direct_load_DDS_from_memory(const unsigned char*, int, unsigned int, int, int)’:
SOIL2/SOIL2.c:2409:1: error: jump to label ‘quick_exit’
2409 | quick_exit:
| ^~~~~~~~~~
Thanks for your time and I'm looking forward to your response!
Update: I tried to copy libsoil2-debug.so
and libsoil-debug.a
to /usr/lib/
and run ldconfig
. After that I recompile and got:
/usr/bin/ld: cannot find -llibsoil2-debug
/usr/bin/ld: note to link with /usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../lib/libsoil2-debug.a use -l:libsoil2-debug.a or rename it to liblibsoil2-debug.a
Then I tried to change use -l:libsoil2-debug.a
, didn't work. However, changing the name to liblibsoil2-debug.a
works perfectly. Sounds abnormal to me as the name is liblib
but as long as it works, I'll stick with it.
I am new to openGL. I have been trying for days to use SOIL and just realized there is a SOIL2 version. That will explain why I cannot find the libSOIL.a file for SOIL.
Now for my problem. What are the steps to install and incorporate SOIL2 into my project, so I can load .jpg files? I am using CLion
Please help