Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 965549
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T02:00:58+00:00 2026-05-16T02:00:58+00:00

I decided it would be a fun side project to do some work on

  • 0

I decided it would be a fun side project to do some work on tsocks, since it hasn’t seen any updates in 8 years. It’s hosted here on GitHub.

I only made cosmetic changes to the code so far, but now I’ve run into a compiler error. According to dlopen(3):

The obsolete symbols _init() and _fini()

[…]

Using these routines […] is not recommended. Their use may result in undesired behavior, since the constructor/destructor routines will not be executed (unless special measures are taken).

Instead, libraries should export routines using the __attribute__((constructor)) and __attribute__((destructor)) function attributes.

Unfortunately, this change (commit f785c8e) seems to be the source of the compiler error:

gcc -fPIC -g -O2 -Wall -I. -c  tsocks.c -o tsocks.o
gcc -fPIC -g -O2 -Wall -I. -c  common.c -o common.o
gcc -fPIC -g -O2 -Wall -I. -c  parser.c -o parser.o
gcc -fPIC -g -O2 -Wall -I. -static -o saveme saveme.c
gcc -fPIC -g -O2 -Wall -I. -o inspectsocks inspectsocks.c common.o -lc
gcc -fPIC -g -O2 -Wall -I. -o validateconf validateconf.c common.o parser.o -lc
gcc -fPIC -g -O2 -Wall -I. -o libtsocks.so.1.8 tsocks.o common.o parser.o  -ldl  -lc -rdynamic
/usr/lib/gcc/i686-redhat-linux/4.4.4/../../../crt1.o: In function `_start':
(.text+0x18): undefined reference to `main'
collect2: ld returned 1 exit status

Can anyone help me? I’m stumped.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T02:00:59+00:00Added an answer on May 16, 2026 at 2:00 am

    You’re trying to create a shared library as if it were an executable. This is what you want:

    SONAME = libtsocks.so.1
    
    $(SHLIB): $(OBJS) $(COMMON).o $(PARSER).o
        $(SHCC) -shared -Wl,-soname,$(SONAME) $(CFLAGS) $(INCLUDES) -o $(SHLIB) \
        $(OBJS) $(COMMON).o $(PARSER).o $(SPECIALLIBS) $(LIBS) -rdynamic
        ln -sf $(SHLIB) $(SONAME)
        ln -sf $(SONAME) libtsocks.so
    

    The critical part is the addition of -shared. I also fixed you to have a soname, which you must have and handle correctly if you want Linux distributions to pick up your library, but if you don’t know what it is, don’t worry about it till you get it to the point of wanting to make an official release – at which point, time to read up on it in all gory detail. I don’t, unfortunately, know a good place to point you at.

    This doesn’t actually have anything to do with _init/_fini versus __attribute__((constructor)) – I’m amazed it worked at all.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Some days ago, I decided that it would be fun to write a streambuf
I decided it would be fun to learn x86 assembly during the summer break.
In an effort to brush up on some multithreading/sorting fun, I decided to put
I've decided to have some fun, and implement .Net Properties in PHP. My current
I haven't done any C++ programming for quite some time and I decided that
Because ObjectContext.SaveChanges() occurs within a transaction I decided it would be best for my
I've decided that it would be good for me to move outside of my
I've decided to use this.variableName when referring to string/int etc.. fields. Would that include
I had some time and decided to implement a one time pad just for
I am trying to create a custom installer technology for some fun and generic

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.