tdmartin102 / ajrdatabase

An OpenSource implementation of Apple's Objective-C Enterprise Objects framework
22 stars 9 forks source link

Build requirements? #9

Open sstillwell opened 6 years ago

sstillwell commented 6 years ago

This isn't so much an issue as it is a question...

I'm happy to see that this project is still active - I've been trying for a long time to find something that resurrects some of the old EOF tooling that existed back on the NeXT. Had one of my clients demonstrate it to me one time and I was hooked.

Is there any documentation as to MacOS and Xcode requirements? I've cloned the repo and tried building various projects from it as well as running the buildFrameworks script...nothing seems to build successfully. I'm using macOS 10.13.3 with Xcode 9.2. I've used the XcodeLegacy scripts to load in SDKs and tools all the way back to 10.4, but wouldn't know what to change it to - the projects seem to come up defaulting to "Latest macOS SDK".

I'd like to be able to come up with a simple Cocoa UI that allows me to CRUD a very simple table - sort of the "Hello World" of database applications. From there I can continue to move forward and possibly help out here.

Thanks!

sstillwell commented 6 years ago

It would help if I actually read the documentation, wouldn't it? Found the section on "Building AJRDatabase". Xcode 3.1? I guess I can build up a VM if I need to. Closing for now.

sstillwell commented 6 years ago

...and I'm even more stupid than I thought, evidently, since I was reading the documentation for Baseten, not AJRDatabase. Reopening the issue. Sorry for the unnecessary noise.

tdmartin102 commented 6 years ago

It would help if I read my e-mail once in awhile. Which database adaptor are you trying to build for? This should build with XCode 9.x and all the latest. No old SDK required. That said it has a specific build order and it depends on database libraries that are not included. so... it can be tricky

tdmartin102 commented 6 years ago

I just took a look at the build script, and there is no way this is going to work anymore. This worked for Oracle and for XCode 4. It will not work for XCode 9. I'll update the script. Plus... Oracle is a bear. If you want to build for Oracle, I have documentation on how to go about doing that.

sstillwell commented 6 years ago

Primarily I'm interested in PostgreSQL, but MySQL or SQLite would be useful as well.

tdmartin102 commented 6 years ago

I updated the buildFrameworks script it is working on my computer for MySQL and Oracle. All bets are off for Postgres and SQLLite because I have made no effort at all to keep those adaptors up to date. Both Oracle and MySQL seem to be solid. Our company has been using the Oracle database adaptor / frameworks with over 100 applications. I have done a lot of testing with the MySQL adaptor and it seems solid, but it has not been deployed in a production environment.

If you have issues compiling make sure the project is not reporting missing assets. Sometimes the paths get messed up and are relative when they should be absolute or the other way around.

sstillwell commented 6 years ago

That gets a lot closer, but MySQL actually fails to build here. I removed XcodeLegacy and homebrew versions of gcc, libunistring, etc. that might impact the build, but I still get errors on stuff that looks...odd. Includes of math.h, that sort of thing. It snowballs rapidly after the first error.

Oddly enough, I altered your build script to include PostgreSQL as a choice and all I had to do there was ln -s /usr/local/opt/libpq/include /Library/PostgreSQL/9.5/include for it to work (the source path is from where homebrew installs libpq.)

I haven't tried Oracle as I don't have an instance running here.

If you want, I can pastebin the errors from the MySQL build.

sstillwell commented 6 years ago

Progress being made. I've got EOModeler built and running, but loading the example riemer.eomodeld from the Countries example fails because it expects MySQL. I'm in the process of manually editing the index.eomodeld down inside the bundle to use PostgreSQL and I'll create a database for it to use with the provided SQL Script.

sstillwell commented 6 years ago

After sufficient mangling of the SQL script I was able to import into PostgreSQL and EOModeler successfully connects and queries data. When trying to generate Objective-C code, I see the following in the console log: 2018-03-19 16:49:30.212172-0500 EOModeler[48364:4791252] [default] Faild to get owner UUID for url: file:///Volumes/Old%20Data%20Volume%201/Transfers error: Error Domain=NSCocoaErrorDomain Code=260 "The file “Transfers” couldn’t be opened because there is no such file." UserInfo={NSURL=file:///Volumes/Old%20Data%20Volume%201/Transfers, NSFilePath=/Volumes/Old Data Volume 1/Transfers, NSUnderlyingError=0x61400005a400 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}}

I don't have any disk labeled "Old Data Volume 1", but I also can't find any preference or source code reference where that's coming from. Ideas?

The example "Countries" project also successfully runs and connects to PostgreSQL and displays expected data with relationships. Haven't tested insert/update/delete, but so far, so good.

sstillwell commented 6 years ago

https://gist.github.com/sstillwell/ffb551fda8be31e5992a17cda0afa3cb

tdmartin102 commented 6 years ago

I have to say, that I am stunned that you got PostgreSQL to compile/run. I vaguely remember going over the code and getting it to compile long long ago, but I never actually TRIED it. nice! I updated the script first thing this morning before I read your messages to include the other adaptors, so that is now in there. The 'Old Data Volume 1' is odd, I don't have anything like that either. I can't understand why the MySQL is failing to compile for you. Thank you for submitting the error log. I'll do some investigation of that. I can't give it a whole lot of time because I have a project deadline coming up. btw EOModelers ability to to create code and create database tables is dependent on code in the Adaptors. I don't think that code is complete for any of the adaptors other than Oracle and MySQL.

tdmartin102 commented 6 years ago

A quick look at the log, it seems like there is some system mangling going on. In stdatomic.h it SHOULD be including on line 34 and instead is including /usr/local/include/wine/msvcrt/stddef.h which is odd. I did not think wine did anything like that. Also this is later, not the first errors. I'm going to revisit this during lunch. You might want to check to see if you still have wine installed and if so, what impact it may be having.

tdmartin102 commented 6 years ago

Ah. I see a whole BUNCH of /usr/local/ includes in your environment. That is where the wine include is coming from. It may be causing some other problems as well. I would suggest removing most of those. Maybe you have a recurse flag on /usr/local/include ?

sstillwell commented 6 years ago

The MySQL adapter did have /usr/local/include (recursive) on the header search path. I replaced that with a non-recursive path that contains the MySQL headers and it builds successfully. I don't think that was a change I made, though...it was there to begin with. I could of course be wrong...I usually am. :)

When testing the Countries example app, I noticed some odd behavior when trying to add and then delete a new country (deleting made ALL countries in that region disappear from the list box, but not the database), so yeah, there's probably still some incomplete/incorrect bits in the PostgreSQL adaptor. I'll start playing around with MySQL now that it builds.

tdmartin102 commented 6 years ago

I'm sure the recursive flag was all me. I do that WAY too often. Could you possibly send me your SQL that you used to generate the PostgreSQL database for the Countries example. I would sort of like to take a look at it. Still kind of in awe that it worked at all.

sstillwell commented 6 years ago

I'll re-do it and send it to you...I was just editing the code in a window and then closed without saving. My bad. The biggest thing is removing the back quotes around names...that's a MySQL-ism that doesn't apply ANYWHERE else as far as I know. I also had to change bigint type to numeric(20,0) to accommodate enough digits and remove the () from all other int declarations...that's mysql specific as well. Anyway, I'll redo it and send it to you...you're doing quite enough here so far and it's very much appreciated.

sstillwell commented 6 years ago

Here's the sql script updated to load into PostgreSQL. It's hacky, but should work for the purpose intended. sampleDatabase_postgresql.sql.zip

tdmartin102 commented 6 years ago

Thanks, I'm out of time for the moment. But I will take a look when I get a chance.