cannot find -lsdl

Questions or HOWTOs about the above? Post 'em here...
User avatar
huw
Private First Class
Private First Class
Posts: 158
Joined: Fri Apr 02, 2004 9:22 am
Location: England

cannot find -lsdl

Post by huw »

I have added libcURL and SDL and everything goes all right until I get this error:

Code: Select all

C:\Dev-Cpp\Bin\..\lib\gcc\mingw32\3.4.2\..\..\..\..\mingw32\bin\ld.exe: cannot find -lsdl
collect2: ld returned 1 exit status

make.exe: *** [../src/bzflag/bzflag.exe] Error 1

Execution terminated
Using Dev-C++ 4.9.9.2

Does anyone know how to fix it?

Thanks
User avatar
JeffM
Staff Sergeant
Staff Sergeant
Posts: 5195
Joined: Fri Dec 13, 2002 4:11 am
Location: https://github.com/OmniTanks
Contact:

Post by JeffM »

install the sdl dev librarys
ImageJeffM
User avatar
huw
Private First Class
Private First Class
Posts: 158
Joined: Fri Apr 02, 2004 9:22 am
Location: England

Post by huw »

I already copied over all the SDL files I thought were required. Where do I put the librarys (in case I have done it wrong)?
User avatar
huw
Private First Class
Private First Class
Posts: 158
Joined: Fri Apr 02, 2004 9:22 am
Location: England

Post by huw »

OK I have the following SDL files:
  • begin_code.h
    close_code.h
    libSDL.a
    libSDL.dll.a
    libSDL.la
    libSDLmain.a
    SDL.c
    SDL.h
    SDL_active.h
    SDL_audio.h
    SDL_byteorder.h
    SDL_cdrom.h
    SDL_copying.h
    SDL_cpuinfo.h
    SDL_endian.h
    SDL_error.c
    SDL_error.h
    SDL_error_c.h
    SDL_events.h
    SDL_fatal.c
    SDL_fatal.h
    SDL_getenv.c
    SDL_getenv.h
    SDL_joystick.h
    SDL_keyboard.h
    SDL_keysym.h
    SDL_loadso.c
    SDL_loadso.h
    SDL_main.h
    SDL_mouse.h
    SDL_mutex.h
    SDL_name.h
    SDL_opengl.h
    SDL_quit.h
    SDL_rwops.h
    SDL_syswm.h
    SDL_thread.h
    SDL_timer.h
    SDL_types.h
    SDL_version.h
    SDL_video.h
All those files are in \include.

I have the following cURL files in \include\cURL
  • curl.h
    easy.h
    Makefile.am
    Makefile.in
    mprintf.h
    multi.h
    stdcheaders.h
    types.h
I would much rather compile without SDL and use directx anyway but I don't know which section to modify in Dev-C++

Alternatively I could compile on VS2005 but that throughs up loads of errors just converting the project :wink:
User avatar
huw
Private First Class
Private First Class
Posts: 158
Joined: Fri Apr 02, 2004 9:22 am
Location: England

Post by huw »

I tried removing -lsdsl (as I could use the alternative. Is is directx or opengl :?: )

It then said it couldnt find -lcurl.

Removing -lcurl caused it to crash.

Looks like there is some sort of problem with the dev-c++ files (or I have the SDL and curl files in the wrong place :oops:)

I would really appreciate some help fixing this
User avatar
Lan
Private First Class
Private First Class
Posts: 296
Joined: Sun Jun 13, 2004 1:21 am
Contact:

Post by Lan »

You put all .a files in C:\Dev-Cpp\lib\ and all .h in C:\Dev-Cpp\include\ that are from downloaded libraries (such as SDL in this case).

Where did you get libCURL from? Inside the Dev-C++ update window or from curl.haxx.se? The latter is recommended (for right now) as it is the most recent version and 7.14 crashed for me (the old version). You will have to compile it, however, I have included prebuilt ones if you'd prefer.

I would recommend replacing the dev-c++ bzflag project files with fresh copies as they should be good to go.

Feel free to ask anything more about anything.
Attachments
curl.zip
read the readme.txt for full instructions. remember to take care of sdl too.
(131.29 KiB) Downloaded 79 times
User avatar
huw
Private First Class
Private First Class
Posts: 158
Joined: Fri Apr 02, 2004 9:22 am
Location: England

Post by huw »

Thanks lan. I did indeed get the cURL files from curl.haxx.se. I will try your files in the correct location and see how I go!

An update: I installed copyed the files over for SDL. I also found that it is possible to install them through the dev-c++ package manager.

I now get the error:

cannot find -lares
User avatar
Lan
Private First Class
Private First Class
Posts: 296
Joined: Sun Jun 13, 2004 1:21 am
Contact:

Post by Lan »

Ahh thats a sinch. Build libares.dev (included in the BZFlag dev-c++ folder), which goes lightning fast so don't worry (it is C files). Then place the outputed libares.a, which will appear after you build it in the very same bzflag dev-c++ folder, into C:\Dev-C++\lib, and you are good to go.

Respond with any further problems, I am glad to help.
User avatar
huw
Private First Class
Private First Class
Posts: 158
Joined: Fri Apr 02, 2004 9:22 am
Location: England

Post by huw »

Thanks again. libares.dev had a few warning but it built fine.

A new compile on bzflag now throws up:

Code: Select all

../Dev-C++/cURLManager.o:cURLManager.cxx:(.text+0x1dd): undefined reference to `_imp__curl_easy_init'
../Dev-C++/cURLManager.o:cURLManager.cxx:(.text+0x23a): undefined reference to `_imp__curl_easy_setopt'
../Dev-C++/cURLManager.o:cURLManager.cxx:(.text+0x286): undefined reference to `_imp__curl_easy_setopt'
../Dev-C++/cURLManager.o:cURLManager.cxx:(.text+0x2d2): undefined reference to `_imp__curl_easy_setopt'
../Dev-C++/cURLManager.o:cURLManager.cxx:(.text+0x326): undefined reference to `_imp__curl_easy_setopt'
../Dev-C++/cURLManager.o:cURLManager.cxx:(.text+0x379): undefined reference to `_imp__curl_easy_setopt'
../Dev-C++/cURLManager.o:cURLManager.cxx:(.text+0x583): undefined reference to `_imp__curl_easy_init'
../Dev-C++/cURLManager.o:cURLManager.cxx:(.text+0x5e0): undefined reference to `_imp__curl_easy_setopt'
../Dev-C++/cURLManager.o:cURLManager.cxx:(.text+0x62c): undefined reference to `_imp__curl_easy_setopt'
../Dev-C++/cURLManager.o:cURLManager.cxx:(.text+0x678): undefined reference to `_imp__curl_easy_setopt'
../Dev-C++/cURLManager.o:cURLManager.cxx:(.text+0x6cc): undefined reference to `_imp__curl_easy_setopt'
../Dev-C++/cURLManager.o:cURLManager.cxx:(.text+0x71f): undefined reference to `_imp__curl_easy_setopt'
../Dev-C++/cURLManager.o:cURLManager.cxx:(.text+0x8cc): undefined reference to `_imp__curl_easy_cleanup'
../Dev-C++/cURLManager.o:cURLManager.cxx:(.text+0xaa8): undefined reference to `_imp__curl_easy_cleanup'
../Dev-C++/cURLManager.o:cURLManager.cxx:(.text+0xc84): undefined reference to `_imp__curl_easy_cleanup'
../Dev-C++/cURLManager.o:cURLManager.cxx:(.text+0xdf0): undefined reference to `_imp__curl_version'
../Dev-C++/cURLManager.o:cURLManager.cxx:(.text+0xe0e): undefined reference to `_imp__curl_global_init'
../Dev-C++/cURLManager.o:cURLManager.cxx:(.text+0xe3a): undefined reference to `_imp__curl_multi_init'
../Dev-C++/cURLManager.o:cURLManager.cxx:(.text+0xec7): undefined reference to `_imp__curl_easy_setopt'
../Dev-C++/cURLManager.o:cURLManager.cxx:(.text+0xf14): undefined reference to `_imp__curl_easy_setopt'
../Dev-C++/cURLManager.o:cURLManager.cxx:(.text+0xf60): undefined reference to `_imp__curl_easy_setopt'
../Dev-C++/cURLManager.o:cURLManager.cxx:(.text+0xfbc): undefined reference to `_imp__curl_easy_setopt'
../Dev-C++/cURLManager.o:cURLManager.cxx:(.text+0x1018): undefined reference to `_imp__curl_easy_setopt'
../Dev-C++/cURLManager.o:cURLManager.cxx:(.text+0x108d): more undefined references to `_imp__curl_easy_setopt' follow
../Dev-C++/cURLManager.o:cURLManager.cxx:(.text+0x1419): undefined reference to `_imp__curl_multi_add_handle'
../Dev-C++/cURLManager.o:cURLManager.cxx:(.text+0x147a): undefined reference to `_imp__curl_multi_remove_handle'
../Dev-C++/cURLManager.o:cURLManager.cxx:(.text+0x154e): undefined reference to `_imp__curl_easy_perform'
../Dev-C++/cURLManager.o:cURLManager.cxx:(.text+0x15b4): undefined reference to `_imp__curl_multi_fdset'
../Dev-C++/cURLManager.o:cURLManager.cxx:(.text+0x162a): undefined reference to `_imp__curl_multi_perform'
../Dev-C++/cURLManager.o:cURLManager.cxx:(.text+0x1673): undefined reference to `_imp__curl_multi_info_read'
../Dev-C++/cURLManager.o:cURLManager.cxx:(.text+0x171d): undefined reference to `_imp__curl_formfree'
../Dev-C++/cURLManager.o:cURLManager.cxx:(.text+0x17c1): undefined reference to `_imp__curl_easy_getinfo'
../Dev-C++/cURLManager.o:cURLManager.cxx:(.text+0x1849): undefined reference to `_imp__curl_easy_setopt'
../Dev-C++/cURLManager.o:cURLManager.cxx:(.text+0x18a3): undefined reference to `_imp__curl_easy_setopt'
../Dev-C++/cURLManager.o:cURLManager.cxx:(.text+0x18f1): undefined reference to `_imp__curl_easy_setopt'
../Dev-C++/cURLManager.o:cURLManager.cxx:(.text+0x1965): undefined reference to `_imp__curl_easy_setopt'
../Dev-C++/cURLManager.o:cURLManager.cxx:(.text+0x19d9): undefined reference to `_imp__curl_easy_setopt'
../Dev-C++/cURLManager.o:cURLManager.cxx:(.text+0x1a65): undefined reference to `_imp__curl_formadd'
../Dev-C++/cURLManager.o:cURLManager.cxx:(.text+0x1ab9): undefined reference to `_imp__curl_easy_setopt'
C:/Dev-Cpp/lib/libmingw32.a(main.o):main.c:(.text+0x106): undefined reference to `WinMain@16'
collect2: ld returned 1 exit status

make.exe: *** [../src/bzflag/bzflag.exe] Error 1

Execution terminated
Seems to be an error with cURL although I am sure cURL is now installed exactly to your instructions :?
User avatar
Lan
Private First Class
Private First Class
Posts: 296
Joined: Sun Jun 13, 2004 1:21 am
Contact:

Post by Lan »

You said you took out "-lcurl" from the command line earlier in this thread. Did you put it back at any time?

If you did, please post the linker command line (make it link again and select the Compile Log tab, the linker command line starts with "ld.exe") and the command line to 1 source file (same place, starts with "g++.exe").

However, I feel this is an easy error because I've gotten errors like that many times.
User avatar
huw
Private First Class
Private First Class
Posts: 158
Joined: Fri Apr 02, 2004 9:22 am
Location: England

Post by huw »

I had added -lcurl back as I deleted the Dev-C++ files and then got them again from CVS.

In the project options in dev-c++ it does not have ld.exe shown, but I think that is because it hides it. I will try adding it anyway.

Current linker info:

Code: Select all

-lmingw32 -lstdc++ -lsdl -lcurl -lares -lws2_32 -ldsound -lwinmm -lglu32 -lopengl32 -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -luuid -lodbc32 -lodbccp32
Adding ld.exe infront of the linker parameters just gave error 1 so I think it must have been there before, just hidden
User avatar
Lan
Private First Class
Private First Class
Posts: 296
Joined: Sun Jun 13, 2004 1:21 am
Contact:

Post by Lan »

Correct, ld.exe should already be there but if it isn't, don't touch it. It knows what it's doing, its just me that isn't at times :)

Adding -lcurl alone should fix it. Please tell me if it doesn't.
User avatar
huw
Private First Class
Private First Class
Posts: 158
Joined: Fri Apr 02, 2004 9:22 am
Location: England

Post by huw »

Well -lcurl was already there before I tried adding ld.exe again.

Or do you mean -lcurl on its own?
User avatar
Lan
Private First Class
Private First Class
Posts: 296
Joined: Sun Jun 13, 2004 1:21 am
Contact:

Post by Lan »

Forget the ld.exe thing entirely.

Just make sure that under "Linker Options" in the "Project Options" area that "-lcurl" is included in the command line.
User avatar
huw
Private First Class
Private First Class
Posts: 158
Joined: Fri Apr 02, 2004 9:22 am
Location: England

Post by huw »

It is but that error still occurs :(
User avatar
huw
Private First Class
Private First Class
Posts: 158
Joined: Fri Apr 02, 2004 9:22 am
Location: England

Post by huw »

Updated CVS.

Now I get the error:

Code: Select all

../src/bzflag/clientCommands.cxx: In function `std::string cmdScreenshot(const std::string&, const std::vector<std::string, std::allocator<std::string> >&, bool*)':
../src/bzflag/clientCommands.cxx:647: error: `DIR' undeclared (first use this function)
../src/bzflag/clientCommands.cxx:647: error: (Each undeclared identifier is reported only once for each function it appears in.)
../src/bzflag/clientCommands.cxx:647: error: `directory' undeclared (first use this function)

../src/bzflag/clientCommands.cxx:647: error: `opendir' undeclared (first use this function)
../src/bzflag/clientCommands.cxx:651: error: `readdir' undeclared (first use this function)
../src/bzflag/clientCommands.cxx:652: error: invalid use of undefined type `struct dirent'
../src/bzflag/clientCommands.cxx:649: error: forward declaration of `struct dirent'
../src/bzflag/clientCommands.cxx:662: error: `closedir' undeclared (first use this function)

make.exe: *** [../Dev-C++/clientCommands.o] Error 1

Execution terminated
User avatar
Lan
Private First Class
Private First Class
Posts: 296
Joined: Sun Jun 13, 2004 1:21 am
Contact:

Post by Lan »

I looked over this topic and I tried thinking about exactly what could be the problem. I figured it out and I am 99.9% sure that this message will fix your problems.

First, make sure you have a fresh copy of bzflag.dev from CVS (if you are not using CVS HEAD, please tell me).

Next, download my attachment (see below), and then unzip it. It contains the key to the solution.

When you have unzipped it, take the included libcurl.a and replace it with the one you currently have in C:\Dev-C++\lib\. Despite the size difference, say yes to overwrite the old. The size difference is how it was built and it is dependent on the included .dll

Take the included libcurl.dll and place it in replacement of any copies you have specifically for bzflag. If you dont know of any, place the .dll whereever your compiled bzflag will be run from, or C:\WINDOWS\ (either or both is good, it is up to you).

Finish compiling bzflag. This should fix it as I have had this same error now that I think of it.

If it doesn't work (which I doubt it will but who knows?) tell me.

If it does work, and compiles fine, but crashes when you run it, recompile the entire project because some files may be using the older version of cURL you got rid of.
User avatar
huw
Private First Class
Private First Class
Posts: 158
Joined: Fri Apr 02, 2004 9:22 am
Location: England

Post by huw »

Used the files from the package you gave me (which updated my cURL from 7.14 to 7.15.)

Still got the same error but I updated CVS and now I get:

Code: Select all

C:/Dev-Cpp/lib/libmingw32.a(main.o):main.c:(.text+0x106): undefined reference to `WinMain@16'
collect2: ld returned 1 exit status

make.exe: *** [../src/bzflag/bzflag.exe] Error 1

Execution terminated
I checked and I am definitely using CVS head.
User avatar
Lan
Private First Class
Private First Class
Posts: 296
Joined: Sun Jun 13, 2004 1:21 am
Contact:

Post by Lan »

Okay I am 100% sure this one will solve your problems because I was able to reproduce your exact error.

Am I correct that you downloaded SDL from libsdl.org and that is the copy you are using? If so, go back to the folder that the SDL distribution came in. Go to the /lib/ directory in that very SDL folder. Cut and copy "libSDLmain.a" and paste it into C:\Dev-C++\lib\. Now, add "-lsdlmain" *RIGHT BEFORE* (and it must be the only command that is right before) where it says "-lsdl" in the Linker Options area of the Project Options window (where you have been before). Compile, and this should fix it as it fixed it for me.

If you got your SDL from the Dev-C++ update thing and you installed that very package (don't get multiple packages confused), tell me. However, please make sure it is that very package that you got from that very Dev-C++ update manager. If you are sure it is, then try the above libSDLmain.a thing anyway. That still will probably fix it.

If you don't have libSDLmain.a for whatever reason, redownload the package you originally had and extract it.

This will fix it for sure this time. If you get a segfault when you run the compiled product, rebuild all of bzflag.dev because there are probably version problems amongst files. Now that I know for sure will work as I have done that hundreds of times :)
Last edited by Lan on Thu Jan 19, 2006 6:08 am, edited 1 time in total.
User avatar
JeffM
Staff Sergeant
Staff Sergeant
Posts: 5195
Joined: Fri Dec 13, 2002 4:11 am
Location: https://github.com/OmniTanks
Contact:

Post by JeffM »

ok don't mean to be a spoilsport, but....

you can't post binarys for GPL code WITH OUT also posting the source code.

it dosn't mater if it's not modified, or whatever. It is stated VERY clearly in the license what has to be done. It's the same license we use, so we damn well better follow it for others.

The posted binarys have been removed. If they wish to be posted again, they must ether have the source in the zip file, or in a seperate zip in the same message.
ImageJeffM
User avatar
huw
Private First Class
Private First Class
Posts: 158
Joined: Fri Apr 02, 2004 9:22 am
Location: England

Post by huw »

It has compiled fine, thanks for all your help.

Some questions.

1) How can I compile without SDL (and use ?OpenGL instead)?

2) At the moment I have the 2.1.x line. As well as having the latest build I would also like to be able to use the latest 2.0.x. How do I set this up in tortoisecvs?
User avatar
Lan
Private First Class
Private First Class
Posts: 296
Joined: Sun Jun 13, 2004 1:21 am
Contact:

Post by Lan »

No problem, I am more than happy to help.

1. If you mean using GLUT, there is no current way to do so. You would have to program it yourself as it is not officially supported. However, DirectX is officially supported and to use it, you would have to make sure your IDE/compiler has it (Dev-C++ doesn't have it by default IIRC, VC++ probably does though that is not my area of intelligence). Next, replace the SDL*.cxx (* meaning that several files have different words in that spot, such as Display) with the Windows*.cxx files, located in /bzflag/src/platform/ directory.

2. Go to the directory that you store CVS sandboxes in (the directory that holds your CVS HEAD bzflag directory, but don't go into any sandboxes yet). Right click, and select CVS Checkout from the menu. Enter the same BZFlag CVS settings you had when you got HEAD. However, now click on the "Revision" tab near the top of the window. Under the "Branch or Tag", select the radio button titled "Choose branch or tag". Then, hit the newly-appearing "Update" button. After it is done updating, look through the little menu to the left of that Update button and select "2_0branch". Select Ok and check it out. That is the latest 2.0.* revision.
User avatar
huw
Private First Class
Private First Class
Posts: 158
Joined: Fri Apr 02, 2004 9:22 am
Location: England

Post by huw »

Thanks
User avatar
huw
Private First Class
Private First Class
Posts: 158
Joined: Fri Apr 02, 2004 9:22 am
Location: England

Post by huw »

I played around with it a bit more. The only issue I am having is that the sounds lag severly. The wav files are what they should be.

Is this an issue with the way I have compiled it or the CVS?
User avatar
Lan
Private First Class
Private First Class
Posts: 296
Joined: Sun Jun 13, 2004 1:21 am
Contact:

Post by Lan »

Sorry for the late response, I got caught up with some stuff.

I don't feel it has to do with the way you built it. If it were to be, try rebuilding the entire thing, though I think it probably isn't.

This should be reposted as a new topic in the Hardware Help forum near the top of the forum list.
Post Reply