Opened 9 years ago

Closed 9 years ago

Last modified 8 years ago

#3639 closed defect (fixed)

tor-0.2.3.x: enabling upnp or nat-pmp with LDFLAGS += --as-needed fails to link

Reported by: blueness Owned by: blueness
Priority: Medium Milestone:
Component: Core Tor/Tor Version: Tor:
Severity: Keywords: tor-client
Cc: Actual Points:
Parent ID: Points:
Reviewer: Sponsor:


The final error is

86_64-pc-linux-gnu-gcc -Wall -fno-strict-aliasing -march=native -O2 -pipe
-Wl,--as-needed -Wl,-O1 -o tor-fw-helper tor_fw_helper-tor-fw-helper.o
tor_fw_helper-tor-fw-helper-natpmp.o tor_fw_helper-tor-fw-helper-upnp.o
-lminiupnpc -lm ../../common/libor.a -lpthread -ldl
../../common/libor.a(util.o): In function `tor_mathlog':
util.c:(.text+0x8e1): undefined reference to `log'
../../common/libor.a(util.o): In function `tor_lround':
util.c:(.text+0x8f1): undefined reference to `lround'
collect2: ld returned 1 exit status
make[4]: * [tor-fw-helper] Error 1
make[4]: Leaving directory
* [all-recursive] Error 1
make[3]: Leaving directory
make[2]: * [all-recursive] Error 1
make[2]: Leaving directory
* [all-recursive] Error 1
make[1]: Leaving directory
make: * [all] Error 2

  • ERROR: net-misc/tor- failed (compile phase):
  • emake failed

This is fixed by reordering tor_fw_helper_LDADD in rc/tools/tor-fw-helper/ See the attached patch.

Child Tickets

Attachments (1)

tor- (654 bytes) - added by blueness 9 years ago.
Fixes build when linking with --as-needed

Download all attachments as: .zip

Change History (10)

Changed 9 years ago by blueness

Fixes build when linking with --as-needed

comment:1 Changed 9 years ago by blueness

Owner: set to blueness
Status: newaccepted
Version: Tor:

comment:2 Changed 9 years ago by cypherpunks

Component: - Select a componentTor Client

Does that break the build on windows? On the other hand, the fw-helper stuff doesn't work on windows yet anyway so maybe it doesn't matter.

-- Sebastian

comment:3 Changed 9 years ago by blueness

Nope, Gentoo.

comment:4 Changed 9 years ago by cypherpunks

Sorry I wasn't clear, I meant, does the build break on windows with your patch applied


comment:5 Changed 9 years ago by blueness

I tried compiling this in windows, and as you predicted, I'm not getting very far with fw-helper. So I don't think the patch will hurt anything there.

comment:6 Changed 9 years ago by rransom

Status: acceptedneeds_review

This patch can't make things any worse on Windows, and might help. But the real bug here is that we aren't explicitly listing -lm after .../libor.a on systems that require that for access to certain mathematical functions. (But this needs to be autodetected -- -lm is not required everywhere, and I would expect using it to break the build on Windows.)

comment:7 Changed 9 years ago by nickm

Resolution: fixed
Status: needs_reviewclosed

merging it then. "Every little bit helps."

comment:8 Changed 8 years ago by nickm

Keywords: tor-client added

comment:9 Changed 8 years ago by nickm

Component: Tor ClientTor
Note: See TracTickets for help on using tickets.