CNMAT / CNMAT-odot

Multi-paradigm Dynamic Programming
Other
115 stars 11 forks source link

Duplicate Symbols (Build Failure) #372

Closed ilzxc closed 6 years ago

ilzxc commented 6 years ago

On build, getting one error when linking o.schedule:

duplicate symbol _messages in:
    /Users/ilyarostovtsev/Documents/code/cnmat/CNMAT-odot/src/build/odot.build/Release/o.schedule.build/Objects-normal/x86_64/o.schedule.o
    /Users/ilyarostovtsev/Documents/code/cnmat/CNMAT-odot/src/build/odot.build/Release/o.schedule.build/Objects-normal/x86_64/pqops.o
duplicate symbol _tmp in:
    /Users/ilyarostovtsev/Documents/code/cnmat/CNMAT-odot/src/build/odot.build/Release/o.schedule.build/Objects-normal/x86_64/o.schedule.o
    /Users/ilyarostovtsev/Documents/code/cnmat/CNMAT-odot/src/build/odot.build/Release/o.schedule.build/Objects-normal/x86_64/pqops.o
ld: 2 duplicate symbols for architecture x86_64
Command MasterObjectLink failed with a nonzero exit code

I do not recall having pqops back when I was on the project, so any clarity regarding this would be most appreciated.

I'm on 10.13.6 and trying to compile using Xcode 10.0 (freshly updated).

ramagottfried commented 6 years ago

hmm, weird -- builds fine here.. you need pqops, it should already be in the xcode project -- linked to the file in the o.schedule folder.

ramagottfried commented 6 years ago

fwiw I'm on xcode 9.4.1

ilzxc commented 6 years ago

They're both in the project, and the issue is that both contain _messages and _tmp symbols that the linker can't resolve. Doesn't matter if I build from make or from Xcode. I'm relatively sure that one of them is unnecessary for a target (which may have been lost when migrating the project to new Xcode). Is it the case that pqops is used in pd external but not in the Max one?

ramagottfried commented 6 years ago

strange -- yeah, sounds like Xcode 10 might have screwed up your project. pqops is used by Max also.

seems like xcode is doubly linking on your system for some reason.

ilzxc commented 6 years ago

The issue is definitely in the codebase, since you're including pqops.h in o.schedule AND it's also included by the pqops.c and since the header declares messages and tmp it seems very odd to me that this ever compiled without some cleverness. I just moved the declarations to be global in pqops.c from the header and odot is compiling correctly.

I guess if an update to Xcode 10 breaks your builds, let me know if I can be of any help, because I think I got everything (max & pd) to build properly.

ramagottfried commented 6 years ago

oh wow, yeah bizzaro, pqops.h doesn't have a double include #ifdef or #pramga once, I'm surprised that ever worked!

ramagottfried commented 6 years ago

maybe something in clang changed that's being less permissive... but anyway, yes, that seems like a bug.

ilzxc commented 6 years ago

I’m happy to submit a pull request if needed as I have no way of testing this on an older OS X. Alternatively, we can just close this if you don’t mind submitting a fix for this whenever it becomes necessary.

Hope all is well and best wishes!

On Oct 3, 2018, at 12:20 AM, rama gottfried notifications@github.com wrote:

maybe something in clang changed that's being less permissive... but anyway, yes, that seems like a bug.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

ramagottfried commented 6 years ago

thanks ilya! best wishes to you too!

I just pushed what should be a fix for the pqops double include issue, added an #ifdef check, and also moved the globals to the .c file for good measure.

as for the Carbon issue, I guess let's wait for a while, as I'm nervous about Xcode 9/10 compatibility. And I'd rather not merge the two until it's really necessary.

If you want to create a pull request that could be useful in the future to have your fixes on record.

cheers!