Question

So I have this very simply SDL application I want to be able to pass to my friend without having him download a whole bunch of SDL packages.

how can I go about this? I was told to use this line to compile: (note that I use ubuntu linux and so does my friend, and that this application compiles and runs without the "-Wl,-Bstatic" options just fine.)

    g++ test-sdl.cpp -o test-sdl -Wl,-Bstatic -lSDL_image -lSDL

But then I get this error:

    /usr/bin/ld: cannot find -lgcc_s  
    collect2: ld returned 1 exit status

why am I getting this error? how do I fix it? do I even have to do this in this way? Is there a different/easier/alternative way?

Am I asking for so much by wanting to save my friend the hassle of downloading packages he will probably never use anyway?

Thanks.

Was it helpful?

Solution

In the long run your best bet would be to figure out how to build .debs and then your friend's system's package management can take care of installing all the dependencies needed. If you want to distribute the packages more widely, using the platform's native packaging system as intended will save you and your users a lot of headaches.

Take a look at Ubuntu's guide to packaging and pbuilder.

Personally, I learned how to do this for my own projects (on Debian) from the Martin Krafft Debian book, and find using yada streamlines the process considerably.

OTHER TIPS

You should get rid of the -B, I think (this changes the search path, see man g++, and thus you can't find your libraries anymore).

The switch you meant is -static, without the B.

Edit in response to comments: sorry, that was incomplete. Instead, replace all of "-Wl,-Bstatic" with just "-static".

As codelogic wrote, -static is not an option to the linker (which -Wl implies).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top